Skip to content

miner/self-review-adapter.ts's diff-to-gate-input translation is invisible to Codecov #8348

Description

@JSONbored

Context

packages/loopover-engine/src/miner/self-review-adapter.ts (#2334) turns an attempt's live worktree diff
state into the same inputs buildPredictedGateVerdict (predicted-gate.ts) and an injected slop-assessment
function expect, so the miner's self-review pass is byte-identical in shape to what the live maintainer gate
would compute. It exports buildSelfReviewPredictedGateInput, buildSelfReviewChangedPaths,
buildSelfReviewSlopInput, runSelfReview, and the exported passing-conclusion literal
SELF_REVIEW_PASSING_CONCLUSION. It is live and consumed via miner/iterate-loop.ts and the engine barrel,
and it already has a full, passing test suite at packages/loopover-engine/test/self-review-adapter.test.ts
(12 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 runSelfReview and its helpers
directly, so they report 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/self-review-adapter.ts, packages/loopover-engine/src/predicted-gate.ts,
or packages/loopover-engine/test/self-review-adapter.test.ts. The only new artifact this issue calls for
is one new root-level vitest file that exercises the EXISTING, unchanged adapter functions (with
buildPredictedGateVerdict and an injected runSlopAssessment fake, the same way the existing node:test
suite already does). A PR that changes any of this adapter's logic does not satisfy this issue and is out
of scope for it.

Requirements

  • Create test/unit/self-review-adapter.test.ts using describe/it/expect from vitest, importing
    buildSelfReviewPredictedGateInput, buildSelfReviewChangedPaths, buildSelfReviewSlopInput,
    runSelfReview, and SELF_REVIEW_PASSING_CONCLUSION from "../../packages/loopover-engine/src/index"
    the barrel — matching the existing sibling pattern in test/unit/calibration-dashboard.test.ts. Use fake
    AttemptDiffState/SelfReviewContext/SelfReviewAdapterDeps fixtures the same way
    packages/loopover-engine/test/self-review-adapter.test.ts already does (an injected runSlopAssessment,
    never the real src/signals/slop.ts).
  • Cover, at minimum, every scenario already exercised in
    packages/loopover-engine/test/self-review-adapter.test.ts (read it for the exact fixtures/assertions to
    mirror), including:
    • buildSelfReviewPredictedGateInput: each optional field (body, labels, linkedIssues,
      authorAssociation) both present and omitted — every conditional spread (...(x !== undefined ? {...} : {}))
      must be exercised on both sides.
    • buildSelfReviewChangedPaths: maps changedFiles to their paths in order, including the empty-array
      case.
    • buildSelfReviewSlopInput: the ?? fallback for description (present body vs. undefinednull),
      and hasLinkedIssue correctly derived from linkedIssues?.length ?? 0 > 0 for an undefined, empty, and
      non-empty linkedIssues array.
    • runSelfReview: changedPaths is always threaded through explicitly to buildPredictedGateVerdict (never
      omitted); each optional SelfReviewContext field (bounties, issueQuality, confirmedContributor) both
      present and omitted; the injected runSlopAssessment is called with the built slop input and its result is
      passed through verbatim; passesPredictedGate is true only when predictedGateVerdict.conclusion === SELF_REVIEW_PASSING_CONCLUSION and false for every other conclusion value ("failure",
      "action_required", "neutral", "skipped").

Deliverables

  • New file test/unit/self-review-adapter.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/self-review-adapter.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 every
conditional-spread and ??/ternary arm.

Expected Outcome

self-review-adapter.ts's already-real, already-tested diff-to-gate-input translation 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 the miner's self-review loop relies on to match the live maintainer gate's own
verdict shape.

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