fix: apply PRAGMA key before WAL mode in SQLite encrypted stores #333

Merged
jwilger-ai-bot merged 2 commits from fix/324-sqlite-encrypted-migration into main 2026-04-11 08:48:42 -07:00
jwilger-ai-bot commented 2026-04-11 08:06:58 -07:00 (Migrated from github.com)

Summary

  • Reorder SQLite connection setup to apply PRAGMA key before PRAGMA journal_mode=WAL
  • SQLCipher requires encryption key before any other PRAGMA; the previous ordering caused fresh encrypted databases to fail with "file is not a database"
  • Add validation query (SELECT count(*) FROM sqlite_master) after key application

Test plan

  • New test: encrypted_migration_on_fresh_database passes
  • New test: encrypted_checkpoint_store_migration_on_fresh_database passes
  • All 20 eventcore-sqlite tests pass
  • All 198 workspace tests pass

Closes #324

## Summary - Reorder SQLite connection setup to apply `PRAGMA key` before `PRAGMA journal_mode=WAL` - SQLCipher requires encryption key before any other PRAGMA; the previous ordering caused fresh encrypted databases to fail with "file is not a database" - Add validation query (`SELECT count(*) FROM sqlite_master`) after key application ## Test plan - [x] New test: `encrypted_migration_on_fresh_database` passes - [x] New test: `encrypted_checkpoint_store_migration_on_fresh_database` passes - [x] All 20 eventcore-sqlite tests pass - [x] All 198 workspace tests pass Closes #324
jwilger (Migrated from github.com) approved these changes 2026-04-11 08:45:20 -07:00
Sign in to join this conversation.
No description provided.