/** * `unfreeze ` — the operator's sanctioned override for a base-red-freeze. * * A base-red-freeze is a mechanical gate: `prMergeVerb` refuses every * `conductor_pr_merge` to a repo whose base is red, and the floor binds even * the orchestrator to that refusal. This verb is the *one* sanctioned way to * lift it early — after the operator has judged the base repaired (or the * merge warranted anyway) — and it is ledger-recorded: the freeze row keeps * `clearedBy`/`clearedReason`/`clearedAt` as its durable override audit, and a * material event names the override for the queue digest. It is deliberately * not label surgery or a raw DB edit, and it does not re-arm — a still-red base * will re-freeze the repo on the next watch observation. */ import type { CommandContext } from "./context.ts"; import { findProject, loadConfig } from "../config.ts"; import { dbPath, openStore } from "../store.ts"; export async function unfreezeCommand(ctx: CommandContext): Promise { const repo = ctx.argv[1]; if (repo === undefined || repo.length === 0 || repo.startsWith("-")) { process.stderr.write("omp-conductor: unfreeze needs the routed repo name, e.g. `omp-conductor unfreeze api`\n"); process.exit(2); } const reason = ctx.flag("--reason") ?? "operator-override"; const cfg = loadConfig(); const project = findProject(cfg, ctx.projectFlag); const store = openStore(dbPath()); try { const now = Date.now(); const lifted = store.clearBaseFreeze(project.name, repo, "operator", reason, now); if (!lifted) { process.stdout.write( `unfreeze: ${repo} has no active base-red freeze in ${project.name} (merges already allowed). Nothing to lift.\n`, ); return; } store.recordMaterialEvent({ project: project.name, category: "unfreeze", summary: `operator unfroze merges to ${repo} (${reason})`, evidence: `An operator lifted the base-red-freeze on ${repo} with reason "${reason}". ` + "This is the sanctioned override path — the freeze re-arms automatically if the base is " + "observed red again.", occurredAt: now, recordedAt: now, }); process.stdout.write( `unfreeze: ${repo} base-red freeze lifted in ${project.name} (reason: ${reason}). ` + "Merges to this repo resume; a still-red base will re-freeze on the next watch observation.\n", ); } finally { store.close(); } }