🤖 fix: rank slash suggestions by match quality (exact > prefix > segment) - #3920
🤖 fix: rank slash suggestions by match quality (exact > prefix > segment)#3920asm wants to merge 1 commit into
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Typing "/lint" with skills named lint, lint-fix, and auto-lint listed auto-lint first: the segment-prefix matcher legitimately matches all three, but suggestions kept discovery (alphabetical) order with no ranking. Matches now sort by tier — exact name, then whole-name prefix, then segment prefix — with the stable sort preserving discovery order within a tier and a bare "/" listing everything unchanged. Applies to slash commands, skills, plugin commands, MCP prompts, model aliases, subcommands, and inline $skill references via one shared helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c27434b to
7f2cab9
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
With skills named
lint,lint-fix, andauto-lint, typing/lintin the composer suggestedauto-lintabove the exact-matchlint. The segment-prefix matcher legitimately matches all three ("lint".startsWith("lint")onauto-lint's second segment — that's the feature that lets/procfinddata-processing-style names), but the suggestion builders were pure.filter()passes with no ranking, so results kept discovery order — which is alphabetical, anda<l.Suggestions now rank by match quality: exact name → whole-name prefix → segment prefix, with a stable sort so items within a tier keep their original order and a bare
/still lists everything unchanged./lintnow suggestslint, thenlint-fix, thenauto-lint.Implementation
suggestionMatching.tsgainsrankNameMatch(the tiers,nullfor no match) andfilterAndRankByNameMatch(filter + stable rank sort in one place).matchesNameBySegmentPrefixis reimplemented on top ofrankNameMatchso the boolean and ranking views cannot drift.$skillreferences (inlineSkillSuggestions.ts). The ghost hint improves automatically since it derives from the first suggestion.Validation
rankNameMatch; stable within-tier ordering forfilterAndRankByNameMatch; end-to-endgetSlashCommandSuggestions("/lint")ordering (lint→lint-fix→auto-lint) plus a bare-/discovery-order regression guard.bun test src/browser/utils(1413 tests across 87 files) green; typecheck, eslint, prettier clean.🤖 Generated with Claude Code