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. undefined → null),
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
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
Context
packages/loopover-engine/src/miner/self-review-adapter.ts(#2334) turns an attempt's live worktree diffstate into the same inputs
buildPredictedGateVerdict(predicted-gate.ts) and an injected slop-assessmentfunction 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 literalSELF_REVIEW_PASSING_CONCLUSION. It is live and consumed viaminer/iterate-loop.tsand 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 enginepackage 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 — nothing under root
test/**currently exercisesrunSelfReviewand its helpersdirectly, so they report as ~0% covered in Codecov despite real, passing tests existing one directory over.
Requirements
test/unit/self-review-adapter.test.tsusingdescribe/it/expectfromvitest, importingbuildSelfReviewPredictedGateInput,buildSelfReviewChangedPaths,buildSelfReviewSlopInput,runSelfReview, andSELF_REVIEW_PASSING_CONCLUSIONfrom"../../packages/loopover-engine/src/index"—the barrel — matching the existing sibling pattern in
test/unit/calibration-dashboard.test.ts. Use fakeAttemptDiffState/SelfReviewContext/SelfReviewAdapterDepsfixtures the same waypackages/loopover-engine/test/self-review-adapter.test.tsalready does (an injectedrunSlopAssessment,never the real
src/signals/slop.ts).packages/loopover-engine/test/self-review-adapter.test.ts(read it for the exact fixtures/assertions tomirror), 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: mapschangedFilesto theirpaths in order, including the empty-arraycase.
buildSelfReviewSlopInput: the??fallback fordescription(presentbodyvs.undefined→null),and
hasLinkedIssuecorrectly derived fromlinkedIssues?.length ?? 0 > 0for an undefined, empty, andnon-empty
linkedIssuesarray.runSelfReview:changedPathsis always threaded through explicitly tobuildPredictedGateVerdict(neveromitted); each optional
SelfReviewContextfield (bounties,issueQuality,confirmedContributor) bothpresent and omitted; the injected
runSlopAssessmentis called with the built slop input and its result ispassed through verbatim;
passesPredictedGateistrueonly whenpredictedGateVerdict.conclusion === SELF_REVIEW_PASSING_CONCLUSIONandfalsefor every other conclusion value ("failure","action_required","neutral","skipped").Deliverables
test/unit/self-review-adapter.test.ts(vitest, imports via the engine barrel).packages/loopover-engine/src/**orpackages/loopover-engine/test/**.Test Coverage Requirements
packages/loopover-engine/src/miner/self-review-adapter.tsis insidecoverage.includeinvitest.config.tsand therefore IS subject to the 99% Codecovcodecov/patchbranch-counted gate — today itreports ~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 toCodecov, 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
packages/loopover-engine/src/miner/self-review-adapter.ts(module under test — do not modify)packages/loopover-engine/test/self-review-adapter.test.ts(the existing node:test suite to mirrorscenarios from)
test/unit/calibration-dashboard.test.ts(existing root-level vitest test following the exact pattern thisissue asks for)
vitest.config.ts(coverage.include, confirmspackages/loopover-engine/src/**/*.tsis already tracked)review-enrichment)