Skip to content

fix(journal): v0.6.26 — one-time SQLite->plugin import so re-enabling the journal preserves run history#293

Merged
Shooksie merged 2 commits into
mainfrom
feat/journal-import
Jun 30, 2026
Merged

fix(journal): v0.6.26 — one-time SQLite->plugin import so re-enabling the journal preserves run history#293
Shooksie merged 2 commits into
mainfrom
feat/journal-import

Conversation

@Shooksie

Copy link
Copy Markdown
Contributor

What

When the workflow_journal plugin is active, the run-summary readers read the plugin store — which started EMPTY after the v0.6.25 cutover (existing runs lived only in local SQLite), blanking the portal's /workflows. This adds the one-time import that the foundation pass deferred.

  • import_local_sqlite_into_plugin(project_root): on the Plugin backend, scans the LOCAL SQLite store and journal/save + journal/checkpoint_save each run/checkpoint (one at a time, bounded memory), then writes a .journal-imported-v1 marker.
  • No-op on the SQLite backend / kill-switch / marker-present / empty store. Idempotent (upserts; SELECT-only from SQLite — no data loss).
  • Triggered once at daemon boot (after the journal sink is wired, before reconcile). Never crashes boot — failure logs a warning + continues (points to ANIMUS_DISABLE_WORKFLOW_JOURNAL_PLUGIN=1).

Verification

build/clippy/fmt clean; 1225 workspace tests pass (only the 2 pre-existing decision_gate::workflow_* fail); 4 new import tests (copies N runs+checkpoints + marker; marker→skip; empty→marker+skip; SQLite-backend→no-op). codex stalled on the 2800-line state_manager.rs exploration (no findings emitted); manual P1 self-review clear (data-loss/double-import/startup-crash).

After this deploys I drop the kill-switch → boot imports the ~391 runs → readers serve from Postgres.

🤖 Generated with Claude Code

Shooksie added 2 commits June 29, 2026 19:39
…t (BU-1H)

Re-enabling the durable workflow_journal plugin blanked the portal's
run-history view: the summary readers route to the (empty) plugin store
while 391 existing runs lived only in local SQLite. Add a one-time,
idempotent boot migration that copies every run + its checkpoints from
the local SQLite engine into the active plugin via journal/save +
journal/checkpoint_save, then writes a marker (.journal-imported-v1,
next to workflow.db) to skip re-scanning.

- journal_client::import_local_sqlite_into_plugin: resolves the backend;
  no-op (skipped) for the SQLite path (no plugin / kill-switch) and when
  the marker exists. Reads the LOCAL SQLite store directly via a
  Sqlite-pinned WorkflowStateManager (new_sqlite) + sqlite_all_run_ids,
  iterating one run at a time (bounded memory) and upserting into the
  plugin through an internal JournalImportSink seam.
- Idempotent + safe: saves are upserts; the marker is written ONLY after
  a clean full pass, so a partial import retries next boot. Reads never
  mutate SQLite (no data loss).
- Daemon hook in run_daemon.rs, right after the journal sink is wired and
  before reconcile reads the journal. Best-effort: a failure is logged
  and never blocks startup (kill-switch remains the escape hatch).
- Tests: copy N runs+checkpoints (marker written), marker-present skip,
  empty store (marker written, 0 saves), SQLite backend no-op.
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
animus-docs Ready Ready Preview, Comment Jun 30, 2026 1:43am

Request Review

@Shooksie
Shooksie merged commit 151ff69 into main Jun 30, 2026
12 of 13 checks passed
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