Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(state): set sqlite wal before migration transaction

cyh728fac3a63a8
diff --git a/storage/alembic/env.py b/storage/alembic/env.py
index 6217bc65b..892dce130 100644
--- a/storage/alembic/env.py
+++ b/storage/alembic/env.py
@@ -35,10 +35,12 @@ def run_migrations_online() -> None:
poolclass=pool.NullPool,
)
- with connectable.begin() as connection:
+ with connectable.connect() as connection:
connection.exec_driver_sql("PRAGMA journal_mode = WAL")
connection.exec_driver_sql("PRAGMA foreign_keys = ON")
connection.exec_driver_sql("PRAGMA busy_timeout = 5000")
+ connection.commit()
+
context.configure(connection=connection, target_metadata=target_metadata)
with context.begin_transaction():
diff --git a/tests/test_sqlite_state_migration.py b/tests/test_sqlite_state_migration.py
index 5a354dd9e..a579e1dd4 100644
--- a/tests/test_sqlite_state_migration.py
+++ b/tests/test_sqlite_state_migration.py
@@ -42,6 +42,16 @@ def test_initial_migration_is_schema_snapshot() -> None:
assert "metadata.create_all" not in source
+def test_alembic_env_sets_wal_before_transaction() -> None:
+ env_path = Path("storage/alembic/env.py")
+
+ source = env_path.read_text(encoding="utf-8")
+
+ assert "with connectable.begin()" not in source
+ assert "with connectable.connect()" in source
+ assert "PRAGMA journal_mode = WAL" in source
+
+
def test_run_migrations_stamps_existing_initial_schema(tmp_path: Path) -> None:
db_path = tmp_path / "vibe.sqlite"
engine = create_sqlite_engine(db_path)