Repository navigation
test: consolidate the tests/tools mutant premise pins - #1846
Conversation
tests/tools/e2e-coverage-run.mjs has one uncovered region, the `throw error` arm of readProvenance's parse catch. It is unreachable rather than untested: the try wraps only JSON.parse(raw), raw is bound from a 'utf8' read so it is always a string, and JSON.parse of a string throws nothing but SyntaxError. That premise is a claim about the code around the arm, so an edit that widens the try makes the re-throw live without touching its line, and nothing fails. Record the residual the way e2e-coverage-report.mjs records its own, and assert the premise the way tests/e2e-coverage-error-arms.test.mjs does for the reporter. coverage-gate-thresholds.test.mjs argued the --check-harness-file-regions floor from the reporter's note alone, calling it the lowest harness file; e2e-coverage-run.mjs sits at the same percentage with no note, so a probe that closed the reporter's residuals would let the floor rise past an undocumented ceiling. Read every harness file that carries a note instead. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
summaryMarkdown() renders the GITHUB_STEP_SUMMARY section that tells a reader of a green end-to-end job which specs flaked and that the failure behind the retry was real. tests/flaky-reporter.test.mjs asserted the heading and each generated list row, but nothing asserted the explanation between them, so Stryker left five string mutants alive: the three prose lines could each be emptied, and the two blank lines separating them from the heading and the list rewritten, with every test still passing. Assert the whole rendering for a single record instead of a phrase of it, which pins the explanation and the blank-line structure together. The sixth survivor, the constructor's this.rootDir = '' seed, is equivalent: onBegin assigns both rootDir and this.tests, and onEnd reads rootDir only when this.tests is non-empty, so the seed is never read. Annotate it per the equivalent-mutant guidance in CONTRIBUTING.md. npx stryker run --mutate 'tests/tools/flaky-reporter.mjs' before: 46 mutants, 6 survived, 86.36 after: 43 killed, 0 survived, 100.00 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
tests/tools/react-hook-driver.mjs is the dispatcher every component and hook suite renders through. Its unit line coverage is 100%, but mutation testing scored it 81.25 -- below the repository's own break: 90 -- with 15 survivors, because the suites reach it through hooks that are all shaped the same way: one useState, one useEffect, and deps that never change. Nine behaviours were therefore unasserted, each one a way the driver could be wrong while every component suite stayed green: - sameDeps compared nothing. Any two defined arrays could be called equal, pinning every memo to its first value. - A grown dependency array (['a'] to ['a', 'b']) was never compared, so only the shared prefix had to match. - Deps appearing or disappearing between renders was never exercised in either direction. - The state and effect slot lists were only ever one entry long, so an index walked the wrong way was indistinguishable from a correct one -- and a second effect stored off the end of the array would have had its cleanup skipped at unmount. - An effect returning no cleanup was never rendered, leaving both the re-run and the unmount guard untested. - A setter firing after unmount, and a setter firing during the render body, both re-entered runHookBody with nothing to notice. Add nine tests covering those. Three survivors are equivalent rather than gaps -- the rendering seed, the useRef push guard and the unmount walk's optional chain -- and carry a Stryker disable comment giving the premise that makes each unobservable. npx stryker run --mutate 'tests/tools/react-hook-driver.mjs' before: 80 mutants, 15 survived, 81.25 after: 0 survived, 100.00 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
✅ Deploy Preview for endusers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=kimi-k3 copilot=1.0.88 |
There was a problem hiding this comment.
Verified the consolidation claim mechanically: I normalized the diffs (stripped index/hunk headers) of this PR at head 439bf10 and of #1819 + #1838 + #1840, and the content is identical — every added/removed line in this PR comes from exactly one of the three originals, whose file sets are disjoint (#1819: coverage-gate-thresholds/e2e-coverage-run files; #1838: flaky-reporter pair; #1840: react-harness/react-hook-driver pair). No extra changes were smuggled in.
Spot-read the substance (e.g. the new flaky-reporter summary-explanation test asserting the full rendered markdown, and the Stryker disable next-line seed-value pin at tests/tools/flaky-reporter.mjs:148): these are reasonable premise pins behind equivalent mutants, consistent with the repo's established annotation pattern.
All checks are green on this head except End-to-end coverage, which currently fails identically on every open PR (#1844, #1847), so that's queue-wide infrastructure rather than this diff.
Looks correct to me. If this merges, #1819, #1838 and #1840 become exact no-ops against main and can be closed as superseded, as the body states.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
Consolidates three open, file-disjoint PRs that pin premises behind equivalent mutants in the
tests/tools/harness. Each original commit is cherry-picked unchanged onto currentmain.e2e-coverage-run.mjsunreachable re-throw armflaky-reporter.mjsflaky-run summary explanationreact-hook-driver.mjsslot, dependency and teardown rulesThe originals predate #1841, so their Validate checks failed on the withdrawn braces advisory.
Local verification:
npm run test:unit:coverage:check(coverage gate green),check:duplication(245/245, 33/35),check:lint,check:unused,check:spelling,prettier --checkon changed files.Supersedes #1819, #1838, #1840.