fix(quickfiler): make folder-suggestion fallback selection bounds-safe (#392)#393
Merged
drmoisan merged 3 commits intoJul 20, 2026
Merged
Conversation
- Guard AssignFolderComboBox fallback selection against single-item list - Guard PopulateAndSelectFolder fallback selection against single-item list - Add regression tests for single-item, no-predetermined-match case Refs: #392 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A2Yht8Rg83Um38RaVyV1sA
- Covers PopulateFolderComboBox marshaling when InvokeRequired is true - Raises QfcItemController.FolderHandlingTests branch coverage above 75% floor - Includes feature-review audit and remediation evidence Refs: #392 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A2Yht8Rg83Um38RaVyV1sA
Refs: #392 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A2Yht8Rg83Um38RaVyV1sA
drmoisan
added a commit
that referenced
this pull request
Jul 20, 2026
…egration branch before final PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suggested title
fix(quickfiler): make folder-suggestion fallback selection bounds-safe (#392)
Summary
System.ArgumentOutOfRangeExceptionthrown fromBreadcrumbStateModel.SelectRowthat aborted the entire QuickFiler high-confidence load pipeline whenever a loaded item had exactly one folder suggestion and no predetermined folder match.QfcItemController.AssignFolderComboBox()no longer hardcodes fallback selection index 1; it selects index 0 whenFolderArrayhas exactly one entry (QuickFiler/Controllers/QfcItemController.FolderHandling.cs).PopulateAndSelectFolderapplies the same bounds-safe fallback for the single-item ComboBox path.Why
AssignFolderComboBoxassumed the folder-suggestion list always contained at least two entries (index 0 placeholder semantics plus an index-1 top suggestion). WhenFolderPredictorreturned exactly one suggestion, the unconditionalSetFolderSelectedIndex(1)flowed throughBreadcrumbBridgeCoordinator.SelectRowintoBreadcrumbStateModel.SelectRow, whose bounds validation (correct defensive behavior, unchanged by this PR) threwArgumentOutOfRangeException: "Row selection requires -1 or an index in [0, 0]". The exception propagated upQfcCollectionController.LoadSecondaryAsync→QfcFormController.LoadItemsAsync→QfcHomeController.LaunchAsyncand aborted the ribbon-initiated QuickFiler load. Root-cause analysis:evidence/other/root-cause-392.2026-07-20T13-50.md.What Changed
Core fix (C#, 2 files):
QuickFiler/Controllers/QfcItemController.FolderHandling.cs— fallback selection is nowFolderArray.Length == 1 ? 0 : 1inAssignFolderComboBox(), andpredeterminedIndex >= 0 ? predeterminedIndex : (folderArray.Length == 1 ? 0 : 1)inPopulateAndSelectFolder. No other production change.QuickFiler.Test/Controllers/QfcItemController.FolderHandlingTests.cs— addsAssignFolderComboBox_WhenSingleSuggestionNoPredeterminedMatch_SelectsIndexZero,PopulateAndSelectFolder_SingleItemNoPredeterminedMatch_SelectsIndexZeroWithoutThrowing, andPopulateFolderComboBox_WhenInvokeRequired_MarshalsAssignFolderComboBoxViaInvoke(branch-coverage remediation); comment-only trims keep the file at 498 lines (under the 500-line limit).Docs / audit trail:
docs/features/active/2026-07-20-folder-combobox-fallback-index-out-of-range-392/with issue.md (all five acceptance criteria checked), atomic plan, remediation plan, policy-audit / code-review / feature-audit artifacts for both review cycles, and full baseline/QA/regression evidence..claude/agent-memory/feature-review/.Architecture / How It Fits Together
The selection path is unchanged:
QfcItemController.AssignFolderComboBox()→IItemViewer.SetFolderSelectedIndex(int)→BreadcrumbBridgeCoordinator.SelectRow(int)→BreadcrumbStateModel.SelectRow(int). The fix constrains the caller to the model's documented invariant (index in[-1, rowCount-1]); the model's validation and the coordinator remain untouched.Verification
Completed (evidence under the feature folder's
evidence/tree):fail-before-392.2026-07-20T14-05.md, exit 1) and passed after (pass-after-392.2026-07-20T14-10.md).analyzer-final-392.2026-07-20T14-24.md,remediation-analyzer-final.2026-07-20T18-32.md)./t:Rebuildbuild: 34 errors, all pre-existing in vendoredSVGControl.csproj, byte-identical to the Phase 0 baseline; zero new errors, zero first-party errors (nullable-final-392.2026-07-20T15-10.md,remediation-nullable-final.2026-07-20T18-35.md; tracked separately indocs/features/potential/2026-07-07-ci-nullable-check-skipped-vendored-projects.md).remediation-regression-check.2026-07-20T18-46.md).remediation-coverage-delta.2026-07-20T18-44.md).Recommended:
QuickFiler.Test).Backward Compatibility / Migration Notes
No public API changes, no signature changes, no behavior change for multi-suggestion or predetermined-folder cases (re-verified by the pre-existing test set). No migration required.
Risks and Mitigations
QuickFilerpackage-wide coverage (73.72% line / 64.69% branch) remains below the repository floor. Mitigation: ratified as a pre-existing, separately-tracked exception (open issue Feature: quickfiler-80-per-file-coverage #136, disposition recordevidence/qa-gates/coverage-disposition-decision.2026-07-20T18-17.md); not regressed by this PR.Review Guide
QuickFiler/Controllers/QfcItemController.FolderHandling.cs(7-line production diff — the substantive change).QuickFiler.Test/Controllers/QfcItemController.FolderHandlingTests.cs(three new tests + disclosed comment-only trims).Follow-ups
docs/features/potential/2026-07-07-ci-nullable-check-skipped-vendored-projects.md: vendored-project nullable-gate scoping decision.count == 1 ? 0 : 1clamp is duplicated at the two fallback sites; candidate for a shared helper in a future cleanup.GitHub Auto-close