Skip to content

refactor(spotlight): reuse fuzzy search utilities - #778

Closed
beruro wants to merge 1 commit into
developfrom
junyu/unify-fuzzy-search-ui
Closed

refactor(spotlight): reuse fuzzy search utilities#778
beruro wants to merge 1 commit into
developfrom
junyu/unify-fuzzy-search-ui

Conversation

@beruro

@beruro beruro commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

Editor symbol search carried private copies of the same fuzzy-match and relevance-score algorithms already owned by src/util/search/fuzzy.ts. Any scoring change could make symbol results rank differently from other Spotlight and autocomplete surfaces.

Solution

Delete the private copies and import the canonical fuzzyMatch and fuzzyScore utilities. The implementations were identical, so filtering, exact/prefix/substring priority, boundary bonuses, and sort order remain unchanged while the algorithm has one owner and one test suite.

Potential risks

The only risk is an accidental dependency or import-resolution change in the Editor Palette bundle. The shared utility is already used by Chat input surfaces, has no runtime dependencies, and its focused tests plus full typecheck pass. No state, async request, cache, or rendered UI contract changed. Rollback is a single-commit revert.

Architecture

  • Covered algorithm ownership, dependency direction, scoring semantics, search consumer parity, and tests.
  • Intentionally skipped UI consistency audit because no TSX/component structure or styling changed. Wire, persistence, FSM, initialization, and background lifecycle layers are also unchanged.
  • Effects: none added or modified.
  • Performance verdict: neutral; the same functions execute at the same filter/sort call sites with no new allocation, cache, or request.

Verification

  • pnpm exec vitest run src/util/search/__tests__/fuzzy.test.ts — 14 passed.
  • pnpm exec eslint src/scaffold/GlobalSpotlight/palettes/EditorPalette/hooks/useSymbolMode.ts — passed.
  • pnpm typecheck — full TypeScript check executed and passed.
  • git diff --check — passed.
  • The repository snapshot does not provide verify:quick or verify:final, so the focused algorithm suite/lint and full typecheck entry point were used.
  • No visual evidence: rendered behavior is unchanged.

@beruro

beruro commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #780, which preserves this change as an independent commit and has passed the consolidated CI suite. The source branch is retained for recovery.

@beruro beruro closed this Aug 11, 2026
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