Revive the dead probability layer + restore grade range ON MERIT

Folds re-sequenced steps 1+2 into one change (Kev's call): same bug
family — features wired to sources that return null.

THE PROBABILITY LAYER WAS DEAD IN PRODUCTION. p_win/ev_pct/kelly/
model_odds/value were absent on 0/8 live grades because
gameLogService.getGameLogs returns null for MLB by construction and
depends on the offline Python service for NBA/WNBA, so meta.gameLogs was
[] for every sport. This was the S46 bug in a second location — that fix
gave featureCache an MLB branch (why grades still worked) but never the
estimator. featureCache.getStatRows now supplies normalized rows
([{date,[statType]:v}], most-recent-first) for every sport, feeding the
estimator AND consistency AND game_count_in_7d from one fetch.
VERIFIED on real props: p_win 25/25 WNBA, 8/8 MLB (was 0).

GRADE RANGE, ON MERIT — never by rescaling (permanent founder ruling:
minting A's without new information is a relabelled B sold as an A and
corrupts an append-only ledger).
- refreshTeamStats wired into runSnapshot — it had ZERO production
  callers, so opp_rank_stat was permanently null and a +/-1.0 factor
  could never fire. Test-env no-op (opsNotify precedent).
- L20 made SYMMETRIC: both branches were delta +1.0, so the season
  baseline could only ever ADD. No negative path was a structural reason
  D was unreachable. New l20_contradicts_* carries -1.0.
- game_count_in_7d derived from real logged dates (heavy_workload_7d).
- NOT wired, deliberately, with reasons inline: teamId (no team_id
  column; getFeatures reads it top-level; factor also needs a starter-id
  list) and season_type (ESPN 2 = REGULAR season; threading it raw would
  fire veteran_in_playoffs in July). Dead code dressed as a fix is the
  thing we are removing, not adding.

CALIBRATION GUARD (found by verifying, not assuming): consistency CV is
NBA-tuned; for a Poisson-ish stat cv ~ 1/sqrt(mean), so any stat with
mean < 4 auto-classifies boom_bust. First verification run showed 8/8 MLB
props boom_bust — a blanket -1.0 that dropped the board to all-C. Floored
at CONSISTENCY_MIN_MEAN=4 -> 'unknown' below. Absent beats wrong. MLB
low-count stats therefore still get no consistency factor: honest, not
fixed. Scale-free index-of-dispersion classifier is the open follow-up.

CONFIDENCE IS NOT A PROBABILITY: payloads carry confidence_basis:
'grade_band'. Corrected mlb-grade-degradation.md — its "25/25
grade<->confidence agreement" is a TAUTOLOGY (confidence is derived FROM
the letter, so it would report 25/25 even if every grade were wrong), not
a validation. Removed dead mlbGrader.js (referenced only by its own test)
and the stale computeFeatures comment claiming a penalty that never ran.

VERIFICATION (scripts/verify-grade-range.js, real props/logs/engine):
WNBA 25 props B 68%->32%, C 32%->64%, D 0->1 (4%); 11-step spread went
from 2 steps to 5 (C/C+/B-/D). The D is earned: Angel Reese assists o2.5,
p_win 0.365. Nothing flooded — grades got HARDER. A did not emit locally
because opp_rank_stat needs the Redis cache only prod populates (local
ceiling +3.0 vs the +4.5 A needs); reachability is proven arithmetically
and locked in tests. Prod A-emission is the outstanding fingerprint.

MARKETING HOLD: "A-RATED" (AccuracyBadge, TopSignals) is unsupported
until that fingerprint. Confirmed honest fallbacks render today —
/api/ledger/accuracy has B and C buckets only, so the badge shows
"MODEL · 63% HIT" and TopSignals self-hides. Nothing fabricated ships.

