/** * `cleo exodus seal` core — certify an already-migrated install (T11837). * * Some installs were cut over to the consolidated `cleo.db` BEFORE the archive + * completion-marker subsystem (T11777) existed: their data is fully in `cleo.db` * but the legacy source DBs were never archived and no `exodus-complete` marker * was written, so `exodus-on-open` keeps re-arming (the ~34s-per-command tax) * unless muzzled by `CLEO_DISABLE_EXODUS_ON_OPEN`. `cleo exodus migrate` would * complete the archival — but it routes through the heavy `verifyMigration` * digest, which OOMs on a 1.7 GB-class legacy `brain.db`. * * `sealExodus` closes the loop WITHOUT a destructive re-migrate and WITHOUT the * OOM digest: it gates on the memory-safe COUNT(*) deficit check * ({@link computeCountParity}) — the SAME gate (`target >= source`) the archive * path enforces — and, only when no rows are missing, archives the consumed * legacy sources (reversible move) and writes the per-scope completion marker. * * @task T11837 (fleet-flow surface — seal an already-migrated install) * @epic T11833 (EP-EXODUS-FLEET-HARDENING) * @saga T11242 (SG-DB-SUBSTRATE-V2) */ import { type CountParityResult } from './count-parity.js'; import type { ExodusPlan, ExodusScope } from './types.js'; /** Scope selector for {@link sealExodus}. */ export type SealScopeArg = ExodusScope | 'both'; /** Per-scope outcome of a seal. */ export interface SealScopeOutcome { /** Scope certified. */ readonly scope: ExodusScope; /** `true` if a completion marker already existed (re-seal is idempotent). */ readonly alreadySealed: boolean; /** Per-source archive outcomes for this scope. */ readonly archived: ReadonlyArray<{ readonly name: string; readonly action: 'archived' | 'absent'; readonly archivedTo: string | null; }>; /** Absolute path of the completion marker written. */ readonly markerPath: string; } /** Result of {@link sealExodus}. */ export interface SealResult { /** `true` when the seal proceeded; `false` when refused on a parity deficit. */ readonly ok: boolean; /** Populated when `ok === false`: why the seal was refused. */ readonly refusedReason?: string; /** The COUNT(*)-only parity sweep that gated the seal. */ readonly parity: CountParityResult; /** Per-scope outcomes (empty when refused). */ readonly scopes: readonly SealScopeOutcome[]; } /** * Seal one or more scopes of an already-migrated install: gate on COUNT(*) parity * (no digest), then archive the consumed legacy sources + write the completion * marker. Refuses (archives nothing) if ANY table has a deficit — the data is not * fully in `cleo.db` and the operator must run `cleo exodus migrate` first. * * Idempotent + reversible: archiving is a `rename` (never delete) and a re-seal * over an already-sealed scope simply refreshes the marker. * * @param plan - The exodus plan (`buildExodusPlan(cwd)`). * @param scopeArg - Which scope(s) to seal. * @param cwd - Working directory used to resolve the project dir. * @returns A {@link SealResult}. * * @task T11837 */ export declare function sealExodus(plan: ExodusPlan, scopeArg: SealScopeArg, cwd: string | undefined): SealResult; //# sourceMappingURL=seal.d.ts.map