Session 57: Phase 0 — Kill the Lies (2309 tests)
Work-order Phase 0 (Jul 10 live audit): every fabricated UI element deleted
or rewired to real data. Deletion sprint — no new product features.
0.1 Fake NBA game: root cause was scheduleService fetching the ESPN
scoreboard with no ?dates= param or date filter — off-season ESPN
returns the NEAREST slate (Jun 13 NYK@SA Finals rendered as tonight).
Now pinned to the requested ET date + defensive filter; undated events
dropped. Honest month-aware per-sport empty states (lib/emptyState.js).
0.2 Fake header counters: liveTick stripped to a bare 1s pulse (the
auto-incrementing "247 graded", sin-driven brain-%, aPlus/cascades are
dead). New GET /api/snapshot/summary (cache-only, before /:sport) +
Next proxy; HeartbeatBar shows the real graded count and SYNC =
elapsed since the last pipeline run (amber past 5 min).
0.3 Ticker: hardcoded fallback items deleted (real snapshot exhaust only);
MOVE kept — computeLineDeltas is real movement. <4 real items → no
ticker; bar publishes --ticker-h so the fixed header collapses cleanly.
0.4 /terminal retired: route redirects to /dashboard; VVI/injury-wire/
leaders layouts preserved unrouted as §12 content-engine templates.
Nav PRIMARY = Slate/Scan/Ledger; BottomTabBar Terminal→Explore; PWA
shortcut Terminal→Ledger; #terminal alias → /dashboard.
0.5 ›Query nav pill deleted (duplicate /scan link).
Backend 2289 → 2309 tests (199 suites), web build exit 0.
Spec: specs/phase-0-kill-the-lies.md. Next: work-order Phase 1 (ledger
persistence + settlement).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,12 +28,16 @@ function mountApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
// NOTE (Session 57, Phase 0): the event date must fall on the REQUESTED ET
|
||||
// date (2026-06-12) — 00:40Z Jun 13 = 20:40 ET Jun 12. The old fixture was
|
||||
// dated a day later and the route served it anyway; that exact hole is how the
|
||||
// Jun 13 NYK@SA Finals game kept rendering as "tonight" all July.
|
||||
const ESPN_NBA = {
|
||||
data: {
|
||||
events: [
|
||||
{
|
||||
id: '401234567',
|
||||
date: '2026-06-14T00:40:00Z',
|
||||
date: '2026-06-13T00:40:00Z',
|
||||
status: { type: { state: 'pre' } },
|
||||
competitions: [{
|
||||
venue: { fullName: 'Frost Bank Center' },
|
||||
@@ -81,6 +85,57 @@ describe('GET /api/schedule/:sport', () => {
|
||||
expect(axios.get.mock.calls.length).toBe(callsAfterFirst); // served from cache
|
||||
});
|
||||
|
||||
test('pins the ESPN fetch to the requested date (?dates=YYYYMMDD)', async () => {
|
||||
axios.get.mockResolvedValue(ESPN_NBA);
|
||||
await request(mountApp()).get('/api/schedule/nba?date=2026-06-12');
|
||||
expect(axios.get.mock.calls[0][0]).toContain('dates=20260612');
|
||||
});
|
||||
|
||||
// Session 57 (Phase 0) regression — in the off-season ESPN returns the
|
||||
// NEAREST slate, not today's. Any event whose ET date ≠ the requested date
|
||||
// must be dropped, or a June Finals game renders as tonight's slate in July.
|
||||
test('filters out events from a different ET date (fake off-season game)', async () => {
|
||||
axios.get.mockResolvedValue({
|
||||
data: {
|
||||
events: [
|
||||
{
|
||||
id: '401999999',
|
||||
date: '2026-06-14T00:30:00Z', // Jun 13 ET — NOT the requested Jun 12
|
||||
status: { type: { state: 'pre' } },
|
||||
competitions: [{
|
||||
competitors: [
|
||||
{ homeAway: 'home', score: '0', team: { displayName: 'San Antonio Spurs', abbreviation: 'SA' } },
|
||||
{ homeAway: 'away', score: '0', team: { displayName: 'New York Knicks', abbreviation: 'NYK' } },
|
||||
],
|
||||
}],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const res = await request(mountApp()).get('/api/schedule/nba?date=2026-06-12');
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.games).toEqual([]);
|
||||
});
|
||||
|
||||
test('drops events with no parseable date (live feed only)', async () => {
|
||||
axios.get.mockResolvedValue({
|
||||
data: {
|
||||
events: [{
|
||||
id: '77', // no `date` field at all
|
||||
status: { type: { state: 'pre' } },
|
||||
competitions: [{
|
||||
competitors: [
|
||||
{ homeAway: 'home', score: '0', team: { displayName: 'A', abbreviation: 'A' } },
|
||||
{ homeAway: 'away', score: '0', team: { displayName: 'B', abbreviation: 'B' } },
|
||||
],
|
||||
}],
|
||||
}],
|
||||
},
|
||||
});
|
||||
const res = await request(mountApp()).get('/api/schedule/nba?date=2026-06-12');
|
||||
expect(res.body.games).toEqual([]);
|
||||
});
|
||||
|
||||
test('returns empty array (not error) when no games today', async () => {
|
||||
axios.get.mockResolvedValue({ data: { events: [] } });
|
||||
const res = await request(mountApp()).get('/api/schedule/mlb?date=2026-06-12');
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// Session 57 (Phase 0) — GET /api/snapshot/summary: the HeartbeatBar's honest
|
||||
// data source. Real graded counts + latest pipeline run time from cache-only
|
||||
// Redis reads; must never invent numbers on a cold cache.
|
||||
|
||||
const express = require('express');
|
||||
const request = require('supertest');
|
||||
|
||||
const store = {};
|
||||
jest.mock('../../src/utils/redis', () => ({
|
||||
cacheGet: jest.fn(async (k) => (k in store ? store[k] : null)),
|
||||
cacheSet: jest.fn(async (k, v) => { store[k] = v; return true; }),
|
||||
}));
|
||||
|
||||
function mountApp() {
|
||||
delete require.cache[require.resolve('../../src/routes/snapshot')];
|
||||
const snapshotRoutes = require('../../src/routes/snapshot');
|
||||
const app = express();
|
||||
app.use('/api/snapshot', snapshotRoutes);
|
||||
return app;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
for (const k of Object.keys(store)) delete store[k];
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('GET /api/snapshot/summary', () => {
|
||||
test('sums real graded counts across sports and reports the latest run', async () => {
|
||||
store['snapshot:mlb:latest'] = {
|
||||
updated_at: '2026-07-10T18:00:00.000Z',
|
||||
grades: [{ player: 'A' }, { player: 'B' }, { player: 'C' }],
|
||||
};
|
||||
store['snapshot:wnba:latest'] = {
|
||||
updated_at: '2026-07-10T19:00:00.000Z',
|
||||
grades: [{ player: 'D' }],
|
||||
};
|
||||
const res = await request(mountApp()).get('/api/snapshot/summary');
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.graded).toBe(4);
|
||||
expect(res.body.updated_at).toBe('2026-07-10T19:00:00.000Z'); // latest run
|
||||
expect(res.body.sports.mlb).toBe(3);
|
||||
expect(res.body.sports.wnba).toBe(1);
|
||||
expect(res.body.sports.nba).toBe(0); // off-season → honest zero
|
||||
});
|
||||
|
||||
test('falls back to the grades:{sport} envelope when no snapshot exists', async () => {
|
||||
store['grades:mlb'] = { updated_at: '2026-07-10T16:00:00.000Z', grades: [{ player: 'A' }, { player: 'B' }] };
|
||||
const res = await request(mountApp()).get('/api/snapshot/summary');
|
||||
expect(res.body.graded).toBe(2);
|
||||
expect(res.body.updated_at).toBe('2026-07-10T16:00:00.000Z');
|
||||
});
|
||||
|
||||
test('cold cache → zeros and null timestamp, never invented numbers', async () => {
|
||||
const res = await request(mountApp()).get('/api/snapshot/summary');
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.graded).toBe(0);
|
||||
expect(res.body.updated_at).toBeNull();
|
||||
});
|
||||
|
||||
test('is not captured by the /:sport route (summary ≠ a sport)', async () => {
|
||||
store['snapshot:mlb:latest'] = { updated_at: 'x', grades: [{ player: 'A' }] };
|
||||
const res = await request(mountApp()).get('/api/snapshot/summary');
|
||||
// The /:sport handler would return { sport, grades, deltas }.
|
||||
expect(res.body.sport).toBeUndefined();
|
||||
expect(res.body.grades).toBeUndefined();
|
||||
expect(typeof res.body.graded).toBe('number');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
// Session 57 (Phase 0) — honest per-sport empty-slate copy (spec §6).
|
||||
// An off-season sport names its return window; an in-season sport calls it an
|
||||
// off-day. Never fixture games, never passive "waiting" language.
|
||||
|
||||
const { emptyStateCopy } = require('../../web/src/lib/emptyState');
|
||||
|
||||
const july = new Date('2026-07-10T12:00:00');
|
||||
const december = new Date('2026-12-10T12:00:00');
|
||||
const march = new Date('2026-03-10T12:00:00');
|
||||
|
||||
describe('emptyStateCopy', () => {
|
||||
test('NBA in July → off-season, returns in October', () => {
|
||||
const { title } = emptyStateCopy('nba', july);
|
||||
expect(title).toBe('NBA returns in October.');
|
||||
});
|
||||
|
||||
test('NBA in December → in-season off-day', () => {
|
||||
const { title } = emptyStateCopy('nba', december);
|
||||
expect(title).toBe('No NBA games today.');
|
||||
});
|
||||
|
||||
test('WNBA in March → off-season, returns in May', () => {
|
||||
expect(emptyStateCopy('wnba', march).title).toBe('WNBA returns in May.');
|
||||
});
|
||||
|
||||
test('WNBA in July → in-season off-day', () => {
|
||||
expect(emptyStateCopy('wnba', july).title).toBe('No WNBA games today.');
|
||||
});
|
||||
|
||||
test('MLB in December → off-season', () => {
|
||||
expect(emptyStateCopy('mlb', december).title).toBe('MLB returns in spring.');
|
||||
});
|
||||
|
||||
test('soccer has no off-season branch → off-day copy', () => {
|
||||
expect(emptyStateCopy('soccer', july).title).toBe('No Soccer games today.');
|
||||
});
|
||||
|
||||
test('unknown sport / "all" tab falls back to the generic line', () => {
|
||||
expect(emptyStateCopy('all', july).title).toBe('No games on the board today.');
|
||||
expect(emptyStateCopy(undefined, july).title).toBe('No games on the board today.');
|
||||
});
|
||||
|
||||
test('handles uppercase sport ids (dashboard passes NBA.toLowerCase(), but be safe)', () => {
|
||||
expect(emptyStateCopy('NBA', july).title).toBe('NBA returns in October.');
|
||||
});
|
||||
});
|
||||
@@ -25,7 +25,7 @@ describe('Phase C — routing config (lib/routes)', () => {
|
||||
});
|
||||
|
||||
it('leaves the landing + free funnel open (dashboard, scan stay public)', () => {
|
||||
['/', '/dashboard', '/scan', '/pricing', '/blog', '/terminal', '/login'].forEach((r) => {
|
||||
['/', '/dashboard', '/scan', '/pricing', '/blog', '/login'].forEach((r) => {
|
||||
expect(routes.isGatedRoute(r)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -37,12 +37,17 @@ describe('Phase C — routing config (lib/routes)', () => {
|
||||
|
||||
it('resolves hash deep-link aliases to real routes', () => {
|
||||
expect(routes.resolveHashAlias('#scan')).toBe('/scan');
|
||||
expect(routes.resolveHashAlias('#terminal')).toBe('/terminal');
|
||||
// Session 57 (Phase 0) — /terminal retired; old links land on the slate.
|
||||
expect(routes.resolveHashAlias('#terminal')).toBe('/dashboard');
|
||||
expect(routes.resolveHashAlias('#slate')).toBe('/dashboard');
|
||||
expect(routes.resolveHashAlias('#nope')).toBeNull();
|
||||
expect(routes.resolveHashAlias('')).toBeNull();
|
||||
});
|
||||
|
||||
it('drops the retired /terminal surface from OPEN_ROUTES', () => {
|
||||
expect(routes.OPEN_ROUTES).not.toContain('/terminal');
|
||||
});
|
||||
|
||||
it('keeps GATED and OPEN route lists disjoint', () => {
|
||||
const overlap = routes.GATED_ROUTES.filter((r) => routes.OPEN_ROUTES.includes(r));
|
||||
expect(overlap).toEqual([]);
|
||||
@@ -77,11 +82,18 @@ describe('Phase C — Nav conversion', () => {
|
||||
expect(src).toContain("fontFamily: 'var(--mono)'");
|
||||
expect(src).toContain("'var(--g-a)'");
|
||||
});
|
||||
it('exposes the primary Slate/Terminal/Scan/Ledger routes', () => {
|
||||
['/dashboard', '/terminal', '/scan', '/ledger'].forEach((href) => {
|
||||
it('exposes the primary Slate/Scan/Ledger routes', () => {
|
||||
['/dashboard', '/scan', '/ledger'].forEach((href) => {
|
||||
expect(src).toContain(href);
|
||||
});
|
||||
});
|
||||
// Session 57 (Phase 0) — Terminal (fabricated surface) and the duplicate
|
||||
// ›Query pill are gone from the nav. Don't re-add either.
|
||||
it('does not link /terminal or render the ›Query duplicate', () => {
|
||||
expect(src).not.toContain("href: '/terminal'");
|
||||
expect(src).not.toContain('data-search-trigger');
|
||||
expect(src).not.toContain('>Query<');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Phase C — Footer (system voice)', () => {
|
||||
|
||||
@@ -124,16 +124,22 @@ describe('Phase D — ClaimMeter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Phase D — Terminal page (real intelligence, not a stub)', () => {
|
||||
const src = read('app/terminal/page.tsx');
|
||||
it('is no longer a RouteStub', () => {
|
||||
expect(src).not.toContain('RouteStub');
|
||||
// Session 57 (Phase 0) — the Terminal surface was fabricated sample data
|
||||
// (Finals-era NBA content rendered as live intelligence). The route now
|
||||
// redirects to /dashboard; the layouts survive UNROUTED as §12 templates.
|
||||
describe('Phase 0 — Terminal retired (fabricated surface)', () => {
|
||||
it('the route redirects to the slate instead of rendering fake intel', () => {
|
||||
const src = read('app/terminal/page.tsx');
|
||||
expect(src).toContain("redirect('/dashboard')");
|
||||
expect(src).not.toContain('INJURY_WIRE');
|
||||
expect(src).not.toContain('Wembanyama');
|
||||
});
|
||||
it('uses the intel-surface and renders the VVI / cascade / leaders sections', () => {
|
||||
expect(src).toContain('intel-surface');
|
||||
expect(src).toContain('VOLATILITY INDEX');
|
||||
expect(src).toContain('INJURY WIRE');
|
||||
expect(src).toContain('GRADEABLE LEADERS');
|
||||
it('preserves the VVI / cascade / leaders layouts as unrouted templates', () => {
|
||||
const tpl = read('components/intel/TerminalTemplates.tsx');
|
||||
expect(tpl).toContain('NOT ROUTED');
|
||||
expect(tpl).toContain('VOLATILITY INDEX');
|
||||
expect(tpl).toContain('INJURY WIRE');
|
||||
expect(tpl).toContain('GRADEABLE LEADERS');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -11,13 +11,18 @@ const manifest = require('../../web/public/manifest.json');
|
||||
|
||||
describe('Phase F — BottomTabBar (5-tab spec)', () => {
|
||||
const src = read('components/BottomTabBar.tsx');
|
||||
// Session 57 (Phase 0) — Terminal tab retired (fabricated surface);
|
||||
// Explore holds its slot so the bar keeps 5 tabs.
|
||||
it('renders the five spec tabs', () => {
|
||||
['Slate', 'Terminal', 'Scan', 'Ledger', 'More'].forEach((label) => {
|
||||
['Slate', 'Explore', 'Scan', 'Ledger', 'More'].forEach((label) => {
|
||||
expect(src).toContain(`'${label}'`);
|
||||
});
|
||||
});
|
||||
it('routes the primary tabs to real pages', () => {
|
||||
['/dashboard', '/terminal', '/scan', '/ledger'].forEach((href) => expect(src).toContain(href));
|
||||
['/dashboard', '/explore', '/scan', '/ledger'].forEach((href) => expect(src).toContain(href));
|
||||
});
|
||||
it('does not link the retired /terminal surface', () => {
|
||||
expect(src).not.toContain('/terminal');
|
||||
});
|
||||
it('makes Scan the prominent (primary) action in grade-green', () => {
|
||||
expect(src).toContain('primary: true');
|
||||
@@ -90,11 +95,12 @@ describe('Phase F — PWA manifest + viewport (§11)', () => {
|
||||
expect(manifest.theme_color.toLowerCase()).toBe('#06060b');
|
||||
expect(manifest.background_color.toLowerCase()).toBe('#06060b');
|
||||
});
|
||||
it('ships deep-link shortcuts for Slate / Scan / Terminal', () => {
|
||||
it('ships deep-link shortcuts for Slate / Scan / Ledger', () => {
|
||||
const urls = (manifest.shortcuts || []).map((s) => s.url);
|
||||
expect(urls).toContain('/dashboard');
|
||||
expect(urls).toContain('/scan');
|
||||
expect(urls).toContain('/terminal');
|
||||
expect(urls).toContain('/ledger');
|
||||
expect(urls).not.toContain('/terminal'); // retired (Session 57, Phase 0)
|
||||
});
|
||||
it('declares its categories', () => {
|
||||
expect(manifest.categories).toContain('sports');
|
||||
|
||||
@@ -54,9 +54,10 @@ describe('QA.5 — wordmark everywhere', () => {
|
||||
});
|
||||
|
||||
describe('QA.11 — mobile parity (5-tab bar)', () => {
|
||||
it('BottomTabBar declares Slate/Terminal/Scan/Ledger/More', () => {
|
||||
// Session 57 (Phase 0) — Terminal retired; Explore holds its slot.
|
||||
it('BottomTabBar declares Slate/Explore/Scan/Ledger/More', () => {
|
||||
const src = read('components/BottomTabBar.tsx');
|
||||
['Slate', 'Terminal', 'Scan', 'Ledger', 'More'].forEach((t) => expect(src).toContain(`'${t}'`));
|
||||
['Slate', 'Explore', 'Scan', 'Ledger', 'More'].forEach((t) => expect(src).toContain(`'${t}'`));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -130,13 +130,22 @@ describe('Phase G.1 — living-layer tick engine (§8)', () => {
|
||||
liveTick.tick();
|
||||
expect(calls).toBe(2); // unsubscribed
|
||||
});
|
||||
it('advances tick and creeps the graded count, with a fresh state object', () => {
|
||||
it('advances tick with a fresh state object', () => {
|
||||
const first = liveTick.state;
|
||||
for (let i = 0; i < 7; i++) liveTick.tick();
|
||||
expect(liveTick.state.tick).toBe(7);
|
||||
expect(liveTick.state.graded).toBeGreaterThan(first.graded);
|
||||
expect(liveTick.state).not.toBe(first); // new object → React re-renders
|
||||
});
|
||||
// Session 57 (Phase 0) — the fake header counters are dead. The tick engine
|
||||
// must carry NO display data: no auto-incrementing graded count, no
|
||||
// sin-driven neural %. Real numbers come from /api/snapshot/summary only.
|
||||
it('carries no fabricated display counters', () => {
|
||||
liveTick.tick();
|
||||
expect(Object.keys(liveTick.state)).toEqual(['tick']);
|
||||
const src = read('lib/liveTick.js');
|
||||
expect(src).not.toContain('neural');
|
||||
expect(src).not.toContain('247');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Phase G.4 — checkout (§12)', () => {
|
||||
@@ -155,6 +164,15 @@ describe('Phase G — React glue wired correctly', () => {
|
||||
expect(src).toContain('ekg-track');
|
||||
expect(src).toContain('count-tick'); // LiveNumber pop
|
||||
});
|
||||
// Session 57 (Phase 0) — the heartbeat's numbers are REAL: graded count +
|
||||
// sync age come from /api/snapshot/summary; the fake neural % is gone.
|
||||
it('HeartbeatBar reads /api/snapshot/summary and shows no neural %', () => {
|
||||
const src = read('components/vyndr/LiveLayer.tsx');
|
||||
expect(src).toContain('/api/snapshot/summary');
|
||||
expect(src).not.toContain('neural');
|
||||
expect(src).toContain('SYNC'); // elapsed-since-snapshot clock
|
||||
expect(src).toContain('updated_at');
|
||||
});
|
||||
it('GlobalHosts registers the design globals + applies prefs on mount', () => {
|
||||
const src = read('components/vyndr/GlobalHosts.tsx');
|
||||
expect(src).toContain('window.__prefs');
|
||||
|
||||
Reference in New Issue
Block a user