Repository navigation
test: fold out phantom e2e coverage regions over covered lines - #1051
Merged
Merged
Conversation
getRegionCoverage keeps one entry per branch location v8-to-istanbul emits, and v8-to-istanbul derives those locations from *generated* block boundaries mapped back through the source map. Minified output carries no mapping at most boundaries, so an endpoint snaps to whatever mapping precedes it and a block that never ran is reported as an original span that demonstrably did. At 900592b the report put src/components/hooks/useFocusTrap.js at 62.96% with a zero-count region across lines 38-40 -- the Shift+Tab wrap arm that tests/e2e/interactions.spec.js:217 presses and asserts -- while the same union put statement coverage for lines 38, 39 and 40 at 1. A span cannot go unexecuted while every line it covers executed, so multi-line zero-count regions whose every statement-carrying line is covered are no longer counted. Single-line regions are untouched: several of them share one line and the per-line fold cannot tell them apart, which is the whole reason regions are measured. Over a full local coverage run the fold removes 37 of 467 regions and lifts src files from 80.94% to 87.91%; useFocusTrap goes to 85.00% with only its three genuine single-line arms left. 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 automatically remove the |
This was referenced Oct 4, 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.
Test Improvement
getRegionCoverageintests/tools/e2e-coverage-report.mjskeeps one entry perbranch location
v8-to-istanbulemits, andv8-to-istanbulderives thoselocations from generated block boundaries mapped back through the source
map. Minified output carries no mapping at most boundaries, so an endpoint
snaps to whatever mapping precedes it, and a generated block that never ran is
reported as an original span that demonstrably did.
This adds
isPhantomRegionand filters those spans out before the per-filecounts are taken: a multi-line zero-count region whose every
statement-carrying line is covered in the union is dropped. Single-line regions
are untouched — several of them share one line and the per-line fold cannot
tell them apart, which is the whole reason regions are measured.
tests/e2e-coverage-report.test.mjsgains one regression test driving the unionwith two artifacts: one page covers every line, a second contributes a
zero-count block over covered lines 1-3 and a second one closing on line 5,
which nothing ran. The first folds out; the second and the line-5 region stay
and keep their weight in the denominator. The test fails on
main(
uncoveredRegions[1, 4, 5]instead of[4, 5]).Evidence
Reproduced at
900592bby building and running the suite locally(
npm run build:e2e:coverage, thennpm run test:e2e:coveragewithE2E_COVERAGE_DIR/E2E_COVERAGE_RUN_IDset, 298 passed) and rendering thereport. The local render matches job
End-to-end coverageof run37164361552
attempt 1 to within one region: CI 468 regions / 379 covered / 80.98%, local
467 / 378 / 80.94%, and
src/components/hooks/useFocusTrap.jsidentical inboth at 27 regions / 17 covered / 62.96%, uncovered region lines
[18, 28, 33, 35, 38, 40, 48, 51].Dumping every region key for that file over the local run:
while statement coverage over the same union puts lines 38, 39 and 40 at 1.
With the fold applied, over the same run: 37 of 467 regions removed,
src files80.94% -> 87.91%,useFocusTrap62.96% -> 85.00% with uncoveredregions
[33, 35, 51]— three genuine single-line short-circuit arms, andlines 18, 28, 38, 40 and 48 gone.
npm run test:unit:coverage:checkandnpm run check:formatpass;tests/tools/e2e-coverage-report.mjsregion coverage goes 90.68% -> 91.03%.Correction to the issue's hypothesis
The issue hypothesised that
useFocusTrapis bundled into several chunks andthat per-chunk column drift splits one branch into two keys. That is refuted:
the near-duplicate keys appear within a single chunk (
c1ce2b9c.8f0a7cfe.jsalone carries
36:6:38:24,36:6:40:21and38:24:40:21), and the threechunks carrying the file agree on their keys exactly. Keying the union by
line-plus-ordinal, as the issue suggested, would not have fixed anything.
Not in this PR
--check-source-regionsis set in.github/workflows/ci.yml, which this lanecannot push. The exact replacement line and its justification are on the issue;
the floor is unchanged here and the gate stays green either way, because the
number only rises.
Related Issue
Refs #1035 (needs-human: the
--check-source-regionsfloor lives in.github/workflows/ci.yml, which this lane's token cannot push; re-deriving itfrom the corrected number needs a human or an ISSUES_PRS_MERGE agent)
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88