[CmdPal] Replace main-page magic-number scoring with a principled tiered ranker#49189
Draft
michaeljolley wants to merge 1 commit into
Draft
[CmdPal] Replace main-page magic-number scoring with a principled tiered ranker#49189michaeljolley wants to merge 1 commit into
michaeljolley wants to merge 1 commit into
Conversation
Rework the main/root page relevance scoring into a principled, testable multi-signal ranker. Ordering is now decided by a hard tier ladder (alias-exact > exact-title > prefix > acronym/word-boundary > fuzzy > fallback floor); frecency and other within-tier signals only reorder items that already share a tier, so an obvious match can no longer be buried under junk. - Add MainListRanker: RankTier ladder, tier classifier, normalized within-tier score, and a packed sortable int so the existing score-descending sort is unchanged. - Add IRankSignal / IRerankStage seam interfaces so a future on-device semantic or small-LLM reranker can slot in later. No model ships today. - Replace the hand-tuned constants in ScoreTopLevelItem with tier classification plus the within-tier score. Within-tier math mirrors the old balance so shared-tier ordering is preserved; only cross-tier behavior changes. - Update ranking tests to assert the new tier invariant: heavy usage reorders within a tier but never crosses a tier boundary. Host-side only; the extension SDK toolkit and extension-owned pages are untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Summary
Users report Command Palette main/root page results are wrongly ranked: the thing they want exists but is buried below junk. Today's ordering is a flat weighted sum of hand-tuned magic numbers in
MainListPage.ScoreTopLevelItem(alias+9001, matchx10, subtitle-4/2, extension/1.5, fallbackx0.5) plus an additive frecency weight, which makes obvious matches lose to noise and is effectively untestable.This PR re-architects the main-page scoring into a principled, testable, multi-signal ranker. It is the first atomic step of a larger search-quality effort (see follow-ups below).
What changed
MainListRanker(Microsoft.CmdPal.UI.ViewModels/Commands/MainListRanker.cs):alias-exact > exact-title > prefix > acronym/word-boundary > fuzzy > fallback floor.int, so the existing score-descending sort (InternalListHelpers.FilterListWithScores) is unchanged.IRankSignal/IRerankStageseam interfaces so a future on-device semantic or small-LLM reranker can slot in later as a post-first-paint pass. No model ships here.ScoreTopLevelItemrefactor: the magic-number tail is replaced by tier classification + the within-tier score. The within-tier math deliberately mirrors the old balance, so items that share a tier keep their long-standing relative order; only cross-tier behavior changes.Scope / safety
ListHelpers/FuzzyStringMatcher) and extension-owned list pages are untouched, keeping this atomic and free of ABI/extension-compat risk.Validation
CommandPalette.slnf(x64 / Debug): exit 0.Microsoft.CmdPal.UI.ViewModels.UnitTestspass.Follow-ups (separate PRs)
These were intentionally deferred to keep this PR atomic and to give privacy/schema-sensitive work its own review:
log(uses)), larger store, migration of persisted history; feeds the within-tier signal.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com