noteBrowserOutcome(state: Pick<DaemonState, "consecutiveCrashes">,connected: boolean): "ok" | "relaunch" | "shutdown"
The crash-budget policy, as one pure decision: what a run's outcome does to the counter, and what should happen next.
Extracted so the rule can be proven without launching Chrome. It used to live at two call
sites — a reset here, an increment there — and the only coverage for "a successful run resets
the counter" was an end-to-end test that killed Chrome twice and waited out two real relaunches.
That test could not fit inside the per-test deadline on a loaded runner, so the property was
expensive AND unreliable to check. See test/commands/daemon-crash-budget-test.ts.
import * as Server from './server.ts'; Server.noteBrowserOutcome({ consecutiveCrashes: 1 }, true); // 'ok' — and the counter is reset Server.noteBrowserOutcome({ consecutiveCrashes: 0 }, false); // 'relaunch'
state: Pick<DaemonState, "consecutiveCrashes">