/** * Pre-spawn assembly integrity re-verification (the 2026-07-20 incident fix). * * A deploy hashes the synthesised assembly ONCE, at detection, and the gates * verify against that snapshot — but bootstrap plus a docker build/push can * hold the read→mutate window open for many minutes, during which a * concurrent process (another deploy, lint-staged stashing the working tree * under a re-synth) can rewrite the SHARED `/cdk.out`. The deploy loop * ships the assembly as-is (`cdk deploy --app cdk.out`), so a swapped * template reaches CloudFormation carrying content nobody detected — or, on * a token-gated run, content the approver never saw. * * This check re-hashes each stack's template immediately before its cdk * spawn, using the SAME hasher detection used (TemplateHashService normalises * JSON before hashing, so the values are directly comparable), and fails * closed on any divergence. It runs UNCONDITIONALLY — gated and ungated * deploys alike — because the reference is the detection-time hash either * way; only the operator-facing wording differs. */ import { type Result } from "@fjall/generator"; import type { TemplateHashService } from "../../services/supporting/TemplateHashService.js"; export interface VerifyAssemblyIntegrityParams { hashService: Pick; cdkOutPath: string; /** The stack(s) about to spawn — one for sequential, the set for a parallel phase. */ stackNames: readonly string[]; /** Detection-time template hashes (the gates verified against these). */ detectionHashes: ReadonlyMap; /** True when this run was authorised through the approval gate. */ approvalGated: boolean; } /** * Re-hash each named stack's synthesised template and compare against the * detection-time hash. Fails closed on a mismatch OR an unreadable template * (a clobbered assembly can manifest as either). Stacks detection never * hashed are skipped: there is no reference to compare against, the pre-fix * loop deployed them, and a genuinely missing template still fails inside * cdk itself. */ export declare function verifyAssemblyIntegrity(params: VerifyAssemblyIntegrityParams): Promise>;