P0-3b/c: consensus grouped by player + ledger cards nest alt lines as a ladder

Completes P0-3 across all three surfaces:
- CONSENSUS VS MODEL (MarketBreadth): dedupe by player+market so Ben Williamson's
  alt-line variants show as ONE consensus row (no per-market cap — a consensus
  table just shouldn't repeat a player).
- LEDGER cards: group by player+market via groupIntoLadders — Alec Bohm's
  strikeout ladder (U1.6/U1.3/O1.5) is now ONE card with the rungs nested (each
  its own side/line + tier-colored grade), not three separate cards.
- playerGrouping reads player OR player_name (ledger rows use player_name) —
  regression-tested so the ledger doesn't silently empty.

The Alt Line Ladder shape is what /pricing already demos; the record now uses it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-07-17 01:07:28 -04:00
parent 55f5cdc57d
commit db61876b2f
4 changed files with 49 additions and 12 deletions
+9
View File
@@ -35,6 +35,15 @@ describe('dedupeLeaders', () => {
expect(out).toHaveLength(1);
});
test('reads player_name too (ledger rows) — not just player', () => {
const out = dedupeLeaders([
{ player_name: 'Alec Bohm', stat: 'strikeouts', line: 1.6 },
{ player_name: 'Alec Bohm', stat: 'strikeouts', line: 1.3 },
]);
expect(out).toHaveLength(1);
});
test('empty / malformed → empty, no throw', () => {
expect(dedupeLeaders(null)).toEqual([]);
expect(dedupeLeaders([{}])).toEqual([]);