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:
@@ -0,0 +1,24 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
|
||||
|
||||
/**
|
||||
* Accuracy proxy (Session 55) — forwards GET /api/accuracy to Express (the
|
||||
* self-learning loop's rolling track record). Thin pass-through; the dashboard
|
||||
* header + grade card read this. Empty-safe on any upstream failure.
|
||||
*/
|
||||
export async function GET() {
|
||||
try {
|
||||
const upstream = await fetch(`${BACKEND_URL}/api/accuracy`, {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
cache: 'no-store',
|
||||
});
|
||||
const data = await upstream.json().catch(() => ({ overall: null, sports: {} }));
|
||||
return NextResponse.json(data, { status: upstream.ok ? 200 : upstream.status });
|
||||
} catch {
|
||||
return NextResponse.json({ overall: null, sports: {}, min_sample: 8, updated_at: null }, { status: 200 });
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import { GradePill } from '@/components/GradeCard';
|
||||
// existing dashboard sections (Most Parlayed, Recent Reads) stay
|
||||
// below as intelligence layers on top of the raw odds.
|
||||
import Slate from '@/components/Slate';
|
||||
// Session 55 — the self-learning loop's track record, live in the header.
|
||||
import { AccuracyBadge } from '@/components/vyndr';
|
||||
|
||||
type Sport = 'NBA' | 'MLB' | 'WNBA';
|
||||
|
||||
@@ -205,6 +207,10 @@ export default function DashboardPage() {
|
||||
{new Date().toLocaleDateString([], { weekday: 'long', month: 'short', day: 'numeric' }).toUpperCase()}
|
||||
</p>
|
||||
</div>
|
||||
{/* Session 55 — the system's live track record. Self-hides while it has
|
||||
no data; reads "LEARNING" until the settled sample is honest. */}
|
||||
<div style={{ display: 'flex', gap: 10, alignItems: 'center', flexWrap: 'wrap' }}>
|
||||
<AccuracyBadge variant="chip" />
|
||||
{tier === 'free' && scansRemaining != null && (
|
||||
<div
|
||||
className="mono"
|
||||
@@ -220,6 +226,7 @@ export default function DashboardPage() {
|
||||
{scansRemaining}/5 READS · MO
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Session 13 — Browse-first slate. Owns its own sport-tab UI,
|
||||
|
||||
@@ -5,6 +5,9 @@ import { useRouter } from 'next/navigation';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import Hero from '@/components/Hero';
|
||||
import { ClaimMeter } from '@/components/vyndr';
|
||||
// Session 55 — live top A-rated grades pulled from tonight's real snapshot,
|
||||
// with the self-learning loop's accuracy line. The product shown, not described.
|
||||
import TopSignals from '@/components/TopSignals';
|
||||
// Session 17 — game-count strip mounted between the hero and the
|
||||
// existing LivePropsStrip. Shows "X NBA · Y WNBA · Z MLB games
|
||||
// being graded right now" with a signup CTA. Hides itself when
|
||||
@@ -45,6 +48,8 @@ export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<Hero />
|
||||
{/* Session 55 — tonight's real top signals + live accuracy (the system works). */}
|
||||
<TopSignals />
|
||||
{/* Founder-seat scarcity meter (§12) */}
|
||||
<div style={{ padding: '0 16px 8px' }}>
|
||||
<ClaimMeter />
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import ProcessingGrade from '@/components/vyndr/ProcessingGrade';
|
||||
import { AccuracyBadge } from '@/components/vyndr';
|
||||
import type { GradeResultData } from '@/components/vyndr/GradeResultCard';
|
||||
import { mapScanToGradeResult } from '@/lib/gradeAdapter';
|
||||
import { normalizeName, nameKey } from '@/lib/playerName';
|
||||
@@ -736,6 +737,12 @@ export default function ScanPage() {
|
||||
onReadAnother={reset}
|
||||
/>
|
||||
|
||||
{/* Session 55 — the self-learning loop's track record for this sport.
|
||||
"The system learns" — real hit rate on graded props, misses shown. */}
|
||||
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
||||
<AccuracyBadge variant="chip" sport={sport?.toLowerCase()} />
|
||||
</div>
|
||||
|
||||
{/* Sportsbook hand-off (preserved feature) */}
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, justifyContent: 'center' }}>
|
||||
{SPORTSBOOKS.map((b) => (
|
||||
|
||||
Reference in New Issue
Block a user