Skip to content

fix: preserve source order on equal-score ties - #4

Open
ernestjsf wants to merge 1 commit into
thanhdat77:mainfrom
ernestjsf:fix/tie-break-preserves-source-order
Open

fix: preserve source order on equal-score ties#4
ernestjsf wants to merge 1 commit into
thanhdat77:mainfrom
ernestjsf:fix/tie-break-preserves-source-order

Conversation

@ernestjsf

@ernestjsf ernestjsf commented Jul 21, 2026

Copy link
Copy Markdown

Summary

Equal-score results are tie-broken alphabetically by title, which throws away the collectors' meaningful order — zoxide query -l is 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 on main.

Note: two pre-existing cargo test failures on macOS (unrelated — fixtures use literal /tmp, which Entry::key() canonicalizes to /private/tmp); happy to file a follow-up.

Checks

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test (except the pre-existing macOS failures above)
  • cargo build --release

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
ernestjsf force-pushed the fix/tie-break-preserves-source-order branch from dc012b4 to 6ab1b89 Compare July 21, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant