Session 55: Self-learning loop + real-time layer (2274 tests)
Product overhaul core — the two transformative, differentiated systems: Self-learning loop (Phase 2): outcomeService settles locked snapshot grades against real MLB Stats API results → hit/miss/push, rolling accuracy by grade tier (30d window). Idempotent, injectable, unit-tested. New GET /api/accuracy + /api/ledger/accuracy + internal settle triggers + cron hook. AccuracyBadge (dashboard/scan/landing) is honest — "LEARNING" below MIN_SAMPLE, never a fake number. Settled HIT/MISS chips overlay the live slate. Real-time layer (Phase 1): Slate silent 60s auto-refresh (no flash, no wipe on transient blips) + "SIGNAL LIVE · UPDATED Xs ago" freshness strip; Ticker LIVE badge that flashes on fresh events. Landing (Phase 3): TopSignals shows tonight's real top-3 A-rated grades + live accuracy — the product shown, not described. Founder pricing: FOUNDER_CODE_EXPIRY default 2026-06-30 → 2026-12-31 (had lapsed, disabling every founder code + the ClaimMeter pitch). That expiry — not a tier change — was the real cause of the 4 stripe test failures. Backend 2255 (4 failing) → 2274 (all green; +19 new, +4 fixed). Web build exit 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -175,3 +175,34 @@ Slate builds a team→pitcher map (`slateAdapter.buildPitcherMap` /
|
||||
- Player props: PropLine primary (3-key rotation), The-Odds-API backup.
|
||||
- `grades:{sport}` cache (TTL 2h) is written by `gradeSlateService` on a fresh
|
||||
odds fetch; it feeds `/leaders` + the player card's `activeProps`.
|
||||
|
||||
---
|
||||
|
||||
## 7. Accuracy / self-learning loop (`outcomeService`, Session 55)
|
||||
|
||||
The system's track record — settled grades vs real results. Written by
|
||||
`outcomeService.settleAllOutcomes()` (cron, before grading); read-only endpoints.
|
||||
|
||||
### `GET /api/accuracy` (public, cached 5m)
|
||||
```
|
||||
{
|
||||
overall: { // aggregate across sports
|
||||
sport: 'overall', updated_at, window_days: 30, sample,
|
||||
overall: { hits, misses, pushes, total, pct|null }, // pct excludes pushes
|
||||
byGrade: { 'A+':{…}, 'A':{…}, 'B':{…}, 'C':{…}, 'D':{…}, 'F':{…} }
|
||||
} | null,
|
||||
sports: { mlb?: <record>, nba?: <record>, … }, // same shape per sport
|
||||
min_sample: 8, // below this, show "LEARNING" not a %
|
||||
updated_at: string | null
|
||||
}
|
||||
```
|
||||
|
||||
### `GET /api/ledger/accuracy` (public) — the ledger `buckets` shape
|
||||
```
|
||||
{ buckets: [{ grade, hits, total, pct|null }], overall, updated_at }
|
||||
```
|
||||
|
||||
### Settled outcome overlay
|
||||
`GET /api/snapshot/:sport` grades may carry `outcome: { result:'hit'|'miss'|
|
||||
'push', actual:number }` once the game is final. `AccuracyBadge` +
|
||||
`StatStrip.OutcomeChip` render these. Frontend proxy: `web/src/app/api/accuracy`.
|
||||
|
||||
Reference in New Issue
Block a user