Skip to content

feat(cli): doctor --upgrade-check read-only upgrade preview (#116) - #118

Merged
OBenner merged 1 commit into
mainfrom
feat/116-smooth-update
Nov 17, 2026
Merged

OBenner merged 1 commit into
mainfrom
feat/116-smooth-update

Conversation

@OBenner

@OBenner OBenner commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Fixes #116 (part a + c; part b — init as the single upgrade command — is already the behavior: it reconciles, reuses credentials, migrates, and regenerates; this PR documents and previews it).

What

synloq doctor --upgrade-check — a read-only upgrade preview:

{
  "state": "pending",                    // fresh-install | current | pending | newer | unreadable
  "databasePath": "...",
  "schemaVersion": 5,
  "expectedSchemaVersion": 5,
  "pendingMigration": "v5→v6 adds the per-role memory notes table (automatic, additive)",
  "upgradePath": [
    "npm install -g synloq@latest   (or: npx synloq@latest …)",
    "synloq doctor --upgrade-check  (re-run this preview)",
    "synloq init --project-root <project>  (reconciles, migrates, regenerates channel configs)"
  ]
}
  • Opens the database through a readOnly: true connection with the same busy_timeout discipline as every other connection ([P1] Intermittent STORAGE_FAILURE (SQLite write failed) on live message writes #68): the preview waits out a live relay writer and never migrates, never writes, never creates objects — a test pins that a v5 database is byte-for-byte untouched after the check.
  • newer state fail-loud: a database written by a newer release gets an explicit "upgrade synloq first" message instead of an opaque open failure.
  • CURRENT_SCHEMA_VERSION extracted from the inline gate literals in sqlite.ts (no behavior change); the migration-notes table describes what each pending step does.

Docs

docs/guide/update.md documents the 3-command upgrade path, what init does on an existing stand (credential reuse, reconcile, migrate, regenerate), post-upgrade channel restart, and the forward-only downgrade policy with restore instructions.

DoD mapping

"Upgrade from 0.1.0 to next minor is: install, upgrade-check, init — no manual file edits" — the command path is now exactly that; the guide documents it. Verified on copied stands by the new tests (fresh/current/pending-without-writes/newer).

Note

#106 (schema v6) will set CURRENT_SCHEMA_VERSION = 6 and add its own migration note line — small expected conflict with this PR's constant extraction; whoever merges second resolves mechanically.

Verified: full pnpm verify 109 files / 957 tests PASS.

synloq doctor --upgrade-check opens the stand database read-only and
reports fresh-install/current/pending/newer schema states with a
human-readable description of the pending migration and the 3-command
upgrade path (install, upgrade-check, init) — without writing anything.
Extracts CURRENT_SCHEMA_VERSION from sqlite.ts; adds docs/guide/update.md
documenting the upgrade flow and the forward-only downgrade policy.
@OBenner
OBenner merged commit 5f02ab6 into main Nov 17, 2026
5 checks passed
@OBenner
OBenner deleted the feat/116-smooth-update branch November 17, 2026 08:01
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.

[P1] Smooth-update track: one-command re-init + migration dry-run before upgrades

1 participant