test(miner-governor): close branch-coverage gaps in self-review adapter tests - #5039
Conversation
…er tests Measured coverage (node --experimental-test-coverage) showed self-review-adapter.js at only 50% branch coverage despite the existing suite looking thorough -- four optional-field ternary spreads and one ?.length ?? 0 fallback each had only one side exercised. Add targeted tests for the untaken branches; file now measures 100/100/100 (lines/branch/funcs).
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | abaf95f | Commit Preview URL Branch Preview URL |
Jul 11 2026, 09:51 AM |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 09:53:52 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 4 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Follow-up to #2334 (#5034, merged). Real coverage measurement via
node --experimental-test-coverage(not just visual test-suite review) foundself-review-adapter.jsat only 50% branch coverage despite the existing suite looking thorough on read-through:buildSelfReviewPredictedGateInput's four optional-field conditional spreads (body,labels,linkedIssues,authorAssociation) each only had one side of their ternary exercised (the tests always used a diff state that set some fields and omitted others, but never varied it across both directions for the same field).buildSelfReviewSlopInput's(diffState.linkedIssues?.length ?? 0) > 0fallback chain was only exercised withlinkedIssues: [], never withlinkedIssues: undefined-- a distinct branch.runSelfReview's three optional context-field spreads (bounties,issueQuality,confirmedContributor) were never exercised with those fields actually set.Adds four targeted tests closing all 8 zero-hit branches identified via LCOV
BRDAanalysis. No production code changes -- test-only.Validation
npm run build && npx tsc -p tsconfig.test.json && node --experimental-test-coverage --test "dist-test/**/*.test.js"-- 400/400 tests pass.self-review-adapter.jscoverage: 100.00% lines / 100.00% branch / 100.00% funcs (was 50% branch before this PR).Test plan
node:testtests pass (400/400).