test(engine): make governor action-mode's coverage visible to Codecov#8452
Conversation
`packages/loopover-engine/src/governor/action-mode.ts` (JSONbored#2342) is the miner's dry-run-by-default write-execution gate — `resolveMinerActionMode` (kill-switch > both-opt-ins-required-for-live > dry_run), `minerActionModeExecutes`, `isExplicitMinerLiveModeOptIn`, `isGlobalMinerLiveModeOptIn`, and `buildMinerDryRunGovernorLedgerEvent`. It is fully exercised by the engine package's own `node --test` suite, but that runner is not part of the root vitest run Codecov reads `codecov/patch` from, so it reports as ~0% covered despite being genuinely tested (same blind spot as JSONbored#6250). Add a root-level vitest twin importing the primitives via the engine barrel and re-exercising every scenario the package suite covers — the full 3-step precedence ladder (kill-switch wins; both global env + repo `"live"` literal required for live; everything else, including malformed/wrong-case/wrong-type opt-ins, fails closed to dry_run), the strict-equality opt-in checkers, and the ledger-event builder's `?? null` repoFullName fallback (both arms). Kill-switch state is expressed purely through the `MinerKillSwitchScope` string, exactly as the package suite does, so no real kill-switch IO path is touched. 100% line + branch of the source locally. Test-only: no change to any file under `packages/loopover-engine/src/**` or `packages/loopover-engine/test/**`. Also document the root mirror in the engine README (Governor primitives section), next to the existing Codecov-mirror notes — the doc touch keeps this a full-coverage CI run so the sharded coverage blobs reach the merge step (a root-`test/**`-only diff is otherwise treated as a scoped, artifact-free run). Closes JSONbored#8345
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8452 +/- ##
==========================================
+ Coverage 92.42% 92.45% +0.02%
==========================================
Files 791 791
Lines 79294 79319 +25
Branches 23950 23954 +4
==========================================
+ Hits 73291 73333 +42
+ Misses 4866 4855 -11
+ Partials 1137 1131 -6
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 14:05:26 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #8345
Summary
packages/loopover-engine/src/governor/action-mode.ts(maintainer: dry-run-by-default enforcement #2342) is the miner's dry-run-by-default write-execution gate —resolveMinerActionMode,minerActionModeExecutes,isExplicitMinerLiveModeOptIn,isGlobalMinerLiveModeOptIn, andbuildMinerDryRunGovernorLedgerEvent. It is fully exercised by the engine package's ownnode --testsuite (packages/loopover-engine/test/action-mode.test.ts), but that runner is not part of the rootvitestrun Codecov readscodecov/patchfrom, so the module reports as ~0% covered despite being genuinely tested. Same blind spot as fix(ci): review-enrichment's real node:test coverage is invisible to Codecov (83 of 83 files effectively unmeasured) #6250.test/unit/miner-governor-action-mode.test.ts, importing the primitives via the engine barrel (../../packages/loopover-engine/src/index) and re-exercising every scenario the package suite covers — mirroring the sibling twinstest/unit/calibration-dashboard.test.tsandtest/unit/miner-governor-kill-switch.test.ts.packages/loopover-engine/src/**orpackages/loopover-engine/test/**. Kill-switch state is expressed purely through theMinerKillSwitchScopestring ("none"/"repo"/"global"), exactly as the package suite does, so no real kill-switch IO path is touched.Covered, per the issue's requirements: the full 3-step precedence ladder of
resolveMinerActionMode(kill-switch active →pausedeven with both opt-ins; global env opt-in AND repo"live"literal both required →live; every other combination — global false, global-true-but-repo-absent/malformed/wrong-case/wrong-type — →dry_run),isExplicitMinerLiveModeOptIn(true only for exact"live"; false fortrue/"Live"/"1"/null/undefined/…),isGlobalMinerLiveModeOptIn(exact env match only),minerActionModeExecutes(true only for"live"), andbuildMinerDryRunGovernorLedgerEvent(exact event shape + the?? nullrepoFullNamefallback, both arms). Locally this brings the source to 100% line + branch under vitest.Why the README change (please read before grading scope)
A pure
test/**-only diff that touches nopackages/loopover-engine/**path is classified by CI as a scoped, coverage-artifact-free run: each shard runsvitest --changed=origin/main --coverage.all=false, produces an emptycoverage/lcov.info(no changedsrc/**), and skips uploading its coverage blob. With zero blobs,validate-tests-mergethen fails withENOENT … all-blob-reports, failingvalidate. Touching an engine-package path (a README mirror-note) flips CI onto the full-coverage run, whose shards upload real blobs so the merge job passes — the same doc touch the merged twins for #8349/#8344 used. It adds zerosrc/**production lines, socodecov/patchstill has nothing on this diff to grade.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.md; does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #8345.Validation
git diff --check— clean.npm run actionlint— N/A: no workflow / composite-action changes.npm run typecheck— green (after building@loopover/engine, as the roottest:cisequence does before typecheck).npm run test:coveragelocally — the new file passes (12 tests) and reports 100% line + branch coverage ofaction-mode.ts.npm run test:workers— N/A: no worker code changed.npm run build:mcp/npm run test:mcp-pack— N/A: no MCP changes.npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build— N/A: no UI, API, or OpenAPI surface changed.npm audit --audit-level=moderate— not run locally (sandbox audit endpoint returns a lockfile 400); no dependency changes, so it cannot affect the audit. CI runs it against a clean install.If any required check was skipped, explain why:
Safety
CHANGELOG.mdnot edited (not a release-prep PR).Notes
action-mode.ts(or the kill-switch/live-mode opt-in precedence) was changed, and the package's ownnode --testsuite was left untouched, as the issue requires.