fix(#1392): hash-ledger migrations + install-time schema verification (closes #1392, closes #1402) #1403

Merged
orch-01 merged 2 commits from fix/1392-install-migrations into next 2026-08-24 23:11:51 +00:00
2 Commits
Author SHA1 Message Date
ops-deploy-01 c14b49f613 test(#1392): typed fixtures in gateway spec, prettier clean
ci/woodpecker/pr/ci Pipeline was successful
2026-08-24 17:48:41 -05:00
ops-deploy-01 f1114b26b7 fix(#1392,#1402): hash-ledger migrations for both tiers + install-time schema verification
- runMigrations (postgres) no longer delegates to drizzle's postgres-js
  migrator: shared per-statement, skip-by-hash loop (applyMigrationsByHash)
  applies migrations in journal order regardless of 'when' timestamps.
  Fixes #1402 D1 (0009/0010 silently skipped on 0008-era upgrades —
  reproduced on real postgres: old path leaves 15/17, new path 17/17) and
  D2 (single-transaction wrap breaking 0009's ALTER TYPE sequence).
- runPgliteMigrations refactored onto the same core; behavior preserved
  (pre-existing PGlite migrate tests pass unchanged).
- New getMigrationStatus(): ledger-vs-journal completeness, read-only,
  never creates a ledger — an unmigrated DB reports 0/N (the #1389
  signature).
- Gateway startup (DatabaseModule.onModuleInit) verifies postgres schema
  after adapter.migrate() and REFUSES to start on incomplete (15/17-style)
  schemas, with remediation pointing at #1392/#1402.
- 'mosaic gateway install'/'verify' gain a database-schema check: postgres
  tiers get explicit runMigrations + completeness verification against the
  config the installed gateway actually resolves (daemon config priority).
  Install hard-fails on failed schema verification (fast-fail), closing the
  T63 failure mode where install reported success over an empty DB.
2026-08-24 17:45:59 -05:00