Session 59: Addendum + work-order 1.6 + Phase 2 + Phase 3 (2352 tests)

Overnight sprint for the Saturday 10 AM ET deploy gate — day one of the
public ledger record locks against freshly posted lines.

Task A — ledger team/opponent (migration 020, applied at 0 rows):
  populated in both write paths from the real feed; opponent only when the
  player's team matches a game participant (never guessed). Roadmap: Phase
  4.5 WNBA ESPN-boxscore settlement (due ~Jul 24) + Phase 5 per-tier
  calibration logged.

Task B — work-order 1.6 CLOSED (canonical player keys):
  - searchPlayer resolves via nameKey; the old matcher deleted accents
    ("Sanchez" with acute -> "snchez") and substring-guessed onto the WRONG
    player (the mismatched last-10 bug). Ambiguous -> null, never guess.
  - Slate JOIN INVARIANT: a graded prop whose player's real team isn't in
    the game is dropped (TB player can't render under MIL@PIT) — locked by
    tests that fail the suite on regression.
  - grades:{sport} TTL 2h -> 6h (expired between 5h cron gaps — the real
    cause of /team "No active props" for slate players).

Task C — Phase 2 slate UX: tabs are THE filter (URL ?sport=, deep-linkable,
  duplicate legacy tablist removed); cards cap at 6 graded props sorted
  A+->F with ALL N READS in-place expander; waiting states show the real
  next pipeline run ("Grades post ~6:00 PM ET").

Task D — Phase 3 mobile P0: root cause of vanished 390px nav was HIDE_ON
  including '/' (landing had zero navigation) — fixed; html/body overflow-x
  contained; GAME LINES collapses to best-line summary + "N BOOKS" expander
  below 640px; venue drops before time/pitchers ever truncate.

Live verification: raw ESPN today STILL returns the Jun 13 NYK@SA Finals
game without a date pin; the pinned fetch returns 0 games, 0 off-date.

Backend 2327 -> 2352 tests (202 suites), web build exit 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kev
2026-07-10 22:24:47 -04:00
parent c96e74c54b
commit d10bb4cce2
20 changed files with 648 additions and 80 deletions
+70
View File
@@ -95,3 +95,73 @@ describe('legacy GameCard uses BookChip (brand colors)', () => {
expect(src).toContain('book={r.book}');
});
});
// Session 59 (work-order 1.6) — THE JOIN INVARIANT. A prop can only attach
// to a game where the player's team is one of the two participants. The
// audit found Brandon Lowe (TB) rendered under MIL@PIT — a bad feed row the
// overlay happily displayed.
describe('buildPlayerStripsFromProps — game-participant join guard', () => {
const GAME = { home: 'Milwaukee Brewers', away: 'Pittsburgh Pirates' };
it('drops a graded prop whose player team is not in the game (TB ∉ MIL@PIT)', () => {
const props = [{ player: 'Brandon Lowe', stat_type: 'hits', line: 1.5 }];
const gradeIndex = adapter.indexGrades([
{ player: 'Brandon Lowe', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'A',
team: 'Tampa Bay Rays', gradedAt: { line: 1.5, timestamp: '2026-07-10T02:00:00Z' } },
]);
const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {}, Date.now(), GAME);
expect(strips).toEqual([]);
});
it('keeps a prop whose player team IS a participant + stamps the team', () => {
const props = [{ player: 'Willy Adames', stat_type: 'hits', line: 1.5 }];
const gradeIndex = adapter.indexGrades([
{ player: 'Willy Adames', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'B',
team: 'Milwaukee Brewers', gradedAt: { line: 1.5, timestamp: '2026-07-10T02:00:00Z' } },
]);
const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {}, Date.now(), GAME);
expect(strips).toHaveLength(1);
expect(strips[0].team).toBe('Milwaukee Brewers');
});
it('keeps props with no team info (cannot verify ≠ wrong)', () => {
const props = [{ player: 'Mystery Guy', stat_type: 'hits', line: 0.5 }];
const strips = adapter.buildPlayerStripsFromProps(props, {}, {}, Date.now(), GAME);
expect(strips).toHaveLength(1);
expect(strips[0].props[0].awaiting).toBe(true);
});
// The invariant itself, as the suite-failing rule the work order asked for:
it('INVARIANT: every rendered strip with a known team belongs to the game', () => {
const props = [
{ player: 'Willy Adames', stat_type: 'hits', line: 1.5 },
{ player: 'Brandon Lowe', stat_type: 'hits', line: 1.5 },
{ player: 'Unknown Player', stat_type: 'runs', line: 0.5 },
];
const gradeIndex = adapter.indexGrades([
{ player: 'Willy Adames', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'B', team: 'Milwaukee Brewers', gradedAt: { line: 1.5, timestamp: 'x' } },
{ player: 'Brandon Lowe', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'A', team: 'Tampa Bay Rays', gradedAt: { line: 1.5, timestamp: 'x' } },
]);
const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {}, Date.now(), GAME);
const participants = ['milwaukee brewers', 'pittsburgh pirates'];
for (const s of strips) {
if (!s.team) continue;
expect(participants).toContain(String(s.team).toLowerCase());
}
expect(strips.find((s) => String(s.team).toLowerCase() === 'tampa bay rays')).toBeUndefined();
});
});
// Sánchez/Sanchez single-key regression (work-order 1.6 #4).
describe('diacritic variants resolve to ONE key across the slate', () => {
it('an accented prop matches an unaccented snapshot grade (one strip, graded)', () => {
const props = [{ player: 'Cristopher Sánchez', stat_type: 'strikeouts', line: 5.5 }];
const gradeIndex = adapter.indexGrades([
{ player: 'Cristopher Sanchez', stat_type: 'strikeouts', line: 5.5, direction: 'over', grade: 'A',
gradedAt: { line: 5.5, timestamp: 'x' } },
]);
const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {});
expect(strips).toHaveLength(1);
expect(strips[0].props[0].grade).toBe('A');
});
});