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>
35 lines
1.6 KiB
JavaScript
35 lines
1.6 KiB
JavaScript
// Session 44 — Phase 3: stale-game filtering.
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const adapter = require('../../web/src/lib/slateAdapter');
|
|
|
|
const NOW = new Date('2026-06-18T20:00:00Z').getTime();
|
|
const hoursAgo = (h) => new Date(NOW - h * 3_600_000).toISOString();
|
|
|
|
describe('isRelevantGame', () => {
|
|
it('keeps upcoming and live games regardless of date', () => {
|
|
expect(adapter.isRelevantGame({ status: 'pre', gameTime: hoursAgo(-2) }, NOW)).toBe(true);
|
|
expect(adapter.isRelevantGame({ status: 'in', gameTime: hoursAgo(1) }, NOW)).toBe(true);
|
|
});
|
|
it('drops a completed game older than 24h', () => {
|
|
expect(adapter.isRelevantGame({ status: 'post', gameTime: hoursAgo(120) }, NOW)).toBe(false); // 5 days
|
|
expect(adapter.isRelevantGame({ state: 'final', date: hoursAgo(30) }, NOW)).toBe(false);
|
|
});
|
|
it('keeps a recently completed game (<24h)', () => {
|
|
expect(adapter.isRelevantGame({ status: 'post', gameTime: hoursAgo(3) }, NOW)).toBe(true);
|
|
});
|
|
it('keeps games with an unparseable/missing date (degrade open)', () => {
|
|
expect(adapter.isRelevantGame({ status: 'post' }, NOW)).toBe(true);
|
|
expect(adapter.isRelevantGame({ status: 'post', gameTime: 'nonsense' }, NOW)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('Slate applies the freshness filter', () => {
|
|
it('filters games through isRelevantGame', () => {
|
|
const src = fs.readFileSync(path.join(__dirname, '..', '..', 'web', 'src', 'components', 'Slate.tsx'), 'utf8');
|
|
expect(src).toContain('isRelevantGame');
|
|
expect(src).toContain('games.filter((g) => isRelevantGame(g))');
|
|
});
|
|
});
|