Commit 8c6b4e6
fix(adapter-github): stable tiebreaker for language-distribution ranking (#23)
computeLanguageDistribution sorted language counts descending then
`.slice(0, 5)`, but ties on count fell back to Map insertion order (the
GitHub repo API response order). With the top-5 cutoff, a tie at the
boundary changed which language landed in the profile — and that result
flows into buildProfileEvidence → scoring, so output could differ across
runs for the same input. Third instance of the #10 / #19 pattern.
Add a final localeCompare tiebreaker before the slice so equal-count
languages sort deterministically.
Test mirrors #19 / H-10: Java and Ruby tie at count 1 straddling the top-5
boundary (Ruby listed first so the unshuffled order wrongly picks it),
shuffled via deterministic LCG across 100 seeds, asserting an identical
top-5 every time. Verified RED before the fix, GREEN after.
Verification: adapter-github 38/38, full suite 794 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 7a87e49 commit 8c6b4e6
2 files changed
Lines changed: 63 additions & 1 deletion
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
452 | 509 | | |
453 | 510 | | |
454 | 511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
0 commit comments