Suite 276/3286 green, web build exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SmNjJAwEnqHPtXbvSZR8kA
This commit is contained in:
Kev
2026-07-19 18:54:51 -04:00
parent 416639efe4
commit 1a94ef5fcf
16 changed files with 652 additions and 346 deletions
+49
View File
@@ -1001,6 +1001,55 @@ phased plan in the Session-57 conversation / BUILD-STATE Next section).
"TRACKING — READ LOCKED PRE-GAME" renders once per live card (GameCard,
dim — it's meta, not a caution signal).
## Probability Layer + Grade Range (Session 63 — non-obvious)
- **`gameLogService.getGameLogs` is a TRAP: it returns null for MLB by
construction** (`pythonPath` `default: return null`) and depends on the Python
service, which is OFFLINE in prod. Anything wired to it is dead. S46 fixed this
for FEATURES (`featureCache.gameLogFeatures` MLB branch) but NOT for the
estimator — so `meta.gameLogs` was `[]` for every sport and `p_win`, `ev_pct`,
`kelly`, `model_odds`, `value` were absent on 100% of live grades for months.
**`featureCache.getStatRows(player, sport, statType)` is now the one true source
of normalized per-game rows** (`[{date, [statType]: v}]`, MOST-RECENT-FIRST —
the estimator treats `slice(0,5)` as the recency window). Use it; never add a
new caller of `gameLogService` directly.
- **Hero v2 requires a finite `ev_pct`** — when EV was dead it matched nothing and
fell through to the recent-read fallback silently (`is_recent:true` was the
tell). A "working" endpoint returning data is not proof the intended rule ran.
- **`confidence` is NOT a probability.** engine1 picks a letter from an additive
factor index, then reads that letter's band MIDPOINT out of
`grade_thresholds.json` to make the number — so it carries zero information
beyond the letter and can never disagree with it. Payloads carry
`confidence_basis: 'grade_band'`. The real signal is `p_win`. Corollary:
mlb-grade-degradation.md's "25/25 grade<->confidence agreement" is a TAUTOLOGY,
not a validation (corrected in that file) — never cite it as grade quality.
- **`grade_thresholds.json` is NOT an input mapper in the JS path** — only the
Python side compares scores to it. In JS it is a confidence lookup table read
BACKWARDS from the already-chosen letter.
- **The grade is an integer index** (`GRADE_SCALE`, `NEUTRAL_INDEX` 3) moved by
flat +/-1.0 and +/-0.5 deltas. A needs sum >= +4.5, D needs <= -1.51. Six
factors were wired to features nothing populated, pinning the live range to
{C,B} — only TWO letters ever emitted across 604 ledger rows.
**`refreshTeamStats` had ZERO production callers**, so `opp_rank_stat` (a +/-1.0)
was permanently null; it is now called in `runSnapshot` (test-env no-op, the
opsNotify precedent). L20 was asymmetric (both branches +1.0 = no downside path)
and is now symmetric.
- **Consistency CV is scale-dependent — this is a live landmine.** The thresholds
are NBA-tuned (points ~20/gm). For a Poisson-ish stat `cv ~ 1/sqrt(mean)`, so
ANY stat with mean < 4 auto-classifies `boom_bust` (real: Alonso hits mean 0.60
-> cv 1.17). Reviving consistency without a guard stamps a blanket -1.0 on
nearly every MLB prop. Floored at `CONSISTENCY_MIN_MEAN` (4) -> `unknown` below.
The scale-free fix is an index-of-dispersion classifier (open item).
- **NEVER rescale thresholds to make A's appear** (founder ruling, permanent).
Minting A's without new information is a relabelled B sold as an A and it
corrupts an append-only ledger. Fix the grade on MERIT or don't claim the scale.
- **A-RATED copy is on hold** until a prod fingerprint shows real A grades.
`/api/ledger/accuracy` currently returns B and C buckets only, so AccuracyBadge
correctly falls through to "MODEL · X% HIT" and TopSignals self-hides.
- `scripts/verify-grade-range.js` replays live-board props through the real engine
on free feeds. It UNDERSTATES range locally (no Redis -> no `opp_rank_stat`).
Redis runs degraded locally, so the script must `process.exit(0)` — otherwise a
reconnect timer holds the process open and piped output is lost to SIGTERM.
## Active Skills
- vyndr-voice (all user-facing output)
- prop-analysis (grading methodology)