Skip to content

miner/harness-submission-trigger.ts's circuit-breaker logic is invisible to Codecov #8346

Description

@JSONbored

Context

packages/loopover-engine/src/miner/harness-submission-trigger.ts (#2337) exports
evaluateHarnessSubmissionTrigger: the pure decision function that gates a real open_pr local-write from a
passing HandoffPacket. It checks a session-level circuit breaker FIRST (N consecutive allow: false
decisions pauses the whole session, never un-tripped by a later candidate on its own), then delegates to the
existing, separately-tested shouldSubmit (submission-gate.ts) for the per-candidate predicted-gate/slop
checks. It is live and consumed via the engine barrel, and it already has a full, passing test suite at
packages/loopover-engine/test/harness-submission-trigger.test.ts (9 scenarios, node --test).

Same failure mode as #6250 (review-enrichment's node:test suite being invisible to Codecov): that engine
package 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 — nothing under root test/** currently exercises evaluateHarnessSubmissionTrigger
directly, so it reports as ~0% covered in Codecov despite real, passing tests existing one directory over.

⚠️ Read this before starting. This issue is test-coverage-only. Do NOT modify
packages/loopover-engine/src/miner/harness-submission-trigger.ts,
packages/loopover-engine/src/miner/submission-gate.ts, or
packages/loopover-engine/test/harness-submission-trigger.test.ts. The only new artifact this issue calls
for is one new root-level vitest file that exercises the EXISTING, unchanged decision function. A PR that
changes this file's logic, or shouldSubmit's, does not satisfy this issue and is out of scope for it —
this is the live actuation trigger surface for an autonomous write and any behavior change here needs a
maintainer-reviewed design, not a routine contributor PR.

Requirements

  • Create test/unit/harness-submission-trigger.test.ts using describe/it/expect from vitest,
    importing evaluateHarnessSubmissionTrigger and DEFAULT_MAX_CONSECUTIVE_GATE_BLOCKS from
    "../../packages/loopover-engine/src/index" — the barrel — matching the existing sibling pattern in
    test/unit/calibration-dashboard.test.ts. Build fake HandoffPacket/MinerKillSwitchScope fixtures the
    same way packages/loopover-engine/test/harness-submission-trigger.test.ts already does.
  • Cover, at minimum, every scenario already exercised in
    packages/loopover-engine/test/harness-submission-trigger.test.ts (read it for the exact fixtures/assertions
    to mirror), including:
    • The session-level circuit breaker: consecutiveGateBlocks below maxConsecutiveGateBlocks does not
      trip it (falls through to shouldSubmit); at or above the threshold trips it (circuitBreakerTripped: true,
      allow: false) WITHOUT calling shouldSubmit at all (verify via a passing handoff packet that would
      otherwise allow) — boundary case: exactly maxConsecutiveGateBlocks.
    • The ?? default for maxConsecutiveGateBlocks falling back to DEFAULT_MAX_CONSECUTIVE_GATE_BLOCKS when
      omitted, and an explicit override being honored when provided.
    • A non-tripped candidate correctly threading killSwitchScope, the handoff packet's own
      predictedGateVerdict/slopAssessment, slopThreshold, and mode into shouldSubmit, and returning its
      allow/reasons verbatim with circuitBreakerTripped: false.

Deliverables

  • New file test/unit/harness-submission-trigger.test.ts (vitest, imports via the engine barrel).
  • No changes to any file under packages/loopover-engine/src/** or packages/loopover-engine/test/**.

Test Coverage Requirements

packages/loopover-engine/src/miner/harness-submission-trigger.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 this file at or near 100% line/branch coverage, including both arms of
the circuit-breaker boundary and the ?? default.

Expected Outcome

harness-submission-trigger.ts's already-real, already-tested circuit-breaker and gate-delegation 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 the module this repo's own comments describe as "the trigger surface the
safety-tier system reserves for maintainer review."

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions