Session 52: Coming Soon teaser + infrastructure verification (2239 tests)

Phase 1 — Push-to-Book teaser (feature not live; teaser only):
- StatStrip: "BOOK IT ⟶" per graded prop (hover: "Push-to-Book coming soon").
- GradeResultCard: "PUSH-TO-BOOK · COMING SOON" footer.

Phase 2 — infrastructure verification:
- snapshotScheduler logs armed AND disarmed state (incl SNAPSHOT_CRON) so
  container logs disambiguate off-vs-crashed.
- NEW GET /api/internal/snapshot/status (internal-key gated): cron_armed,
  cron_hours_utc, last_snapshot per sport (gradeCount/deltaCount), redis_keys
  existence map, ticker_count. The post-deploy pipeline health probe.
- Finding: Redis AOF/RDB persistence is a server-side (Coolify) config the app
  can't set/verify — documented.

Phase 3 — delta pipeline (verified sound, no fix needed):
- runSnapshot already rotates :latest->:previous and diffs locked lines; added
  opt-in SNAPSHOT_DEBUG=1 [deltas] log + a trace test asserting :previous is
  preserved verbatim and the delta math is correct.

Backend 2234 -> 2239 tests (+5), 192 suites. Web build clean (exit 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-19 13:55:39 -04:00
parent f0674ca07d
commit cdedecf55b
12 changed files with 221 additions and 5 deletions
+9 -2
View File
@@ -18,7 +18,14 @@ const HOURS_UTC = (process.env.SNAPSHOT_HOURS_UTC || '14,19,22,1,3')
.filter((n) => Number.isInteger(n) && n >= 0 && n <= 23);
function startSnapshotScheduler(opts = {}) {
if (process.env.SNAPSHOT_CRON !== '1') return null;
if (process.env.SNAPSHOT_CRON !== '1') {
// Session 52 — log the disarmed state so container logs make it unambiguous
// that the in-process cron is intentionally off (vs. crashed/missing).
if (process.env.NODE_ENV !== 'test') {
console.log(`[snapshotScheduler] disarmed — SNAPSHOT_CRON=${process.env.SNAPSHOT_CRON ?? 'unset'} (in-process cron off; use external cron → POST /api/internal/snapshot/all)`);
}
return null;
}
const runAll = opts.runAllSnapshots || require('./services/snapshotService').runAllSnapshots;
const now = opts.now || (() => new Date());
let lastFiredSlot = null;
@@ -42,7 +49,7 @@ function startSnapshotScheduler(opts = {}) {
const interval = setInterval(tick, 60_000);
if (interval.unref) interval.unref();
console.log(`[snapshot] scheduler armed for UTC hours: ${HOURS_UTC.join(', ')}`);
console.log(`[snapshotScheduler] armed — SNAPSHOT_CRON=${process.env.SNAPSHOT_CRON}, hours=${HOURS_UTC.join(',')} UTC`);
return { interval, tick };
}