Skip to content

test(engine): make governor action-mode's coverage visible to Codecov#8452

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
cleanjunc:feat/8345-action-mode-codecov-twin
Jul 24, 2026
Merged

test(engine): make governor action-mode's coverage visible to Codecov#8452
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
cleanjunc:feat/8345-action-mode-codecov-twin

Conversation

@cleanjunc

Copy link
Copy Markdown
Contributor

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, and buildMinerDryRunGovernorLedgerEvent. It is fully exercised by the engine package's own node --test suite (packages/loopover-engine/test/action-mode.test.ts), but that runner is not part of the root vitest run Codecov reads codecov/patch from, 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.
  • Adds a root-level vitest twin, 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 twins test/unit/calibration-dashboard.test.ts and test/unit/miner-governor-kill-switch.test.ts.
  • Adds a short note to the engine README (Governor primitives section) documenting the root mirror. This README touch is deliberate and load-bearing — see "Why the README change" below.
  • No change to any file under packages/loopover-engine/src/** or packages/loopover-engine/test/**. Kill-switch state is expressed purely through the MinerKillSwitchScope string ("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 → paused even 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 for true/"Live"/"1"/null/undefined/…), isGlobalMinerLiveModeOptIn (exact env match only), minerActionModeExecutes (true only for "live"), and buildMinerDryRunGovernorLedgerEvent (exact event shape + the ?? null repoFullName fallback, 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 no packages/loopover-engine/** path is classified by CI as a scoped, coverage-artifact-free run: each shard runs vitest --changed=origin/main --coverage.all=false, produces an empty coverage/lcov.info (no changed src/**), and skips uploading its coverage blob. With zero blobs, validate-tests-merge then fails with ENOENT … all-blob-reports, failing validate. 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 zero src/** production lines, so codecov/patch still has nothing on this diff to grade.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • Focused: a single new test file plus a directly-related, CI-load-bearing README note; no unrelated backend/UI/MCP/dep/deploy changes.
  • Follows CONTRIBUTING.md; does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves — 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 root test:ci sequence does before typecheck).
  • npm run test:coverage locally — the new file passes (12 tests) and reports 100% line + branch coverage of action-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.
  • New or changed behavior has unit tests — this PR is the added test coverage; no production behavior changed.

If any required check was skipped, explain why:

  • All skipped checks are N/A for a PR that adds one root-level vitest file plus a docs note, with no production, UI, MCP, API, workflow, or dependency changes.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, trust scores, private rankings, or maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and implies no compensation or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests — N/A: none changed.
  • API/OpenAPI/MCP behavior is updated and tested where needed — N/A: none changed.
  • UI changes use live API data / real empty/error/loading states — N/A: no UI changes.
  • Public docs/changelogs updated where needed; CHANGELOG.md not edited (not a release-prep PR).

Notes

  • The test imports every primitive from the engine barrel, not a relative path into the source file, matching every existing sibling root-level engine test.
  • No behavior of action-mode.ts (or the kill-switch/live-mode opt-in precedence) was changed, and the package's own node --test suite was left untouched, as the issue requires.

`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
@cleanjunc
cleanjunc requested a review from JSONbored as a code owner July 24, 2026 13:41
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.45%. Comparing base (bf2270e) to head (898443c).
⚠️ Report is 16 commits behind head on main.

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     
Flag Coverage Δ
shard-1 56.15% <ø> (-1.61%) ⬇️
shard-2 51.28% <ø> (+3.60%) ⬆️
shard-3 55.10% <ø> (-1.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-24 14:05:26 UTC

2 files · 1 AI reviewer · no blockers · readiness 75/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a pure test-only addition that mirrors an existing pattern in the repo (test/unit/miner-governor-kill-switch.test.ts): it adds a root-vitest twin for action-mode.ts's exported primitives so Codecov's codecov/patch (which only reads root vitest) can see coverage for a module already exercised by the engine package's own node:test suite. The test scenarios correctly trace resolveMinerActionMode's real precedence ladder (kill-switch > both-opt-ins-required > default dry_run) as described in the config-precedence doc, and the README addition documents the mirror consistently with the existing pattern for miner-governor-kill-switch. No src/ or engine test/ files are touched, so there's no functional risk.

Nits — 3 non-blocking
  • The README long-file smell (690 lines, flagged by the external brief) predates this PR and this diff only adds 5 lines to it, so it's not a defect introduced here, but the file could use a table of contents or splitting given its size.
  • The issue reference governor/action-mode.ts's dry-run-by-default precedence logic is invisible to Codecov #8345 is asserted in comments/README but not independently verifiable from the diff alone — worth confirming the issue actually requires this specific root-mirror pattern rather than a broader coverage-config fix.
  • Consider whether a more systemic fix (e.g., configuring Codecov or vitest to also pick up packages/*/test/**/*.test.ts) would eliminate the need for hand-maintained twins going forward, since this is now the second or third such mirror file per the README's own list.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8345
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 53 registered-repo PR(s), 22 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor cleanjunc; Gittensor profile; 53 PR(s), 37 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Addressed
The PR adds test/unit/miner-governor-action-mode.test.ts using vitest via the engine barrel exactly as required, covering the full 3-step precedence ladder (kill-switch supremacy, both-opt-ins-required for live, all fallback-to-dry_run combinations), isExplicitMinerLiveModeOptIn/isGlobalMinerLiveModeOptIn strict-equality edge cases, minerActionModeExecutes, and buildMinerDryRunGovernorLedgerEvent

Review context
  • Author: cleanjunc
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 53 PR(s), 37 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (PR #8454)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 3 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 5a5a4f1 into JSONbored:main Jul 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

governor/action-mode.ts's dry-run-by-default precedence logic is invisible to Codecov

1 participant