fix(facts): route exit codes through setCliExitVerdict

The cli-exit-verdict-pin guard requires every exit-code write in src/
to go through setCliExitVerdict (raw process.exitCode assignments get
zeroed by the owned-verdict read on PGLite). Replace the two raw
assignments in the new facts command.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-07-22 10:50:45 -07:00
co-authored by Claude Fable 5
parent 2bb3424863
commit 039b97df36
+3 -2
View File
@@ -11,6 +11,7 @@
* any time the backlog reappears.
*/
import type { BrainEngine } from '../core/engine.ts';
import { setCliExitVerdict } from '../core/cli-force-exit.ts';
import { phaseBFenceFacts } from './migrations/v0_32_2.ts';
function printHelp(): void {
@@ -34,7 +35,7 @@ export async function runFactsCommand(engine: BrainEngine, args: string[]): Prom
if (sub !== 'fence-backfill') {
process.stderr.write(`Unknown facts subcommand: ${sub}\n`);
printHelp();
process.exitCode = 1;
setCliExitVerdict(1);
return;
}
@@ -43,5 +44,5 @@ export async function runFactsCommand(engine: BrainEngine, args: string[]): Prom
process.stderr.write(
`fence-backfill: ${result.status}${result.detail ? `${result.detail}` : ''}\n`,
);
if (result.status === 'failed') process.exitCode = 1;
if (result.status === 'failed') setCliExitVerdict(1);
}