Skip to content

fix(server): no database copy before the peer-poll migration - #481

Merged
Jacksondr5 merged 1 commit into
j5/mainfrom
fix/snapshot-list-empty
Oct 8, 2026
Merged

Jacksondr5 merged 1 commit into
j5/mainfrom
fix/snapshot-list-empty

Conversation

@Jacksondr5

Copy link
Copy Markdown
Owner

Problem

J5_LEDGER_SNAPSHOT_MIGRATIONS was [30], written in #429 on the assumption that migration 030 would be the destructive ledger re-key. The peer-poll stack merged first and took that number (030_PeerPollMode.ts). A server updating to today's j5/main would therefore copy its whole database (about 1.8 GB on one real install) to statev2.pre-j5-030.sqlite before an ordinary migration. No release has been cut from this state (latest tag is v0.0.48), so no user has seen it.

What changed

  • The list is empty. It does not name 31: the re-key migration adds its own id in the PR that adds it. The comment on the constant now says so, and says an id must never be listed ahead of its migration.
  • With an empty list snapshotBeforeJ5LedgerMigration returns at if (lowestGuardedId === undefined) return;, before it asks for the file system, checks that the database exists, or opens it. Nothing is read or copied and startup is unaffected.
  • Tests: the cases that relied on the default list now guard 030 explicitly, so they still exercise the snapshot. One new test: with the shipped list, a database with migration 030 pending takes no snapshot.
  • docs/j5/runbooks/dogfood-runtime.md and FORK.md case 1 no longer say 030 is guarded. They say no migration is guarded yet and the ledger re-key will be the first. The restore steps stay, with <migration> as the placeholder.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction — no UI change
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR — none edited; FORK.md case 1's wording is corrected
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md — no change to upstream's product
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md) — server startup only; the one caller is makeSqlitePersistenceLive
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them — the runbook is rewritten; no product or user doc mentions it

Verified in apps/server: vp test run src/j5/persistence src/persistence/Layers/Sqlite.test.ts (4 files, 66 tests passed), vp run typecheck (exit 0), vp lint . (exit 0, no findings in the touched files).

Claude Opus 5.5 (1M context), Claude Code harness in J5 Code.

🤖 Generated with Claude Code

The pre-migration snapshot list named migration 030, on the assumption
that 030 would be the destructive ledger re-key. The peer-poll migration
took that number instead, so updating copied the whole database before an
ordinary migration.

The list is now empty. A migration adds its own id in the PR that adds
it, and only if it rewrites or drops data destructively.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 8, 2026 3:37am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 13 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 41 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: ede4322d-c942-4d2e-a669-c9372938c9bf
📥 Commits

Reviewing files that changed from the base of the PR and between 0a7df67 and aeb2322.

📒 Files selected for processing (4)
  • FORK.md
  • apps/server/src/j5/persistence/LedgerMigrationSnapshot.test.ts
  • apps/server/src/j5/persistence/LedgerMigrationSnapshot.ts
  • docs/j5/runbooks/dogfood-runtime.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Oct 8, 2026
@github-actions github-actions Bot added the size:S 10-29 effective changed lines (test files excluded in mixed PRs). label Oct 8, 2026
@Jacksondr5
Jacksondr5 merged commit 71627d1 into j5/main Oct 8, 2026
28 checks passed
@Jacksondr5
Jacksondr5 deleted the fix/snapshot-list-empty branch October 8, 2026 03:45
@Jacksondr5 Jacksondr5 mentioned this pull request Oct 8, 2026
5 of 7 tasks

This branch was successfully deployed

1 active deployment
Preview — aeb23224 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant