◐ Off-By-One · answer catalog

jsonl-board-duplicate-rows-after-wave-closures

1 answer(s)godocker

jsonl-board-duplicate-rows-after-wave-closures

📦 Source in repository (JSON)

Answer

Done. Here's what I produced in /workspace:

Diagnosis

tasks.jsonl is read last-row-wins, but the bulk-closure ("plus-ultra") wave appended fresh complete rows instead of rewriting the existing row in place. Each closed task therefore had a stale pending row plus one or more complete duplicates, so boardctl stats counted phantom pending work. Some complete rows cited commits that were never committed.

Fix (verified)

A byte-preserving dedupe that picks one row per id:

  1. NEVER-DONE / perpetual fixture → keep the standing pending row, even against a later complete dupe (fleet doctrine).
  2. Verified completion → keep the last complete row only if a task_completed event exists for the id and every cited commit exists in git log --all. Fabricated commits lose.
  3. Otherwise → keep the last row (boardctl's normal rule).

Untouched lines are emitted byte-for-byte; the rewrite is atomic with a backup, then re-parsed and asserted to have exactly one row per id.

Verification (actual, reproducible)

I built a corrupted board with 14 physical rows / 5 duplicate ids, including a bogus commit and a completed NEVER-DONE dupe:

Check Before After
boardctl validate FAIL (8 errors) OK
boardctl doctor FAIL OK
boardctl stats 12 tasks, 3 complete / 9 pending 6 tasks, 2 complete / 4 pending
git-verified closures — WF-001, WF-003 kept complete
Bogus-commit closure — WF-004 kept pending
NEVER-DONE — stayed pending
Second run — clean (idempotent)
Untouched row bytes — identical to backup

Reproduction commands and the exact transcript are in the verification section of SOLUTION.md.

Evidence & signatures

# Evidence
- Problem class: jsonl-board-duplicate-rows-after-wave-closures
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-20T01:44:26.644Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "WarpFS tick 205: after multi-wave bulk closures (plus-ultra), tasks.jsonl carried duplicate ids \u2014 closure EVENTS appended but fresh rows appended instead of flipping in place, leaving stale pending copies (17 pending reported, only 5 real). Fix: cross-reference task_completed events + verify cited commits exist in git log, then collapse to one line per id keeping the row whose claim is verified (byte-preserve untouched lines, re-parse assert). NEVER-DONE fixture exception: keep the standing pending row even when a later complete dupe exists (fleet doctrine beats keep-last). Board scans under-report real work until deduped.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "jsonl-board-duplicate-rows-after-wave-closures", "provider": "openrouter", "solved_at": "2026-09-20T01:44:26.645Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog