Skip to content

An older build starts on a database a newer build migrated #518

Description

@Jacksondr5

What happens

A J5 Code build that is older than the database opens it without complaint and fails later, at query time. Nothing compares the database's migration history with what the running build knows before the server starts work.

This is the second half of #517. #517 is about two servers on one home at the same time. This one is sequential: run a nightly, quit it, open stable again. Jackson (2026-10-10) wants both solved together, as a stack, because stopping two owners at once is half a fix if the one owner left cannot read the database.

What exists today

  • apps/server/src/persistence/Migrations.ts (upstream) already finds recorded migrations that are "unknown to this build" after migrating. It logs a warning and carries on.
  • J5's ledger migrator (apps/server/src/j5/a2a/Migrations.ts) has no check.
  • apps/server/src/j5/persistence/UpstreamMigrationCompatibility.ts refuses three histories that are too old to upgrade. That is the opposite direction.
  • j5 update and j5 service install refuse an older package without --allow-downgrade. That compares version numbers at install time and never reads the database. The Mac app does not go through it.
  • The pre-migration snapshot (feat(j5): nightly releases from j5/main, with a snapshot before any migration #511) and the rollback steps in docs/j5/runbooks/macos-packaging.md are the current protection. Both runbooks state that there is no downgrade guard.

What a fix has to guarantee

  • A server refuses to start when either migration history (upstream's or J5's ledger) records a migration this build does not have. The check comes before the snapshot and before any migration runs.
  • The person is told why, and what to do: update to the newer build, or restore the pre-migration snapshot.
  • In the Mac app this is a dialog, not the silent restart loop a failing bundled server causes today.

Open questions

Activity

  1. Jacksondr5 commented on Oct 10, 2026

    @Jacksondr5
    OwnerAuthor

    Decision (Jackson, 2026-10-10): this follows upstream PR pingdotgg#16102, which #517 is waiting on. Build it once that PR has reached J5 through an upstream sync, so the Mac app can show the refusal through the same exit-78 dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions