Session E (night2): Phase 4 — scan + parlay polish
4.1 ROOT CAUSE of 'Ohtani returns nothing': no backend
/api/players/search existed (MLB 404'd; NBA/WNBA hit the offline
Python service). New Express route + mlbStatsAdapter.matchPlayers —
canonical nameKey fuzzy match (exact > last-name prefix > folded
substring). LIVE-VERIFIED vs the real 1,299-player list: Ohtani /
Aaron Judge / Sánchez / sanchez / Chisholm Jr all resolve; accented
and unaccented return identical results. Non-MLB matches the
platform's cached names (rosterlogs + grades), cache-only.
4.2 Reveal choreography per §7: analyzing steps → DECLASSIFIED stamp →
90ms-staggered context panels (entrance floors visible per the
Phase-0 rule); prefers-reduced-motion skips straight to the card.
4.3 PRIOR READS chips on scan results — the model's public ledger
history for the player (deferred-render, outcomes + pending, never
invented). /api/ledger/model gains ?player= on entries.
4.4 Parlay Lab: humanized stat labels via the ONE shared formatter
(lib/gradeAdapter.statLabel); 1-leg provisional grade ('Leg grade:
B — add a leg for the combined read'); discoverable entry — Nav
'Parlay Lab' item opens the drawer via window.__openParlay, and the
open drawer now renders an honest empty state at 0 legs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,16 +20,19 @@ export async function GET(req: NextRequest) {
|
||||
if (q.length < 2) return NextResponse.json({ players: [] });
|
||||
|
||||
try {
|
||||
// NBA/WNBA use the nba_api wrapper service; MLB falls back to the main backend.
|
||||
const url =
|
||||
sport === 'MLB'
|
||||
? `${BACKEND_URL}/api/players/search?sport=MLB&q=${encodeURIComponent(q)}${gameId ? `&game_id=${encodeURIComponent(gameId)}` : ''}`
|
||||
: `${NBA_SERVICE}/players/search?name=${encodeURIComponent(q)}`;
|
||||
// Session 60 (night2/E, audit 4.1) — Express is the canonical resolver
|
||||
// for EVERY sport now (nameKey fuzzy match; MLB = full statsapi list,
|
||||
// others = the platform's cached names). The Python NBA service is a
|
||||
// best-effort second try only when the canonical index has nothing.
|
||||
const url = `${BACKEND_URL}/api/players/search?sport=${encodeURIComponent(sport)}&q=${encodeURIComponent(q)}${gameId ? `&game_id=${encodeURIComponent(gameId)}` : ''}`;
|
||||
|
||||
const res = await fetch(url, { headers: { Accept: 'application/json' } });
|
||||
if (!res.ok) return NextResponse.json({ players: [] });
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
let res = await fetch(url, { headers: { Accept: 'application/json' } });
|
||||
let data = res.ok ? await res.json().catch(() => ({})) : {};
|
||||
const canonical = Array.isArray((data as { players?: unknown[] }).players) ? (data as { players: unknown[] }).players : [];
|
||||
if (canonical.length === 0 && sport !== 'MLB') {
|
||||
res = await fetch(`${NBA_SERVICE}/players/search?name=${encodeURIComponent(q)}`, { headers: { Accept: 'application/json' } }).catch(() => new Response(null, { status: 502 }));
|
||||
data = res.ok ? await res.json().catch(() => ({})) : {};
|
||||
}
|
||||
const rawPlayers: unknown[] = Array.isArray((data as { results?: unknown[] }).results)
|
||||
? (data as { results: unknown[] }).results
|
||||
: Array.isArray((data as { players?: unknown[] }).players)
|
||||
|
||||
@@ -1293,3 +1293,33 @@ html[data-font="readable"] .wm::after { opacity: 0.45 !important; }
|
||||
.gl-full:not(.gl-expanded) { display: none !important; }
|
||||
.gl-full.gl-expanded { margin-top: 10px; }
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
Session 60 (night2/E) — §7 reveal choreography.
|
||||
Stamp slam + 90ms staggered context panels. Entrance keyframes floor at
|
||||
a VISIBLE state (Phase-0 rule: a paused frame is never invisible), and
|
||||
reduced-motion kills the choreography entirely (ProcessingGrade also
|
||||
skips straight to the card).
|
||||
============================================================ */
|
||||
@keyframes stamp-in {
|
||||
0% { opacity: .5; transform: rotate(-7deg) scale(1.7); }
|
||||
60% { opacity: 1; transform: rotate(-7deg) scale(0.96); }
|
||||
100% { opacity: 1; transform: rotate(-7deg) scale(1); }
|
||||
}
|
||||
.stamp-in { animation: stamp-in .34s cubic-bezier(.2,1.6,.4,1) both; }
|
||||
|
||||
@keyframes panel-in {
|
||||
from { opacity: .55; transform: translateY(7px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
.grade-reveal > div > * { animation: panel-in .3s ease-out both; }
|
||||
.grade-reveal > div > *:nth-child(2) { animation-delay: 90ms; }
|
||||
.grade-reveal > div > *:nth-child(3) { animation-delay: 180ms; }
|
||||
.grade-reveal > div > *:nth-child(4) { animation-delay: 270ms; }
|
||||
.grade-reveal > div > *:nth-child(5) { animation-delay: 360ms; }
|
||||
.grade-reveal > div > *:nth-child(6) { animation-delay: 450ms; }
|
||||
.grade-reveal > div > *:nth-child(7) { animation-delay: 540ms; }
|
||||
.grade-reveal > div > *:nth-child(n+8) { animation-delay: 630ms; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.stamp-in, .grade-reveal > div > * { animation: none !important; }
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import ProcessingGrade from '@/components/vyndr/ProcessingGrade';
|
||||
import PriorReads from '@/components/vyndr/PriorReads';
|
||||
import { AccuracyBadge } from '@/components/vyndr';
|
||||
import type { GradeResultData } from '@/components/vyndr/GradeResultCard';
|
||||
import { mapScanToGradeResult } from '@/lib/gradeAdapter';
|
||||
@@ -762,6 +763,10 @@ export default function ScanPage() {
|
||||
onReadAnother={reset}
|
||||
/>
|
||||
|
||||
{/* Session 60 (4.3) — the model's public history on this player.
|
||||
Deferred-render: shows only when real ledger rows exist. */}
|
||||
<PriorReads player={selectedPlayer} stat={stat} />
|
||||
|
||||
{/* 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' }}>
|
||||
|
||||
Reference in New Issue
Block a user