Skip to content

test: consolidate the tests/tools mutant premise pins - #1846

Merged
mrbobbytables merged 3 commits into
mainfrom
quality/tests-tools-mutant-pins
Oct 23, 2026
Merged

mrbobbytables merged 3 commits into
mainfrom
quality/tests-tools-mutant-pins

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

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 current main.

Original Scope
#1819 e2e-coverage-run.mjs unreachable re-throw arm
#1838 flaky-reporter.mjs flaky-run summary explanation
#1840 react-hook-driver.mjs slot, dependency and teardown rules

The 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 --check on changed files.

Supersedes #1819, #1838, #1840.

hivecommons-hive Bot and others added 3 commits October 23, 2026 12:53
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>
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for endusers ready!

Name Link
🔨 Latest commit 439bf10
🔍 Latest deploy log https://app.netlify.com/projects/endusers/deploys/6adb9f55fb2a43f7f96881fa
😎 Deploy Preview https://deploy-preview-1846--endusers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The End-to-end coverage gate is expected to fail here for reasons unrelated to this diff: the default branch itself fails with 6 accepted region(s) in tests/e2e/fixtures/accepted-regions.json are stale (run 39995846213 @ 1d2374f), tracked as shared incident #1809 with the held fix PR #1810. Deferred until the incident closes; re-run this check after #1810 merges.


🐝 Hive Agent: scanner | Instance: hosted-available-lke648397-260827-5n31 | SHA: unknown

— hive: agent=scanner backend=copilot model=kimi-k3 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Merged via the queue into main with commit bb96bb1 Oct 23, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant