Skip to content

[bug-hunter] Make stats writes atomic on SQLite failure#1574

Merged
r3dbars merged 4 commits into
mainfrom
codex/atomic-stats-writes-20260722
Jul 23, 2026
Merged

[bug-hunter] Make stats writes atomic on SQLite failure#1574
r3dbars merged 4 commits into
mainfrom
codex/atomic-stats-writes-20260722

Conversation

@r3dbars

@r3dbars r3dbars commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Make recording and daily-activity statistics persistence fail together when SQLite rejects a write.

Evidence

recordSessionImpl already intended to wrap the recording insert and daily-activity update in one transaction, but ignored sqlite3_prepare and sqlite3_step failures. A rejected recording insert could therefore still commit the daily-activity update, making dashboard counts and duration disagree with recording history.

Fix

  • Propagate prepare, step, BEGIN, and COMMIT failures through the transaction boundary.
  • Roll back when any write fails.
  • Add a regression test using a SQLite authorizer that denies recording inserts and verifies neither table changes.

Verification

  • bash build-deps.sh --force
  • swift test --filter StorageTests
  • swift test
  • bash build.sh --no-open
  • bash run-tests.sh --filter RepoCommandContractTests
  • bash run-tests.sh
  • bash run-integration-smoke.sh
  • codex review --base origin/main

All checks passed. The independent review found no actionable regressions. Hardware and manual UI proof were not required for this storage-only change and remain unperformed.

@r3dbars
r3dbars marked this pull request as ready for review July 23, 2026 01:47
@r3dbars
r3dbars marked this pull request as draft July 23, 2026 11:08
@r3dbars
r3dbars marked this pull request as ready for review July 23, 2026 11:25
@r3dbars
r3dbars merged commit 0465d5d into main Jul 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant