fix: preserve source order on equal-score ties - #4
Open
ernestjsf wants to merge 1 commit into
Open
Conversation
Tie-break by insertion index for every result, not just agent view. Collectors already emit meaningful order (zoxide frecency, agent pane order, workspace order); sorting equal-score ties alphabetically by title discarded it.
ernestjsf
force-pushed
the
fix/tie-break-preserves-source-order
branch
from
July 21, 2026 23:39
dc012b4 to
6ab1b89
Compare
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
Equal-score results are tie-broken alphabetically by title, which throws away the collectors' meaningful order —
zoxide query -lis frecency-ordered, agents arrive in pane order. Example: querying a project name over several sibling paths under the same directory gives them all the same score, and the most-visited root dir ends up buried below its subdirectories.This makes the tie-break preserve insertion order (
idx.cmp), as the agent view already did — the special case collapses into the general one. Includes a regression test that fails onmain.Note: two pre-existing
cargo testfailures on macOS (unrelated — fixtures use literal/tmp, whichEntry::key()canonicalizes to/private/tmp); happy to file a follow-up.Checks
cargo fmt --checkcargo clippy -- -D warningscargo test(except the pre-existing macOS failures above)cargo build --release