Context
packages/loopover-engine/src/governor/action-mode.ts (#2342) resolves the miner's overall
MinerActionMode (paused | dry_run | live), enforcing "dry-run by default" for autonomous miner
writes: resolveMinerActionMode returns paused when the kill-switch is active (regardless of any live-mode
opt-in), live only when BOTH the operator's global env opt-in AND the target repo's own explicit
liveModeOptIn: "live" literal are present, and dry_run for everything else (including any malformed or
partial config). It also exports the deliberately-non-boolean opt-in literal (MINER_LIVE_MODE_OPT_IN), the
strict-equality checkers (isExplicitMinerLiveModeOptIn, isGlobalMinerLiveModeOptIn), and
buildMinerDryRunGovernorLedgerEvent. It is live and consumed today (packages/loopover-miner/lib/attempt-input-builder.ts
and governor/chokepoint.ts), and it already has a full, passing test suite at
packages/loopover-engine/test/action-mode.test.ts (12 scenarios, node --test).
Same failure mode as #6250 (review-enrichment's node:test suite being invisible to Codecov): that engine
package test suite doesn't run under root vitest, which is what Codecov's codecov/patch gate reads.
packages/loopover-engine/src/**/*.ts is already listed in vitest.config.ts's coverage.include, so this
is a per-file gap — no file under root test/** currently exercises resolveMinerActionMode or its sibling
functions directly, so they report as ~0% covered in Codecov despite real, passing tests existing one
directory over. Note this repo already has plenty of precedent for safety-adjacent governor primitives
having real root-level vitest coverage (e.g. test/unit/miner-governor-kill-switch.test.ts,
test/unit/governor-kill-switch-pagerduty.test.ts) — this issue asks for the same shape of coverage for
action-mode.ts specifically, which is currently missing it.
⚠️ Read this before starting. This issue is test-coverage-only. Do NOT modify
packages/loopover-engine/src/governor/action-mode.ts, packages/loopover-engine/src/governor/kill-switch.ts,
or packages/loopover-engine/test/action-mode.test.ts. The only new artifact this issue calls for is one
new root-level vitest file that exercises the EXISTING, unchanged resolution logic. A PR that changes any
governor source file's behavior — including the kill-switch or live-mode opt-in precedence — does not
satisfy this issue and is out of scope for it.
Requirements
- Create
test/unit/miner-governor-action-mode.test.ts using describe/it/expect from vitest, importing
resolveMinerActionMode, minerActionModeExecutes, isExplicitMinerLiveModeOptIn,
isGlobalMinerLiveModeOptIn, buildMinerDryRunGovernorLedgerEvent, MINER_LIVE_MODE_OPT_IN, and
MINER_LIVE_MODE_ENV_VAR from "../../packages/loopover-engine/src/index" — the barrel — matching the
existing sibling pattern in test/unit/calibration-dashboard.test.ts. Use a fake/stubbed
MinerKillSwitchScope the same way packages/loopover-engine/test/action-mode.test.ts already does — do
not import or exercise the real isMinerKillSwitchActive implementation's own IO paths.
- Cover, at minimum, every scenario already exercised in
packages/loopover-engine/test/action-mode.test.ts
(read it for the exact fixtures/assertions to mirror), including the full 3-step precedence ladder from
resolveMinerActionMode's own doc comment:
- Kill-switch active →
paused, even when both live-mode opt-ins are also present.
- Kill-switch inactive, global opt-in true AND repo opt-in exactly
"live" → live.
- Every other combination (global opt-in false; global true but repo opt-in absent/malformed/wrong-case/wrong-type
like true or "Live" or "1") → dry_run.
isExplicitMinerLiveModeOptIn: true only for the exact literal "live"; false for true, "Live",
"1", undefined, null, and other strings.
isGlobalMinerLiveModeOptIn: true only when env.LOOPOVER_MINER_LIVE_MODE === "live" exactly.
minerActionModeExecutes: true only for "live".
buildMinerDryRunGovernorLedgerEvent: correct eventType/decision/reason fields, and the ??
fallback for an omitted repoFullName.
- Every
??, ternary, &&, and strict-equality branch in these functions must have both its taken and
not-taken branch exercised.
Deliverables
Test Coverage Requirements
packages/loopover-engine/src/governor/action-mode.ts is inside coverage.include in vitest.config.ts and
therefore IS subject to the 99% Codecov codecov/patch branch-counted gate — today it reports ~0% because
nothing under root test/** exercises it directly. After this PR, npm run test:coverage (run unsharded
locally) should show packages/loopover-engine/src/governor/action-mode.ts at or near 100% line/branch
coverage, including every arm of the 3-step precedence ladder.
Expected Outcome
governor/action-mode.ts's already-real, already-tested dry-run-by-default precedence logic becomes visible
to Codecov, so a future PR that changes this file is actually gated on real coverage instead of a blind spot
— closing a gap in exactly the kind of module (miner write-execution gating) where an uncaught regression
would matter most.
Links & Resources
Context
packages/loopover-engine/src/governor/action-mode.ts(#2342) resolves the miner's overallMinerActionMode(paused|dry_run|live), enforcing "dry-run by default" for autonomous minerwrites:
resolveMinerActionModereturnspausedwhen the kill-switch is active (regardless of any live-modeopt-in),
liveonly when BOTH the operator's global env opt-in AND the target repo's own explicitliveModeOptIn: "live"literal are present, anddry_runfor everything else (including any malformed orpartial config). It also exports the deliberately-non-boolean opt-in literal (
MINER_LIVE_MODE_OPT_IN), thestrict-equality checkers (
isExplicitMinerLiveModeOptIn,isGlobalMinerLiveModeOptIn), andbuildMinerDryRunGovernorLedgerEvent. It is live and consumed today (packages/loopover-miner/lib/attempt-input-builder.tsand
governor/chokepoint.ts), and it already has a full, passing test suite atpackages/loopover-engine/test/action-mode.test.ts(12 scenarios,node --test).Same failure mode as #6250 (
review-enrichment's node:test suite being invisible to Codecov): that enginepackage test suite doesn't run under root
vitest, which is what Codecov'scodecov/patchgate reads.packages/loopover-engine/src/**/*.tsis already listed invitest.config.ts'scoverage.include, so thisis a per-file gap — no file under root
test/**currently exercisesresolveMinerActionModeor its siblingfunctions directly, so they report as ~0% covered in Codecov despite real, passing tests existing one
directory over. Note this repo already has plenty of precedent for safety-adjacent governor primitives
having real root-level vitest coverage (e.g.
test/unit/miner-governor-kill-switch.test.ts,test/unit/governor-kill-switch-pagerduty.test.ts) — this issue asks for the same shape of coverage foraction-mode.tsspecifically, which is currently missing it.Requirements
test/unit/miner-governor-action-mode.test.tsusingdescribe/it/expectfromvitest, importingresolveMinerActionMode,minerActionModeExecutes,isExplicitMinerLiveModeOptIn,isGlobalMinerLiveModeOptIn,buildMinerDryRunGovernorLedgerEvent,MINER_LIVE_MODE_OPT_IN, andMINER_LIVE_MODE_ENV_VARfrom"../../packages/loopover-engine/src/index"— the barrel — matching theexisting sibling pattern in
test/unit/calibration-dashboard.test.ts. Use a fake/stubbedMinerKillSwitchScopethe same waypackages/loopover-engine/test/action-mode.test.tsalready does — donot import or exercise the real
isMinerKillSwitchActiveimplementation's own IO paths.packages/loopover-engine/test/action-mode.test.ts(read it for the exact fixtures/assertions to mirror), including the full 3-step precedence ladder from
resolveMinerActionMode's own doc comment:paused, even when both live-mode opt-ins are also present."live"→live.like
trueor"Live"or"1") →dry_run.isExplicitMinerLiveModeOptIn: true only for the exact literal"live"; false fortrue,"Live","1",undefined,null, and other strings.isGlobalMinerLiveModeOptIn: true only whenenv.LOOPOVER_MINER_LIVE_MODE === "live"exactly.minerActionModeExecutes: true only for"live".buildMinerDryRunGovernorLedgerEvent: correcteventType/decision/reasonfields, and the??fallback for an omitted
repoFullName.??, ternary,&&, and strict-equality branch in these functions must have both its taken andnot-taken branch exercised.
Deliverables
test/unit/miner-governor-action-mode.test.ts(vitest, imports via the engine barrel).packages/loopover-engine/src/**orpackages/loopover-engine/test/**.Test Coverage Requirements
packages/loopover-engine/src/governor/action-mode.tsis insidecoverage.includeinvitest.config.tsandtherefore IS subject to the 99% Codecov
codecov/patchbranch-counted gate — today it reports ~0% becausenothing under root
test/**exercises it directly. After this PR,npm run test:coverage(run unshardedlocally) should show
packages/loopover-engine/src/governor/action-mode.tsat or near 100% line/branchcoverage, including every arm of the 3-step precedence ladder.
Expected Outcome
governor/action-mode.ts's already-real, already-tested dry-run-by-default precedence logic becomes visibleto Codecov, so a future PR that changes this file is actually gated on real coverage instead of a blind spot
— closing a gap in exactly the kind of module (miner write-execution gating) where an uncaught regression
would matter most.
Links & Resources
packages/loopover-engine/src/governor/action-mode.ts(module under test — do not modify)packages/loopover-engine/test/action-mode.test.ts(the existing node:test suite to mirror scenarios from)test/unit/calibration-dashboard.test.ts(existing root-level vitest test following the exact pattern thisissue asks for)
test/unit/miner-governor-kill-switch.test.ts(existing root-level vitest precedent for a governorprimitive of comparable sensitivity)
vitest.config.ts(coverage.include, confirmspackages/loopover-engine/src/**/*.tsis already tracked)review-enrichment)