Session 48: Name normalization at every layer + usage field (2156 tests)

Trace-first: the normalizer functions were correct (S47) but raw names still
flowed through paths that skipped them. Fixed each leaking path.

- 2a (source chokepoint): snapshotService.runSnapshot normalizes each grade's
  player to the de-dotted display AND dedupes to one grade per nameKey|stat
  (highest confidence) before writing grades:{sport} + snapshot:latest. Every
  consumer (GameCard, Explore, leaders, profile) now gets clean merged names.
- 2b: buildPlayerStripsFromProps dedupes a player's props by stat (graded >
  awaiting) → one row per stat (kills "Ks 5.5 AND Ks 3.5" variant dupes).
- 2c: scan tonightsPlayers grid groups by nameKey, displays normalized name.
- 3: profile VYNDR INTELLIGENCE "+0%"/"—" was buildIntel's defaults (separate
  from the grade card's buildIntelFields, which already works). resolvePlayerStats
  now attaches real usage (AB/G) + rest (B2B/Xd); buildIntel renders them; REST
  default is now "—".

Backend 2149 -> 2156 tests (+7), 181 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-19 02:42:13 -04:00
parent 78db55d499
commit 91b03c4044
10 changed files with 259 additions and 15 deletions
+10
View File
@@ -131,6 +131,16 @@ inline with `GradeBadge`. `onPlayerClick` → `/player/:name?sport=` (`lib/playe
---
## 5a. Normalization is applied at the SNAPSHOT source (Session 48)
`snapshotService.runSnapshot` normalizes every grade's player name (de-dotted
display) and dedupes to ONE grade per `nameKey|stat_type` (highest confidence)
BEFORE writing `grades:{sport}` + `snapshot:{sport}:latest`. Every downstream
consumer (GameCard overlay, `/api/snapshot`, `/leaders`, profile `activeProps`)
therefore receives clean, merged names. New consumers don't need their own
normalization — but UI lists built from RAW odds (e.g. the scan player grid)
must group by `nameKey` + display `normalizeName().display`.
## 5b. Player name normalization (Session 46)
`src/utils/playerName.js` (+ identical `web/src/lib/playerName.js`) is the ONE