Skip to content

fix(ui): preserve server-ranked file picker results - #1229

Merged
Astro-Han merged 2 commits into
devfrom
codex/upstream-ui-skip-filter
Jun 10, 2026
Merged

fix(ui): preserve server-ranked file picker results#1229
Astro-Han merged 2 commits into
devfrom
codex/upstream-ui-skip-filter

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Preserve server-ranked file search results in PawWork pickers by allowing file rows to opt out of the local fuzzy refilter step.

This PR ports the UI hunk from upstream anomalyco/opencode#31366 only. It adds a narrow skipFilter path to the shared filtered-list hook and enables it for command palette file rows, prompt @ server results, and line-comment mentions.

Why

File search results are already ranked by the server-side search path. The UI then ran fuzzysort again with the same user query, which could hide valid server-returned files when their display text did not locally fuzzymatch the query.

Related Issue

Upstream anomalyco/opencode#31366. No PawWork issue exists for this small upstream-value port.

Human Review Status

Pending

Review Focus

Please check that skipFilter is only enabled for server-ranked file results, while ordinary command/session/local list filtering still uses the existing fuzzy behavior.

Risk Notes

Low UI behavior risk. File picker rows can remain visible even when the local display text does not fuzzymatch, but ordinary local results still filter. No platform, packaging, permissions, docs, dependencies, generated files, or persistence surfaces were changed.

How To Verify

RED: bun test --conditions browser test/use-filtered-list.test.ts from packages/ui failed because skipped file results were filtered out before the implementation.
Focused test: bun run --cwd packages/ui test test/use-filtered-list.test.ts -> 2 passed, including the CodeRabbit follow-up order case.
UI typecheck: bun run --cwd packages/ui typecheck -> pass.
App typecheck: bun run --cwd packages/app typecheck -> pass.
Whitespace: git diff --check -> pass.
Fresh-eye review: no actionable P0-P3 findings.
Visible picker check: bun run --cwd packages/app snap command-palette-header -> 1 passed; generated docs/design/preview/screenshots/command-palette-header.png and manually inspected light/dark command palette output.

Screenshots or Recordings

Ran the existing command palette snap target and inspected the generated light/dark grid at docs/design/preview/screenshots/command-palette-header.png. The picker opens, renders list content, and has no blank or overlapping state; the fixture's bottom server-unreachable toast is unrelated to this filtering change.

Checklist

How to use this checklist:

  • Tick a box by replacing [ ] with [x]. Do not edit, add, or remove items.
  • The bot-applied label items can only be honestly ticked AFTER the PR is opened and the labeler / priority-triage bots have run — return to the PR description and tick them then.
  • Most items are required. The few that are conditional are explicitly marked (conditional); for those, leave unticked if they truly do not apply and explain why in Risk Notes. All other items must be ticked before requesting human review.
  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

@Astro-Han Astro-Han added bug Something isn't working P2 Medium priority upstream Tracked upstream or vendor behavior app Application behavior and product flows ui Design system and user interface labels Jun 10, 2026
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new filterListItems utility extracts fuzzy-sort filtering logic with an optional per-item skipFilter predicate. The useFilteredList hook is refactored to delegate filtering to this utility and expose skipFilter in its interface. Three components integrate the new capability to customize filtering: command-palette skips files, popover skips non-recent entries, and line-comment disables filtering entirely.

Changes

Filter list items refactoring with skipFilter predicate

Layer / File(s) Summary
New filterListItems utility function
packages/ui/src/hooks/filter-list-items.ts
filterListItems function implements fuzzy-based filtering with fuzzysort, supports an optional skipFilter callback to exclude items, and optional filterKeys for object-based searching. The return value appends skipped items after filtered results.
useFilteredList hook refactoring
packages/ui/src/hooks/use-filtered-list.tsx
FilteredListProps interface gains optional skipFilter?: (item: T) => boolean predicate. Hook delegates all filtering to the new filterListItems utility, replacing inline fuzzysort implementation with a single utility call.
Filter utility test suite
packages/ui/test/use-filtered-list.test.ts
Bun test suite validates filterListItems applies fuzzy filtering by title field while respecting skipFilter predicate to exclude items marked serverRanked: true.
Component skipFilter usage
packages/app/src/components/command-palette/command-palette-dialog.tsx, packages/app/src/components/prompt-input/popover-controllers.ts, packages/ui/src/components/line-comment.tsx
Command-palette skips filtering for "file"-type items, popover skips non-recent file entries for @ mentions, and line-comment disables filtering for mention autocomplete by passing skipFilter: () => true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 A fuzzy filter finds its way,
Skipping items along the display,
Three components now dance,
With smarter circumstance,
To control what gets filtered today! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: introducing skipFilter to preserve server-ranked file picker results, which prevents re-filtering already-ranked server results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is comprehensive and follows the required template structure with all major sections completed, including Summary, Why, Related Issue, Human Review Status, Review Focus, Risk Notes, How To Verify, Screenshots, and a fully-ticked Checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/upstream-ui-skip-filter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P2 (includes user-path files (packages/app/src/components/command-palette/command-palette-dialog.tsx, packages/app/src/components/prompt-input/popover-controllers.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extracts the filtering logic from useFilteredList into a separate helper function filterListItems and introduces a new skipFilter option. This option allows certain items to bypass the filtering process and remain in the results. The new functionality is integrated into DialogSelectFile, createPopoverControllers, and LineCommentEditor, and is accompanied by a new unit test. There are no review comments to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/ui/test/use-filtered-list.test.ts (1)

5-18: ⚡ Quick win

Add one mixed-result test to lock the append-order contract.

Current coverage proves skipped entries survive, but it does not verify behavior when both fuzzy matches and skipped items are present together. A small second test here would prevent regressions in the filtered + skipped merge path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/test/use-filtered-list.test.ts` around lines 5 - 18, Add a new
unit test in packages/ui/test/use-filtered-list.test.ts that verifies the merge
order when both fuzzy-matched items and skipped (serverRanked) items are
present: using the existing filterListItems helper and Item type, provide an
input list containing a fuzzy-matchable item (e.g., {id: "command", title: "Open
Settings"}) and a serverRanked item (e.g., {id: "file", title: "src/..",
serverRanked: true}), call filterListItems with a query that matches the first
item (e.g., "Open") and assert the returned ids preserve the contract that
filtered/fuzzy results come first and skipped serverRanked items are appended
(e.g., expect(["command","file"])).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/ui/test/use-filtered-list.test.ts`:
- Around line 5-18: Add a new unit test in
packages/ui/test/use-filtered-list.test.ts that verifies the merge order when
both fuzzy-matched items and skipped (serverRanked) items are present: using the
existing filterListItems helper and Item type, provide an input list containing
a fuzzy-matchable item (e.g., {id: "command", title: "Open Settings"}) and a
serverRanked item (e.g., {id: "file", title: "src/..", serverRanked: true}),
call filterListItems with a query that matches the first item (e.g., "Open") and
assert the returned ids preserve the contract that filtered/fuzzy results come
first and skipped serverRanked items are appended (e.g.,
expect(["command","file"])).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a05bc9d-754f-454b-9010-f1ecfef608d0

📥 Commits

Reviewing files that changed from the base of the PR and between aff7ce2 and 667bc3e.

📒 Files selected for processing (6)
  • packages/app/src/components/command-palette/command-palette-dialog.tsx
  • packages/app/src/components/prompt-input/popover-controllers.ts
  • packages/ui/src/components/line-comment.tsx
  • packages/ui/src/hooks/filter-list-items.ts
  • packages/ui/src/hooks/use-filtered-list.tsx
  • packages/ui/test/use-filtered-list.test.ts

@Astro-Han
Astro-Han merged commit f86a849 into dev Jun 10, 2026
41 of 42 checks passed
@Astro-Han
Astro-Han deleted the codex/upstream-ui-skip-filter branch June 10, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P2 Medium priority ui Design system and user interface upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant