fix(state): refuse WAL on SQLite builds with the WAL-reset bug

On vulnerable SQLite (e.g. 3.50.4), do not enable WAL for fresh/non-WAL
shared databases — prefer DELETE instead. Leave existing on-disk WAL
alone (no live downgrade under concurrent gateway/cron openers). Surface
Python/SQLite version details as a doctor warning (#69784).
This commit is contained in:
HexLab98 2026-07-23 15:48:16 +07:00 committed by kshitij
parent 8fc278207b
commit 953cbc0300
7 changed files with 186 additions and 6 deletions

View file

@ -53,7 +53,9 @@ class DiscordRecoveryStore:
return default
def _initialize(self, conn: sqlite3.Connection) -> None:
conn.execute("PRAGMA journal_mode=WAL")
from hermes_state import apply_wal_with_fallback
apply_wal_with_fallback(conn, db_label="discord_recovery.db")
conn.execute("""
CREATE TABLE IF NOT EXISTS discord_messages (
message_id TEXT PRIMARY KEY,