Commit 7a87e49
fix(adapter-github): stable tiebreaker for commit-email canonical ranking (#19)
extractEmailsFromCommits sorted by (personal-vs-work, frequency desc) but
ties fell back to Map insertion order, which mirrors the GitHub commits API
response order. Since the first email becomes the canonical email used in
identity resolution, a tie could flip canonicalId across runs — the same
class of bug as #10 (selectTopRepos), one layer downstream.
Add a final localeCompare tiebreaker so equal-class, equal-frequency emails
sort deterministically by string.
The test mirrors the H-10 pattern: two equal-frequency personal emails,
shuffled via a deterministic LCG across 100 seeds, asserting the top-1
canonical email is identical every time. Verified RED (returned
insertion-order 'zoe@gmail.com') before the fix, GREEN after.
Verification: adapter-github 37/37, full suite 793 passing / 1 skipped,
lint 14/14, typecheck 27/27, build 14/14.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 078ab51 commit 7a87e49
2 files changed
Lines changed: 50 additions & 1 deletion
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
406 | 452 | | |
407 | 453 | | |
408 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
0 commit comments