Stop persisting missed_window refusals (halt the bleed at source)

missed_window means 'this capture pass ran after first pitch'. It is a fact
about our cron cadence, not the market: once a game starts the same prop emits
a fresh refusal every ~20 minutes for the rest of the night, per book, per
side. Measured over 7 days of production that is 332,608 rows/day - 83.1% of
all closing_captures writes, ~66 MB/day - and since B1 filtered both readers,
nothing reads them.

The filter lives in persist(), not buildCaptureRows(), and that is the whole
trick: the caller computes the capture-rate alarm from the full in-memory
array, so filtering at build time would have blinded the ops alarm to the exact
condition it exists to catch. captureRateAlarm is pure; a test asserts the
caller still passes the full array, and that a 10-priced/90-late pass still
fires at 0.10.

Narrow by design: one_sided_price still persists (liquidity signal), priced
captures unchanged, and the rare fault refusals still persist because each
names a pipeline fault worth seeing. A missed_window row carrying a price is
kept.

Growth drops 400,469 -> 67,862 rows/day. The 4.2M historical rows are now
static, so the cleanup is a calm decision rather than a race.

Nothing deleted. Grade untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-08-12 00:34:04 -04:00
parent 2271f46ab2
commit fb0010222d
5 changed files with 250 additions and 5 deletions
+16
View File
@@ -3,6 +3,22 @@
## Last Updated
2026-08-12
## Fix B2 (2026-08-12) — halt the closing_captures bleed at source ✅
4,793 tests / 373 suites, web build exit 0. **No rows deleted. Grade untouched.
Readers untouched. No R2 involved.**
- `closingCapture.persist()` no longer writes `missed_window` rows (both odds
null). Priced + `one_sided_price` + the rare fault refusals persist unchanged.
Revert with `CLOSING_PERSIST_MISSED_WINDOW=1`.
- **Write reduction, measured on 7 days of production: 400,469 → 67,862
rows/day (−83.1%); ~80 MB/day → ~13.5 MB/day at 199.6 bytes/row.**
- **Ops alarm intact** — `captureRateAlarm` is pure and the caller still passes
the full in-memory array, so a late pass still pages even though the refusals
are no longer stored. 13 tests, incl. a 10-priced/90-late pass asserting the
alarm still fires at 0.10.
- **The 4,236,398 historical rows are now STATIC** (975 MB of a 1,314 MB DB).
The cleanup is now a calm scheduled decision, not a race — and a delete will
no longer be undone by regrowth.
## Fix B1 (2026-08-12) — dCLV close-leg filter ✅
4,780 tests / 372 suites, web build exit 0. **Grade untouched (0 grade-related
diff lines); no rows deleted or archived.**