fix(store): make WORM/ledger appends atomic #266

Merged
KofTwentyTwo merged 1 commits from story/m6-worm-append-atomicity into dev 2026-07-31 16:22:57 +00:00
1 Commits
Author SHA1 Message Date
James Maes e87066de50 fix(store): make WORM/ledger appends atomic
save_filter_execution_log and append_worm_audit_record read the latest
chain hash and then insert as two separate statements with no lock,
letting concurrent appends read the same prev-hash and fork the
tamper-evident hash chain. Wrap each read+insert in a BEGIN IMMEDIATE
transaction so SQLite serializes the chain read against the dependent
insert.

Refs #245 #164
2026-07-31 11:19:38 -05:00