go-jsonl-audit-events-on-write
I diagnosed the bug empirically against the shipped binary and produced the solution doc at ~/solution.md.
Root cause. Board.Create and Board.UpdateTask write the durable task row but never call Board.AppendEvent, so the README-promised event trail and last_commit header bump are silently absent.
Empirical proof (built boardctl):
- create --id TK-2 → row appended, but no task_created event (id sequence stuck at 6 ← seeded 5).
- update TK-1 --status complete --commit-hash abc123 → row updated with commit_hash, but no task_completed event and header last_commit stayed null.
- A note-only update appended nothing either.
- For contrast, the standalone event command does append with MAX+1 (event id 6 appended), proving the machinery exists — it's just never wired into Create/Update.
Fix (library-level, all in Board):
1. Durable row write first — abort on failure.
2. Only after the row write succeeds, append the event (task_created in Create; task_completed on complete/completed, else task_updated, exactly one, in UpdateTask); row is kept and the error surfaced if the event fails.
3. Header last_commit bump only when --commit-hash is set.
4. NextEventID() = MAX+1 (shared sequence with the event command), matching the observed event-row schema (id, task_id, event_type, actor, tick_number, timestamp).
Verification: static (build/test, grep AppendEvent), a manual topology-A end-to-end run (create→id6, update→id7 task_completed, no-op→no duplicate, commit-hash→header bump), and a behavior-delta table for failure ordering.
The doc is self-contained with full Go snippets, commands, and expected jq outputs.
# Evidence - Problem class: go-jsonl-audit-events-on-write - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-09-04T18:30:55.623Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "boardctl create/update never called AppendEvent, silently breaking the README-promised events trail (task_created / task_completed / task_updated + last_commit header bump). Fix: library-level wiring in Board.Create and Board.UpdateTask \u2014 append event AFTER the durable task-row write succeeds (row kept + error surfaced if event fails), one status event per update, header bump only when --commit-hash set. Event ids continue MAX+1.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-jsonl-audit-events-on-write", "provider": "openrouter", "solved_at": "2026-09-04T18:30:55.624Z", "version": ""}I diagnosed the bug empirically against the shipped binary and produced the solution doc at ~/solution.md.
Root cause. Board.Create and Board.UpdateTask write the durable task row but never call Board.AppendEvent, so the README-promised event trail and last_commit header bump are silently absent.
Empirical proof (built boardctl):
- create --id TK-2 → row appended, but no task_created event (id sequence stuck at 6 ← seeded 5).
- update TK-1 --status complete --commit-hash abc123 → row updated with commit_hash, but no task_completed event and header last_commit stayed null.
- A note-only update appended nothing either.
- For contrast, the standalone event command does append with MAX+1 (event id 6 appended), proving the machinery exists — it's just never wired into Create/Update.
Fix (library-level, all in Board):
1. Durable row write first — abort on failure.
2. Only after the row write succeeds, append the event (task_created in Create; task_completed on complete/completed, else task_updated, exactly one, in UpdateTask); row is kept and the error surfaced if the event fails.
3. Header last_commit bump only when --commit-hash is set.
4. NextEventID() = MAX+1 (shared sequence with the event command), matching the observed event-row schema (id, task_id, event_type, actor, tick_number, timestamp).
Verification: static (build/test, grep AppendEvent), a manual topology-A end-to-end run (create→id6, update→id7 task_completed, no-op→no duplicate, commit-hash→header bump), and a behavior-delta table for failure ordering.
The doc is self-contained with full Go snippets, commands, and expected jq outputs.
# Evidence - Problem class: go-jsonl-audit-events-on-write - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-09-04T18:30:55.623Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "boardctl create/update never called AppendEvent, silently breaking the README-promised events trail (task_created / task_completed / task_updated + last_commit header bump). Fix: library-level wiring in Board.Create and Board.UpdateTask \u2014 append event AFTER the durable task-row write succeeds (row kept + error surfaced if event fails), one status event per update, header bump only when --commit-hash set. Event ids continue MAX+1.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-jsonl-audit-events-on-write", "provider": "openrouter", "solved_at": "2026-09-04T18:30:55.624Z", "version": ""}