Skip to content

Unify picker search matching - #2943

Merged
ymichael merged 3 commits into
mainfrom
bb/unify-picker-search-policy
Sep 2, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/unify-picker-search-policy

Conversation

@ymichael

@ymichael ymichael commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

left: before, right after

image image

What was wrong

Searchable pickers did not share a matching policy. Project and Branch used case-insensitive substring filtering in source order, Model used an unranked subsequence regex, and Parent Thread implicitly inherited cmdk scoring. Matching behavior and result ordering therefore changed depending on which picker a user opened.

The first revision centralized picker behavior but introduced another fuzzy-matching implementation even though @bb/fuzzy-match already owns shared text-search policy. It also treated visible labels and hidden aliases as equivalent fields. A strong hidden-ID match could therefore outrank a useful visible-label match: the query 55 placed Nemotron above GPT-5.5 because Nemotron's raw ID contains 550b-a55b.

What changed

All searchable pickers now use one searchPickerOptions adapter backed by @bb/fuzzy-match. The adapter trims input and explicitly supplies each option's visible label as its primary text plus any type-specific aliases.

fuzzyMatchText now owns one field-aware policy:

  • Matching is case-insensitive for every query.
  • Any primary-text match ranks ahead of any alias-only match.
  • Within each field class, exact matches rank above prefixes, prefixes above contains matches, and contains matches above non-contiguous subsequences.
  • Deterministic tiebreakers prefer earlier matches, shorter text, lexical order, then source order.

Aliases still add results. Parent Thread adds the thread ID, Model adds the route provider and raw model ID, mention suggestions add entity IDs, and command-palette groups remain searchable. Project and Branch search their visible names. Branch search no longer pins a weaker selected result above stronger matches, and Model search ranks primary and selected-only models together after flattening them.

Path matching remains structurally specialized through fuzzyMatchPaths; generic text matching has one policy.

No wire, CLI, guide, documentation, or protocol changes.

Query behavior

Query Before After
Model 55 Nemotron alias-only matches from 550b-a55b could outrank visible GPT-5.5 labels All visible GPT-5.5 label matches rank first; Nemotron remains included later through its raw-ID alias
Project aw → atlas-web No match because aw is not contiguous Matches as an ordered subsequence
Branch fth → feature/three No match because fth is not contiguous Matches as an ordered subsequence
Model gpt4 Fuzzy matches stayed in source/bucket order Exact, prefix, and tighter matches rank first across all model buckets
Parent cdxp → Codex Parent Fuzzy matched through cmdk Same query uses the shared text matcher
Parent frontend_parent Matched the thread-ID keyword Same; thread ID is an explicit alias augmenting the visible label
Uppercase text query such as ATLAS fuzzyMatchText used smart-case and rejected lowercase-only text Matches atlas-web case-insensitively
Equal-score results Ordering depended on the picker Use the same deterministic tiebreakers everywhere

How you verified

  • pnpm exec turbo run test --filter=@bb/fuzzy-match --force (26 passed)
  • pnpm exec turbo run test --filter=@bb/app --force (468 files; 3,751 passed, 4 skipped)
  • Focused picker, mention-suggestion, and command-palette suites (10 files; 74 passed)
  • pnpm exec turbo run typecheck --filter=@bb/fuzzy-match --filter=@bb/app --force
  • pnpm exec turbo run lint --filter=@bb/app --force (0 errors; 177 existing warnings)
  • pnpm exec oxfmt --check on changed files
  • Desktop manual QA with Doobie: project query aw, uppercase project query AW, and model query 55; the model results show visible GPT-5.5 matches ahead of alias-only Nemotron matches

Fixes: no linked issue.

AGENT GENERATED

ymichael added a commit that referenced this pull request Sep 2, 2026
## Human comments

## What was wrong

The searchable Project picker used cmdk's moving `aria-selected` state
as its only option-selection signal after #2939. That state identifies
the keyboard-highlighted row, not the persisted project value, so
assistive technology could report Alpha selected while Charlie was the
actual checked project; the trigger also exposed only the generic name
“Project.” Parent Thread had the same current-value ambiguity.

## What changed

- Name the Project trigger with its displayed current value.
- Mark the persisted Project, no-project choice, and Parent Thread value
with `aria-current`.
- Keep cmdk's `aria-selected` behavior for the movable keyboard
highlight.
- Hide decorative check icons from assistive technology.
- Add focused regressions proving current value remains stable while
keyboard highlight moves.

This is semantically separate from #2943's open search-matching change
and composes with it. No daemon wire contract, server API, public Plugin
SDK API, CLI, documentation, or protocol version changed.

## How you verified

- The four focused accessibility assertions failed before the
implementation and passed afterward.
- `pnpm exec turbo run test --filter=@bb/app --force -- --run
src/components/pickers/ProjectSelector.test.tsx
src/components/pickers/ParentThreadPicker.test.tsx` — 11 tests passed.
- Full app suite — 3,744 tests passed and 4 skipped.
- `pnpm exec turbo run typecheck --filter=@bb/app` — passed.
- `pnpm exec oxfmt --check
apps/app/src/components/pickers/ProjectSelector.tsx
apps/app/src/components/pickers/ProjectSelector.test.tsx
apps/app/src/components/pickers/ParentThreadPicker.tsx
apps/app/src/components/pickers/ParentThreadPicker.test.tsx` — passed.
- `git diff --check origin/main...HEAD` — passed.
- Matching desktop and compact QA confirmed the current project remains
visually checked while ArrowDown moves the command highlight.

> AGENT GENERATED
@ymichael
ymichael force-pushed the bb/unify-picker-search-policy branch from ff8aaaa to 1ab71f1 Compare September 2, 2026 18:20
@ymichael
ymichael merged commit 73ce7bc into main Sep 2, 2026
15 checks passed
@ymichael
ymichael deleted the bb/unify-picker-search-policy branch September 2, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant