7969a4971a
Frontend + wiring only. Wires existing backend into the pages users see. - VYNDR Original archetype rename (41) across archetypeService.js + lib/ archetypes.js + ArchetypeBadge, each keeping legacyName (resolves stale data). Judge -> BOMBER. Old POWER PULL slot -> WHIFF strikeout-artist pitcher. - BACKEND_HANDOFF.md: canonical frontend<->backend data contract. - Grade card intel: scan/page.tsx now forwards the engine's intel fields (season_avg/form/usage/matchup_grade/archetype/...) into mapScanToGradeResult -> STAT CONTEXT + VYNDR INTELLIGENCE sections populate. The chain already preserved them (tierGating + /api/scan spread); the page was dropping them. - Schedule freshness: slateAdapter.isRelevantGame drops completed games >24h old; Slate.filteredGames applies it. (TTL already 60s.) - Landing: Features.tsx rewritten to user-facing copy (no Point-biserial/Zone 14/ABS/Phi-coefficient). - Depth chart Next proxies added (/api/stats/lineup|depth|cascade) - were 404. - GameCard swap DEFERRED (Kev): legacy on-demand card stays as a bridge until the snapshot pipeline populates the grades cache; vyndr/GameCard swaps in then. Backend 2045 -> 2061 tests (+16), 167 suites. Web build clean (exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
2.0 KiB
JavaScript
44 lines
2.0 KiB
JavaScript
// Session 44 — Phase 2: the grade card's intel sections actually populate.
|
|
// The full chain: engine (Object.assign intel) → analyze route (tierGating
|
|
// spread) → /api/scan proxy (spread) → scan page → gradeAdapter → card.
|
|
// The broken link was the scan page dropping the fields; this locks it.
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const ROOT = path.join(__dirname, '..', '..');
|
|
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
|
|
const { applyTierGating } = require('../../src/utils/tierGating');
|
|
|
|
describe('tierGating preserves engine intel fields', () => {
|
|
it('free tier keeps season_avg/form/etc. (spreads ...result)', () => {
|
|
const gated = applyTierGating({ grade: 'A', season_avg: 26.9, form: 92, matchup_grade: 'A', usage: '31%' }, 'free');
|
|
expect(gated.season_avg).toBe(26.9);
|
|
expect(gated.form).toBe(92);
|
|
expect(gated.matchup_grade).toBe('A');
|
|
});
|
|
it('paid tier passes through unchanged', () => {
|
|
const out = applyTierGating({ grade: 'A', season_avg: 26.9, form: 92 }, 'desk');
|
|
expect(out.season_avg).toBe(26.9);
|
|
});
|
|
});
|
|
|
|
describe('scan page forwards intel fields to the grade card', () => {
|
|
const src = read('web/src/app/scan/page.tsx');
|
|
it('passes the engine intel fields into mapScanToGradeResult', () => {
|
|
for (const f of ['season_avg: result.season_avg', 'last10_avg: result.last10_avg', 'form: result.form', 'usage: result.usage', 'matchup_grade: result.matchup_grade', 'rest: result.rest', 'archetype: result.archetype', 'archetype_blend: result.archetype_blend', 'prop_dna: result.prop_dna']) {
|
|
expect(src).toContain(f);
|
|
}
|
|
});
|
|
it('ScanResponse type declares the intel fields', () => {
|
|
expect(src).toContain('season_avg?: number');
|
|
expect(src).toContain('matchup_grade?: string');
|
|
});
|
|
});
|
|
|
|
describe('/api/scan proxy preserves engine fields', () => {
|
|
it('spreads ...data (does not whitelist)', () => {
|
|
const proxy = read('web/src/app/api/scan/route.ts');
|
|
expect(proxy).toContain('...data');
|
|
});
|
|
});
|