fix(#1392): hash-ledger migrations + install-time schema verification (closes #1392, closes #1402) (#1403)
ci/woodpecker/push/publish Pipeline failed

Co-authored-by: ops-deploy-01 <[email protected]>
This commit was merged in pull request #1403.
This commit is contained in:
2026-08-24 23:11:50 +00:00
committed by orch-01
parent d790572e2e
commit 4d24ae8618
9 changed files with 805 additions and 74 deletions
@@ -15,6 +15,7 @@
import { homedir } from 'node:os';
import { join } from 'node:path';
import { ClackPrompter } from '../../prompter/clack-prompter.js';
import type { VerifyResult } from './verify.js';
import type { WizardState } from '../../types.js';
interface InstallOpts {
@@ -89,13 +90,23 @@ export async function runInstall(opts: InstallOpts): Promise<void> {
prompter.log(` Logs: mosaic gateway logs`);
prompter.log(` Status: mosaic gateway status`);
// Post-install verification (CU-07-03) — non-fatal.
// Post-install verification (CU-07-03). Health/token/bootstrap failures
// stay non-fatal (courtesy checks), but a FAILED database schema check is
// fatal (#1392): an install that reports success over an empty/partial
// database is the exact T63 failure this command must never reproduce.
let verifyResult: VerifyResult | undefined;
try {
const { runPostInstallVerification } = await import('./verify.js');
await runPostInstallVerification(configResult.host, configResult.port);
verifyResult = await runPostInstallVerification(configResult.host, configResult.port);
} catch {
// Non-fatal — verification is a courtesy
}
if (verifyResult && verifyResult.schemaMigrated === false) {
prompter.warn(
'Gateway install ABORTED: database schema verification failed (remediation above).',
);
process.exit(1);
}
} catch (err) {
// Stages normally return structured results for expected failures.
// Anything that reaches here is an unexpected runtime error — render a