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:
@@ -125,3 +125,54 @@ describe('mlbStatsAdapter — batter vs pitcher', () => {
|
||||
expect(mockAxiosGet).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
// Session 59 (work-order 1.6) — canonical player resolution. The old matcher
|
||||
// deleted accented letters ("Sánchez" → "snchez") and substring-guessed on a
|
||||
// miss, which could return ANOTHER player's id (→ wrong last-10 log).
|
||||
describe('searchPlayer — canonical nameKey resolution', () => {
|
||||
const PLAYERS = {
|
||||
data: {
|
||||
people: [
|
||||
{ id: 100, fullName: 'Cristopher Sanchez', currentTeam: { name: 'Philadelphia Phillies', id: 1 }, primaryPosition: { abbreviation: 'P' } },
|
||||
{ id: 200, fullName: 'Brandon Lowe', currentTeam: { name: 'Tampa Bay Rays', id: 2 }, primaryPosition: { abbreviation: '2B' } },
|
||||
{ id: 201, fullName: 'Nathaniel Lowe', currentTeam: { name: 'Texas Rangers', id: 3 }, primaryPosition: { abbreviation: '1B' } },
|
||||
{ id: 202, fullName: 'Josh Lowe', currentTeam: { name: 'Tampa Bay Rays', id: 2 }, primaryPosition: { abbreviation: 'OF' } },
|
||||
{ id: 300, fullName: 'Matthew Boyd', currentTeam: { name: 'Chicago Cubs', id: 4 }, primaryPosition: { abbreviation: 'P' } },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
test('accented query resolves to the unaccented MLB record (Sánchez ≡ Sanchez)', async () => {
|
||||
mockAxiosGet.mockResolvedValue(PLAYERS);
|
||||
const hit = await adapter.searchPlayer('Cristopher Sánchez');
|
||||
expect(hit).toBeTruthy();
|
||||
expect(hit.id).toBe(100);
|
||||
});
|
||||
|
||||
test('never returns another player on a shared last name (Brandon ≠ Nathaniel Lowe)', async () => {
|
||||
mockAxiosGet.mockResolvedValue(PLAYERS);
|
||||
const hit = await adapter.searchPlayer('Brandon Lowe');
|
||||
expect(hit.id).toBe(200);
|
||||
expect(hit.team).toBe('Tampa Bay Rays');
|
||||
});
|
||||
|
||||
test('nickname resolves via nameKey (Matt Boyd → Matthew Boyd)', async () => {
|
||||
mockAxiosGet.mockResolvedValue(PLAYERS);
|
||||
const hit = await adapter.searchPlayer('Matt Boyd');
|
||||
expect(hit && hit.id).toBe(300);
|
||||
});
|
||||
|
||||
test('ambiguous fallback returns null — a missing profile beats a wrong one', async () => {
|
||||
mockAxiosGet.mockResolvedValue({
|
||||
data: {
|
||||
people: [
|
||||
{ id: 400, fullName: 'Jose Ramirez', currentTeam: { name: 'A' }, primaryPosition: { abbreviation: '3B' } },
|
||||
{ id: 401, fullName: 'Jorge Ramirez', currentTeam: { name: 'B' }, primaryPosition: { abbreviation: 'P' } },
|
||||
],
|
||||
},
|
||||
});
|
||||
// "J. Ramirez" collapses to first-initial J — TWO candidates → null.
|
||||
const hit = await adapter.searchPlayer('Jhon Ramirez');
|
||||
expect(hit).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user