fix: dedupe merged code-search stats across mirror cells

main

Commit

Soph2mo ago

Fanning out code search across mirror placements makes a mirrored repo return the same matches from its home and mirror cells. mergeSearchResults already deduped the result list but summed the stats, so a repo with 3 matches searched in two cells reported "6 matches across 4 files in 2 repos" for 3 unique results, and falsely claimed truncation ("Showing 3 of 6 matches").

Dedupe RepoStats by repo name (keep the representative max, not the sum) and subtract the duplicated portion from TotalMatches / TotalFiles / ReposSearched. The base stays peregrine's own per-cell totals, so per-cell truncation and zero-match repos are preserved; only the provable mirror duplicate is removed.

Addresses trail #794 finding 019f40a4-d27.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 01KX0F53C6MZJYAD1ZEBF43G7S

Checkpoints

Fix Fan-Out Code Search Across Mirror Placements

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1