aaa41134d4
The landing hero reads the snapshot from Redis DIRECTLY via heroPropService, so it never passed through routes/snapshot.js and was still serving model_odds, ev_pct, value and takeable to anonymous visitors after the first fix. Same strip, same tier resolution, same private-cache rule for authenticated callers; the Next proxy now forwards the bearer token. PRODUCT CONSEQUENCE, FLAGGED RATHER THAN BURIED: the landing hero is served to anonymous visitors, so it now renders BOOK and FAIR with the model leg LOCKED instead of the full triplet it showed this morning. That follows the stated free-tier rule exactly, but it does trade a strong marketing moment (VALUE +21.1% VS FAIR on the shop window) for consistency of the gate. Reversing is one line — add 'model_price' to the free tier in src/config/tiers.js, or special-case the hero route — and is a product call, not a correctness one. Tests 3557 passed / 291 suites, web build exit 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCNgGSt5qvcLxaeQqa7Zpj
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
|
|
|
|
/**
|
|
* Hero-prop proxy (Truth-Everywhere Part 2, item 5) — forwards to the Express
|
|
* /api/hero-prop, which reads the pre-graded snapshot for the largest
|
|
* |model - consensus| gap among A/B grades (the read where VYNDR disagrees most
|
|
* with the market). Empty slate → most recent real graded read. Any failure →
|
|
* { available: false } so the card HIDES; there is NO hand-written fallback
|
|
* (the old static Jokic card is gone).
|
|
*/
|
|
export async function GET(req: Request) {
|
|
try {
|
|
const upstream = await fetch(`${BACKEND_URL}/api/hero-prop`, {
|
|
method: 'GET',
|
|
headers: { Accept: 'application/json', ...(req.headers.get('authorization') ? { Authorization: req.headers.get('authorization')! } : {}) },
|
|
cache: 'no-store',
|
|
});
|
|
const data = await upstream.json().catch(() => ({ available: false }));
|
|
return NextResponse.json(data, {
|
|
status: 200,
|
|
headers: { 'Cache-Control': 'public, s-maxage=300, stale-while-revalidate=60' },
|
|
});
|
|
} catch {
|
|
return NextResponse.json({ available: false }, { status: 200 });
|
|
}
|
|
}
|