Repository navigation
test(e2e): cover the e2e coverage reporter's partial-capture fallbacks - #1209
Merged
Merged
Conversation
tests/tools/e2e-coverage-report.mjs was the lowest-scoring file in the harness tree at 93.65% regions. What Playwright's coverage.stopJSCoverage() hands back over CDP is not guaranteed-shaped -- a page torn down mid-navigation contributes an entry with no `functions`, a script the browser never entered contributes a function with no `ranges`, a worker that failed before the capture writes a `v8-coverage-error` artifact instead -- and collectE2ECoverage() reads all of it through `??` fallbacks that no test exercised. tests/e2e-coverage-partial-capture.test.mjs drives each shape by writing the artifact a browser would have written, because none of the readers is exported and collectE2ECoverage() is the only way in. The tests pin which shapes are fatal and which are not: a partial *capture* must not fail the run, because artifacts are written per page by parallel workers and one degenerate page would otherwise discard every measurement beside it, while a capture *error* must fail it, because that means a page's coverage is missing rather than empty and scoring the run without it reports a percentage over a denominator that silently lost a page. The error message is covered field-by-field down to a payload carrying nothing but its kind, which is exactly the case where the operator has least to go on. One more region: uncovered lines are now asserted to come back in ascending numeric order, with multi-line function bodies so an unexecuted function leaves whole lines uncovered rather than a sub-line region. That list is what the text artifact prints, and a default lexicographic sort would put 10 before 4 on any file long enough for the list to matter. tests/tools/e2e-coverage-report.mjs: 93.65% -> 95.41% regions (lines stay at 100.00%). Measured with `npm run test:unit:coverage` (node v26.10.0, TZ=UTC) at 593b9fe. No production code changes; no gate threshold is touched. Signed-off-by: quality <quality@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1208.
What
Adds one new test file,
tests/e2e-coverage-partial-capture.test.mjs(8 tests). No production code changes, no gate threshold changes.
tests/tools/e2e-coverage-report.mjswas the lowest-scoring file in theharness tree. Every one of its gaps is a sub-line region — the file sits at
100.00% lines — so the line gates could not see any of them.
tests/tools/e2e-coverage-report.mjsregionsHow
The readers are not exported, so the tests go in through
collectE2ECoverage()by writing the artifact a browser would have written:functionsrangesresultarray — counted as zero captured scripts,and the healthy artifact beside it still reported
v8-coverage-errorcases, degrading the message fieldby field down to a payload carrying nothing but its
kind, asserting thereport fails each time
all produce a single uncovered line, so the comparator never ran)
Two notes for the reviewer:
collectE2ECoverage()throwsNo src/** coverage was attributablewhennothing executable is measured, so each degenerate artifact is paired with
a healthy one in the same run. That is the only way to assert the
degenerate shape is survived rather than merely fatal.
the sort comparator uses multi-line bodies to produce genuinely uncovered
lines.
Remaining gap
18 regions stay uncovered. They sit behind non-exported readers
(
getLineCoverage,getRegionCoverage,isPhantomRegion,isContradictedRegion) that consume istanbul objects produced byv8-to-istanbul, so their malformed-shape guards cannot be driven from thepublic surface at all. That is a separate deliverable — either export those
readers for direct unit testing or document them as unreachable — and is
filed separately rather than forced into this PR.
Files claimed
tests/e2e-coverage-partial-capture.test.mjs(new) — nothing else.Disjoint from the open hold-gated PRs: #1206 touches
scripts/svg-active-content.mjs, #1203 touchestests/tools/e2e-coverage-builds.mjs, and #1207 touchestests/tools/coverage-report.mjs+package.json. Verified withgh pr view <n> --json files. In particular this PR deliberately does notratchet
--check-harness-file-regionsfrom 93 to 95, becausepackage.jsonand
tests/coverage-gate-thresholds.test.mjsare claimed by #1207; thatratchet belongs in a follow-up once #1207 lands.
Verification
npm run test:unit:coverage:check— exits 0npm run check— exits 0node v26.10.0, TZ=UTC, cut from
origin/main@593b9fe.Held for human review.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88