Session 54: Audit cleanup — name edges + polish (2255 tests)

P1 name edge cases (BOTH playerName.js copies, kept identical):
- normalizeName strips hyphens (display+key): "Jung-hoo Lee" === "Jung Hoo Lee".
- nameKey strips single-letter MIDDLE tokens: "Josh H Smith" === "Josh Smith"
  (keeps first+last; real middle names + collapsed initials untouched).
- richie -> richard added to NICKNAMES.

P2 polish:
- Team Hub names normalized at the source (teamService.getTeamHub) so
  "J.C. Escarra" renders as "JC Escarra" like the dashboard.
- snapshotService dedup keeps the highest-confidence GRADE but the richest
  DISPLAY (accented "José" over "Jose") so prop rows match the pitcher line.
- correlationWarning names the game: "2 legs from the same game (NYY @ BOS)".

Backend 2246 -> 2255 tests (+9), 194 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 15:45:07 -04:00
parent b012da13f8
commit 8629021774
11 changed files with 137 additions and 12 deletions
+13
View File
@@ -533,6 +533,19 @@ snapshot, locked to the line, and read from cache.
- **Name micro-fix:** `playerName.js` `collapseInitials` merges "J C" → "JC"
(display + key) so space-separated initials dedupe.
## Name Edge Cases + Audit Polish (Session 54 — non-obvious)
- `normalizeName` now also **strips hyphens** to spaces ("Jung-hoo" → "Jung hoo")
in display+key; `nameKey` **strips single-letter MIDDLE tokens** ("Josh H Smith"
→ "josh smith") — keeps first (may be a collapsed initial like "jc") + last, so
real middle names ("Juan Carlos Smith") and first initials are NOT dropped.
`richie: 'richard'` added to NICKNAMES. Both copies kept identical.
- **Accent-keep dedup** (`snapshotService`): the variant-grade collapse keeps the
highest-CONFIDENCE grade but the richest DISPLAY (prefers accented "José" over
"Jose", then longer). That's why prop rows now match the accented pitcher line.
`hasAccent` uses a charCode>127 check (NOT a regex with literal control bytes).
- **Team Hub names** are normalized in `teamService.getTeamHub` (the source), not
the page — every `/api/team/:abbr` consumer gets `normalizeName().display`.
## Parlay Lab (Session 50 — non-obvious)
- **Correlation model** lives in `src/services/parlayService.js` (ADDED to the
S28 categorical matrix — both coexist). `correlationScore(l1,l2)` is numeric +