SQLite fixtures
Load this reference when inspecting or seeding isolated Akeru Bot state. Use deterministic visual fixtures for repeatable checks; use application commands to verify business behavior.
Repeatable visual fixtures
Create a fresh empty home and seed a scenario before starting the server:
FIXTURE_HOME=$(mktemp -d /tmp/akeru-ui.XXXXXX)
vp run dev:fixture --base-dir "$FIXTURE_HOME" --case populated
vp run dev --home-dir "$FIXTURE_HOME"Start the final command as a background task. Retain the printed home and task handle.
Cases are empty, populated, and edge. The fixture command runs migrations and creates deterministic projection data without provider calls. Populated data includes a bot and completed chats; edge data adds empty states, a long title, and an archived chat.
The command accepts only an empty directory or its own unused fixture directory. Repeated offline runs replace projection data and back up an existing database. After the app adds credentials, provider state, or events, create a fresh fixture home rather than resetting it. The helper refuses a running database, shared Akeru home paths, and redirected fixture state.
These are display fixtures, not a coherent event history. Use the app's commands for tests of edits, persistence, projection rebuilds, or server behavior. For a data-specific defect, take a read-only VACUUM INTO snapshot as described in AGENTS.md.
Select the correct database
When --base-dir or --home-dir is explicit, runtime state lives under <base-dir>/userdata and the database path is <base-dir>/userdata/state.sqlite. The <base-dir>/dev state directory is only the fallback for an implicit development home, preventing an ordinary vp run dev from touching production state.
Start the target runtime once before seeding so all migrations have run. Use an isolated base directory. Stop the server before writes to avoid racing application state or an active projection.
Use the helper
List tables:
node apps/server/scripts/t3-sqlite-state.ts query \
--base-dir <base-dir> \
--sql "SELECT name FROM sqlite_schema WHERE type = 'table' ORDER BY name"Inspect current columns before writing a fixture:
node apps/server/scripts/t3-sqlite-state.ts query \
--base-dir <base-dir> \
--sql "PRAGMA table_info(projection_threads)"Apply a SQL fixture from a file:
node apps/server/scripts/t3-sqlite-state.ts exec \
--base-dir <base-dir> \
--file /tmp/t3-seed.sqlUse one statement per invocation for both query and exec; the helper wraps writes in a transaction and prints the backup path after a successful mutation. Use a single insert with multiple value rows when a fixture needs several records.
Seed projection data carefully
The web UI primarily reads these projection tables:
projection_projectsprojection_threadsprojection_thread_messagesprojection_thread_activitiesprojection_thread_sessionsprojection_turnsprojection_pending_approvalsprojection_thread_proposed_plans
Inspect PRAGMA table_info(<table>) and the current migrations under apps/server/src/persistence/Migrations/ before constructing inserts. Keep identifiers unique, timestamps as ISO strings, JSON columns valid, and related project/thread/turn IDs consistent.
For a substantial current example, inspect seedDatabase in scripts/mobile-showcase-environment.ts. Adapt its column set to the target database instead of assuming copied SQL remains current.
Direct projection writes are appropriate for ephemeral visual states, edge-case counts, long titles, activity lists, and similar UI fixtures. They do not create a coherent orchestration event history. Do not modify orchestration_events unless the test specifically exercises projector internals, and do not use direct projection writes to claim backend business behavior works.
Use the app's commands or APIs for behavior tests. Use node apps/server/src/bin.ts auth ... for auth state rather than editing auth_pairing_links or auth_sessions.