Skip to content

One applier for a WAL connection's policy (foreign_keys + synchronous) - #4782

Open
trissim wants to merge 1 commit into
mainfrom
claude-laptop/wal-policy-applier
Open

trissim wants to merge 1 commit into
mainfrom
claude-laptop/wal-policy-applier

Conversation

@trissim

@trissim trissim commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4781. That PR made the synchronous value one declaration; this makes the mechanism that applies a WAL store connection's policy one declaration too.

foreign_keys = ON + synchronous = <policy> was still applied in two places — WalStore._configured_writer inline, and CoordinationStore.configure_connection with its own literals — so two openers of a WAL store could still disagree about a connection's policy. Extracted to StoreWriter.apply_connection_policy (where synchronous already lives); both call it and restate neither PRAGMA.

WAL-mode assertion stays per store on purpose (WalStore re-asserts per open; the coordinator sets WAL once on the private stage) — that timing is a real per-store difference, not a duplicated fact.

Behavior-identical: same two PRAGMAs, same values (verified apply_connection_policy sets foreign_keys=1, synchronous=1/NORMAL; CoordinationStore/WalStore inherit it). 106 passed across coordination/cohort/WAL-carry/response; the one test_registry_revision red is pre-existing (fails identically on base 21ff3333d).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSnLEc51gw21bLFFRK1

…, not restated per store

The synchronous value became one declaration in the previous commit, but the
mechanism that applies a WAL store connection's policy was still written twice:
WalStore._configured_writer set foreign_keys + synchronous inline, and
CoordinationStore.configure_connection set the same pair with its own literals.
Two openers of a WAL store could therefore still disagree on what a connection's
policy is.

Extract the per-connection pair onto StoreWriter.apply_connection_policy (where
synchronous already lives); WalStore and CoordinationStore both call it and
restate neither PRAGMA. WAL-mode assertion stays where each store needs it
(WalStore re-asserts per open; the coordinator sets it once on the private
stage), since that timing is a real per-store difference, not a duplicated fact.

Behavior-identical: same two PRAGMAs, same values. Coordination + cohort + WAL
carry + response tests green (base's one test_registry_revision red is
pre-existing, confirmed on 21ff333).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSnLEc51gw21bLFFRK1
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