Repository navigation
test(e2e): credit coverage for runs that span a source boundary - #1240
Merged
Merged
Conversation
normalizeRanges rewrites a V8 record into the coarsest partition it can:
one range per run of equal counts, however far that run reaches. In a
bundle carrying several src/** modules such a run routinely starts in one
module and ends in another, and v8-to-istanbul abandons it outright --
offsetToOriginalRelative returns {} when a range's start and end map to
different originals, so applyCoverage records no branch for either module.
convertScript builds attributedPaths from exactly those branches, so the
multi-source guard in collectE2ECoverage then skips every source of the
script and coverage a browser genuinely executed is dropped.
Split each normalized range at the generated offsets where the source map
changes source, ending each sub-range one offset short of the cut so its
end position stays on the source side of the boundary. A 1:1 bundle has no
boundaries and is left byte-identical.
Replayed against the e2e-coverage artifact of run 37914482229 at b00ff4e:
src regions move from 447/466 (95.92%) to 649/665 (97.59%), uncovered
regions fall from 19 to 16, src/components/MemberDirectory/DirectoryFreshness.js
drops lines 30, 44 and 49, and src/components/MemberDirectory/utils.js
becomes measurable for the first time. Line coverage is unchanged at 100%.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 |
Member
|
Heads-up: PRs1211 1233 also edit |
mrbobbytables
added a commit
to mrbobbytables/endusers
that referenced
this pull request
Oct 11, 2026
…ide the harness floor (cncf#1287) Resolves cncf#1253 by the same route cncf#1211 took for cncf#1210: document the unreachable fallbacks rather than delete them or add an ignore marker. tests/tools/e2e-coverage-report.mjs sits at 97.98% regions and every one of its 10 uncovered regions is a defensive fallback no test can reach. The in-file note already listed eight of them; this adds the two it predates (the second fallback on the resolvedSources chain, and the parts.length === 0 arm in splitRangeAtBoundaries from cncf#1240), states the resulting ceiling, and says how the list and the floor move together. tests/coverage-gate-thresholds.test.mjs records that ceiling next to --check-harness-file-regions so the floor cncf#1250 raised to 97 is never set above what the file can measure, and refreshes the measured numbers to the suite this commit ships. Signed-off-by: Bob Killen <bkillen@linuxfoundation.org> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
tests/tools/e2e-coverage-report.mjs—convertScript/ the newsourceBoundaryOffsets+splitRangeAtBoundarieshelpers — plus a newtests/e2e-coverage-source-boundary.test.mjs. No other file is touched.The defect
normalizeRangesrewrites a V8 record into the coarsest partition it can: onerange per run of equal counts, however far that run reaches. In a bundle that
carries several
src/**modules such a run routinely starts in one module andends in another.
v8-to-istanbul cannot place that range.
offsetToOriginalRelative(v8-to-istanbul
lib/source.js) maps the start and the end back through thesource map and gives up when they disagree:
applyCoveragethen returns before recording a branch, so neither module iscredited.
convertScriptbuildsattributedPathsfrom exactly the branches andfunctions that were recorded, so the multi-source guard in
collectE2ECoveragegoes on to skip every source of that script. Coverage a browser genuinely
executed never reaches the region tally — which is the shape #1236 describes.
The fix
Split each normalized range at the generated offsets where the source map
changes source, so every sub-range lies inside one original file. Each
non-final sub-range ends one offset short of the cut, because the first offset
at a boundary already belongs to the next source and would re-trigger the
start.source !== end.sourcebail; that offset is not lost, it opens thefollowing sub-range. A 1:1 bundle has no boundaries, so no range is split and
single-source scripts are byte-identical to before.
Evidence
Replayed deterministically against the
e2e-coverageartifact11609771627(run
37914482229-1, headb00ff4e) named in #1236 — the artifact carries itsown
scripts/copies, so no browser is needed:b00ff4eas-isLine coverage is unchanged at 100.00% (2099/2099). 199 regions that the report
could not see before are now measured. Concretely,
src/components/MemberDirectory/DirectoryFreshness.jsdrops lines 30, 44 and 49from
uncoveredRegions(19 30 44 49 → 19), andsrc/components/MemberDirectory/utils.jsbecomes measurable for the first time.npm run test:unit: 2089/2089 pass. The three new tests are red without thetests/tools/change (2 fail) and green with it; the single-source test passesboth ways, which is the point of including it.
What this does not close
src/components/CommunityPeople/index.jsline 134 — the specific instrumentedcase [quality] coverage executed on e2e fixture pages is not credited: 19 src regions stay at zero across four runs #1236 opens with — is still reported uncovered after this change. The
boundary defect is real and is the bulk of the loss, but it is not the whole
of that one symptom.
--check-source-regionspast 95 in.github/workflows/ci.yml) is not here. A contributor-tier token cannot pusha diff touching
.github/workflows/**; GitHub rejects it server-side. Withthis change the measured number is 97.59, so the threshold has room to move.
Related Issue
Refs #1236 (needs-human:
src/components/CommunityPeople/index.js:134is still uncovered after this fix, and ratcheting--check-source-regionsin.github/workflows/ci.ymlneeds workflow-write permission this agent does not have)Overlap with open held PRs
tests/tools/e2e-coverage-report.mjsis also touched by #1233 (parseArgs,main) and #1211 (the constants block near the top). This diff is confined toconvertScriptand two new helpers directly above it, so it shares no hunk witheither.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88