Session 46: Grade card intel + name normalization + pitchers (2122 tests)

Three focused P1 fixes on the Session-45 snapshot model.

- Grade card intel ROOT CAUSE: gameLogService is NBA/WNBA-only (offline Python),
  so MLB props never got l5_avg/l20_avg and buildIntelFields returned {}. Wired
  MLB game logs into featureCache.gameLogFeatures via mlbStatsAdapter.getPlayerStats
  (pure mlbGameLogFeatures + MLB stat_type->field map). buildIntelFields gained
  playerStats/projection fallbacks for partial intel.
- Player name normalization: src/utils/playerName.js (+ web/src/lib copy):
  normalizeName -> {display,key}. Strips periods, de-dots suffix, accent-folds
  the key. Applied in snapshotService grouping, slateAdapter grade index +
  player-strip merge (variants collapse, longest name shown), and
  playerIntelService. "A.J. Ewing"/"AJ Ewing" + "Jazz Chisholm"/"Jr." now merge.
- MLB starting pitchers: new GET /api/schedule/:sport/pitchers (probablePitchers
  service wrapping mlbStatsAdapter.getScheduleWithPitchers + best-effort ERA).
  Slate fetches it, builds a team->pitcher map (full name + mascot match),
  attaches pitchers to MLB GameCardData. + Next proxy.

Backend 2100 -> 2122 tests (+22), 176 suites. Web build clean (exit 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-18 23:56:26 -04:00
parent f8b120c0aa
commit c8fc9f577e
20 changed files with 608 additions and 32 deletions
+39 -3
View File
@@ -4,9 +4,45 @@
2026-06-18
## Current Phase
SHIP BUILD v45.0 — Snapshot pipeline + GameCard swap + live ticker. The product
shifted: on-demand "Read" grading is RETIRED; a scheduled pipeline pre-grades the
slate, locks grades to the line, and the dashboard shows them already there.
SHIP BUILD v46.0 — Grade-card intel (MLB game logs) + player-name normalization
+ MLB starting pitchers. Three focused P1 fixes on the Session-45 snapshot model.
## Session 46 (2026-06-18) — SHIPPED ✅ P1 FIXES
Backend 2100 → **2122 tests** (+22), 176 suites. Web build clean (exit 0).
### Phase 1 — grade card intel (ROOT CAUSE)
The STAT CONTEXT + VYNDR INTELLIGENCE sections were empty for MLB because
`gameLogService.getGameLogs` is NBA/WNBA-only (offline Python service) — MLB
props NEVER got `l5_avg`/`l20_avg`, so `buildIntelFields` always returned `{}`.
FIX: `featureCache.gameLogFeatures` now has an MLB branch that derives
l5/l10/l20 averages from `mlbStatsAdapter.getPlayerStats` (free statsapi.mlb.com)
via the pure `mlbGameLogFeatures` + an MLB stat_type→game-log-field map.
`buildIntelFields(features, opts)` also gained `playerStats`/`projection`
fallbacks so partial intel renders (Sessions 43/44 had the wiring; the engine
just never produced the values for MLB).
### Phase 2 — player name normalization
`src/utils/playerName.js` + `web/src/lib/playerName.js` (identical; cross-checked
by a test): `normalizeName(raw)``{ display, key }`. Strips periods, de-dots
suffixes, accent-folds the key. Applied in `snapshotService` (grouping/deltas),
`slateAdapter` (grade index + `buildPlayerStripsFromProps` merges variants,
displays the longest), and `playerIntelService.sanitizePlayerName`/`normName`.
"A.J. Ewing"/"AJ Ewing" and "Jazz Chisholm"/"Jazz Chisholm Jr." now merge.
### Phase 3 — MLB starting pitchers
The ESPN schedule lacks probable pitchers. NEW `GET /api/schedule/:sport/pitchers`
(MLB) → `probablePitchers` service wrapping `mlbStatsAdapter.getScheduleWithPitchers`
+ best-effort season ERA. The Slate fetches it, builds a team→pitcher map
(`slateAdapter.buildPitcherMap`/`pitchersForGameTeams`, matched by full name +
mascot), and attaches `pitchers` to MLB GameCardData. + Next proxy.
### Phase 4 — verify
`computeLineDeltas` confirmed structurally sound (S45 tests); `deltas: 0` in the
audit was just the first snapshot (no previous to diff). BACKEND_HANDOFF.md
updated.
## Session 45 (2026-06-18) — SHIPPED ✅ SNAPSHOT PIPELINE
## Session 45 (2026-06-18) — SHIPPED ✅ SNAPSHOT PIPELINE