fix(bench): anchor pathsMatch to path segments - #965
Open
costajohnt wants to merge 1 commit into
Open
costajohnt wants to merge 1 commit into
costajohnt wants to merge 1 commit into
Conversation
pathsMatch treated either normalized path as a bare suffix of the other, so a fixture naming `Standards.md` scored `Vault Note Standards.md` as a hit and `README.md` matched `docs/api/README.md`. Match exactly, or accept the expected path only as a whole-segment suffix of the result (`/name`), mirroring the multi-get resolver from tobi#868. Expected paths longer than the result no longer match; fixtures use collection-relative paths as `qmd ls` prints them.
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.
Fixes #943
pathsMatchinsrc/bench/score.tsaccepted a match when either normalized path was a plain string suffix of the other. Two false positives follow from that: a bareStandards.mdinexpected_filescreditsMemory/Procedural/Vault Note Standards.md, and an expecteddocs/api/README.mdcredits a result of justREADME.md. Every bench metric (hitsWithin,matched_files,mrr) goes through this function, so both inflate scores.The README documents
expected_filesas collection-relative paths as shown byqmd ls, so equality is the contract. This keeps exact match after normalization and one lenient form: the expected path as a whole-segment suffix of the result (nr.endsWith("/" + ne)), which still lets a fixture namedocs/readme.mdagainst a result under a longer prefix. The reverse direction (expected longer than result) and mid-filename suffixes no longer match.This is a deliberate behaviour change: the "suffix match (expected is longer)" case in
test/bench-score.test.tsasserted the old behaviour and now assertsfalse; the result-is-longer case is kept in its anchored form; two cases cover the issue's examples. OnescoreResultsfixture relied on the loose match (qmd://concepts/a.mdvsconcepts/a.md) and now uses a real collection prefix.Tested with
bun test test/bench-score.test.ts(19 pass) andbun run lint. CHANGELOG entry under Unreleased.