[CmdPal] Golden-set relevance test harness for main-page ranking#49195
Draft
michaeljolley wants to merge 1 commit into
Draft
[CmdPal] Golden-set relevance test harness for main-page ranking#49195michaeljolley wants to merge 1 commit into
michaeljolley wants to merge 1 commit into
Conversation
Add RelevanceHarnessTests: a golden-set MSTest harness that drives the real MainListPage.ScoreTopLevelItem scoring path over a representative fixture of apps and top-level commands, sorts exactly as the product does (positive scores, descending), and asserts query -> expected ordering. Covers the tier ladder end to end (exact > prefix > acronym/word-boundary > fuzzy), frecency reordering within a tier only, per-provider Higher nudge breaking near-ties without crossing tiers, and realistic complaint cases (typing c, code, set surfaces the right thing at rank 1). Also add focused per-tier MainListRanker unit tests: ClassifyTier boundaries (including alias-exact and fallback-floor), Pack monotonicity (a higher tier always outranks a lower one regardless of within-tier score), within-tier clamping and ordering, TierOf round-trip, and ProviderBonus sign. Test-only change; no product behavior modified. 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.
Phase 5 of the CmdPal search overhaul (stacked)
Stacked PR. Base is
dev/mjolley/dev-mjolley-fast-first-paint(phase 4), notmain. Keep as a draft; the human marks it ready.What this adds
A golden-set relevance test harness that locks in main/root-page ranking quality and guards against regressions. It is the objective yardstick for "results seem logical and relevant." Test-only: no product code changed.
New file:
Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/RelevanceHarnessTests.cs.Golden set (11 cases) - each drives the REAL
MainListPage.ScoreTopLevelItemover a representative fixture of apps + top-level commands, sorts exactly the way the product does (positive scores, descending, mirroringInternalListHelpers.FilterListWithScores/ the existingRecentCommandsTests.GetMatches), and asserts ordering via readableAssertRank1(query, expected)/AssertRanksAbove(query, higher, lower)helpers. Easy to extend: add a fixture item and another constraint.paint,co,man).vsc-> Visual Studio Code).co).vs-> the used Visual Studio wins).c(frecent Calculator at rank 1),code,set.Per-tier ranker unit tests (16) for
MainListRanker- the pieces the golden set cannot easily drive through mocks:ClassifyTierboundaries incl. alias-exact (beats fallback) and fallback-floor.Packmonotonicity: a higher tier with the worst within-tier score still outranks a lower tier with the best within-tier score.TierOfround-trip.WithinTierScoreordering (lexical leads, frecency breaks ties) andProviderBonussign (Lower < Normal < Higher).Determinism
Frecency cases inject uses through the phase-2
WithHistoryItemseam; no reliance on real extensions, registry, wall-clock, or machine state.Test results (x64 host on this ARM64 box)
Microsoft.CmdPal.UI.ViewModels.UnitTests: 190/190 pass (27 new here: 11 golden + 16 per-tier).*.UnitTests: green (Common 225, Apps 28, Bookmarks 222, Indexer 35, Registry 66, RemoteDesktop 26, Shell 124/+1 skip, System 21, TimeDate 301, WebSearch 10, Toolkit 645/+1 skip).WindowWalker: "Zero tests ran" - known pre-existing, ignored per plan.Findings for human review
None. Every golden case matched the current ranker's behavior on the first run - no ranking bug surfaced, so nothing was changed and no case had to encode a known-bad ordering. If a future fixture reveals a genuine defect, prefer documenting it and asserting current behavior over silently changing ranking.
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com