Retention: fill enrichment fields + page on a zero-write slot

PHASE 1 — cron capture needed NO wiring. Verified in code: the scheduler
tick calls runAll = snapshotService.runAllSnapshots, which loops
runSnapshot per sport, which already carries the onGraded -> retention
hook. The scheduled path and the manual path are the SAME function. The
reason no cron cycle had been captured is simply that no slot has fired
since retention deployed (slots are 14/19/22/1/3 UTC; retention landed
~02:55). Induced proof follows the deploy.

PHASE 2 — archetype/team/opponent were permanently null because retention
persisted at GRADE time, before enrichment attaches them. Retention still
COLLECTS at grade time (the only moment the feature vector exists) but now
PERSISTS after enrichment, merging those three fields via
retentionService.mergeEnrichment. The merge is pure and fills ONLY those
three fields — features and every model output are grade-time values and
must never be rewritten by enrichment; a test asserts that. Unmatched rows
(refusals not in the enriched slate) keep nulls rather than guesses. The
empty-slate early return now persists too: a refusal-only slate is still
history worth keeping.

PHASE 3 — ZERO-WRITE ALARM. opsWatch.retentionZeroWriteAlarm pages at
missed-snapshot severity when a slot GRADED props but retention wrote
fewer rows than the slate (or nothing). runSnapshot now returns
retentionRows so the scheduler can evaluate it. Retention is best-effort
by design so it can never break a snapshot — which means a broken write is
silent by construction. This is the counterweight. A slot that graded
nothing never false-pages; an absent count reads as NOTHING and still
pages, distinct from a reported 0.

Suite 280/3349 green, build exit 0. Outcome stamping deliberately NOT
implemented (depends on the settlement fix).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SmNjJAwEnqHPtXbvSZR8kA
This commit is contained in:
Kev
2026-07-20 02:00:40 -04:00
parent c2f6041406
commit 5a5e37e32e
6 changed files with 217 additions and 6 deletions
+15
View File
@@ -223,6 +223,21 @@ function startSnapshotScheduler(opts = {}) {
const total = results.reduce((n, r) => n + (r.gradeCount || 0), 0);
await notify(`Desk pack ready — ${total} props graded across ${ok.length} sports. vyndr.app/desk`, { title: 'VYNDR desk', tags: ['newspaper'] });
}
// Session 64 — RETENTION ZERO-WRITE ALARM. Features are irreplaceable: a
// night not captured cannot be reconstructed. Retention is best-effort so
// it never breaks a snapshot, which means a broken write is silent —
// this is the counterweight, at missed-snapshot severity.
try {
const written = {};
for (const r of results) written[r.sport] = r.retentionRows;
const rz = opsWatch.retentionZeroWriteAlarm(results, written);
if (rz.alarm) {
await notify(`RETENTION NOT CAPTURING at ${h}:00 UTC — ${rz.reason}. Feature vectors for this slate are irreplaceable and are being lost.`, {
title: 'VYNDR retention', priority: 'high', tags: ['rotating_light'],
});
}
} catch { /* alarm evaluation must never break the tick */ }
// Session 8 — persistent-failure pager: 3+ CONSECUTIVE erroring slots for
// a sport pages once (single-slot errors are normal before lines post).
for (const r of results) {