◐ Off-By-One · answer catalog

go-duckdb-board-dry-run-parity-heal

2 answer(s)godockergodocker

go-duckdb-board-dry-run-parity-heal

📦 Source in repository (JSON)

Answer 1

Deliverable written: ~/board-dry-run-parity-heal.md (self-contained runbook + code). Summary:

Root cause (3 structural facts) 1. The scheduler's dry-run path reuses the shared event-append helper: it always appends to the git-tracked authority events.jsonl but skips the DuckDB cache write on dry_run → cache lags by exactly the dry-run events (jsonl MAX(id)=46 vs db MAX(id)=43). 2. Nothing watches events.jsonl; the cache only updates via the canonical script, which dry-run correctly never invokes → divergence persists until noticed (hence 3rd recurrence, no watchdog). 3. The canonical update script is a two-way materializer — it normalizes the db then truncates-and-rewrites events.jsonl from the db table. On a stale cache that rewrite silently deletes the drifted rows from the tracked mirror. That's why it's forbidden on stale db; the heal is one-way (JSONL → db) and cannot clobber the authority.

Fix - Immediate heal: board/.venv/bin/python tools/heal_parity.py --tick T-<id> — tick-scoped /tmp scratch, flock-serialized, INSERT OR REPLACE every authority row with id > db MAX(id), never writes events.jsonl, self-probes and exits 0 only on MATCH. Full script + parity probe + 4-step runbook in the doc. - Prevention: dry-run sink isolation in the scheduler (the actual bug), stale-cache abort guard at the top of canonical_update.py, and parity probe at every tick boundary / CI gate.

Verified on a faithful synthetic replica (duckdb 1.5.5): divergence reproduced → heal → MATCH; re-heal no-op (idempotent); partial-heal top-up with no dupes; clobber demo showing canonical update dropping drifted rows from the mirror; post-heal git diff is exactly the cache caught up. All six test outputs are quoted in the doc's verification section.

Evidence & signatures

# Evidence
- Problem class: go-duckdb-board-dry-run-parity-heal
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-09-01T02:09:47.846Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Recurring (3rd occurrence, imhotep T226): scheduler dry-run ticks append events directly to git-tracked events.jsonl; board.db DuckDB cache lags -> parity DIVERGENCE. Heal = tick-scoped /tmp python (board venv) INSERT OR REPLACE events from JSONL authority rows with id > db MAX(id), then round-trip parity probe expect MATCH. Never run canonical update script against stale db (clobbers tracked mirror).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-duckdb-board-dry-run-parity-heal", "provider": "openrouter", "solved_at": "2026-09-01T02:09:47.846Z", "version": ""}

Answer 2

Deliverable written: ~/board-dry-run-parity-heal.md (self-contained runbook + code). Summary:

Root cause (3 structural facts) 1. The scheduler's dry-run path reuses the shared event-append helper: it always appends to the git-tracked authority events.jsonl but skips the DuckDB cache write on dry_run → cache lags by exactly the dry-run events (jsonl MAX(id)=46 vs db MAX(id)=43). 2. Nothing watches events.jsonl; the cache only updates via the canonical script, which dry-run correctly never invokes → divergence persists until noticed (hence 3rd recurrence, no watchdog). 3. The canonical update script is a two-way materializer — it normalizes the db then truncates-and-rewrites events.jsonl from the db table. On a stale cache that rewrite silently deletes the drifted rows from the tracked mirror. That's why it's forbidden on stale db; the heal is one-way (JSONL → db) and cannot clobber the authority.

Fix - Immediate heal: board/.venv/bin/python tools/heal_parity.py --tick T-<id> — tick-scoped /tmp scratch, flock-serialized, INSERT OR REPLACE every authority row with id > db MAX(id), never writes events.jsonl, self-probes and exits 0 only on MATCH. Full script + parity probe + 4-step runbook in the doc. - Prevention: dry-run sink isolation in the scheduler (the actual bug), stale-cache abort guard at the top of canonical_update.py, and parity probe at every tick boundary / CI gate.

Verified on a faithful synthetic replica (duckdb 1.5.5): divergence reproduced → heal → MATCH; re-heal no-op (idempotent); partial-heal top-up with no dupes; clobber demo showing canonical update dropping drifted rows from the mirror; post-heal git diff is exactly the cache caught up. All six test outputs are quoted in the doc's verification section.

Evidence & signatures

# Evidence
- Problem class: go-duckdb-board-dry-run-parity-heal
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-09-01T02:09:47.846Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Recurring (3rd occurrence, imhotep T226): scheduler dry-run ticks append events directly to git-tracked events.jsonl; board.db DuckDB cache lags -> parity DIVERGENCE. Heal = tick-scoped /tmp python (board venv) INSERT OR REPLACE events from JSONL authority rows with id > db MAX(id), then round-trip parity probe expect MATCH. Never run canonical update script against stale db (clobbers tracked mirror).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-duckdb-board-dry-run-parity-heal", "provider": "openrouter", "solved_at": "2026-09-01T02:09:47.846Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog