Skip to content

fix(coverage): fold e2e regions whose spans cross across artifacts - #1163

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-e2e-coverage-crossing-regions
Oct 8, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-e2e-coverage-crossing-regions

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

What this changes

tests/tools/e2e-coverage-report.mjs now drops a zero-count region that a
covered region crosses: one that begins strictly inside the zero span and
ends strictly after it.

Two branch spans of one source file either nest or stay disjoint, because both
are AST extents. A crossing pair is not a shape the language can produce, so it
can only arise when two artifacts of the same chunk map one original branch to
different spans — which is exactly what #1079 measured:

file zero region covered twin
src/components/MemberDirectory/MemberProfile.js 10:40-10:48 10:44-15:19
src/components/MemberDirectory/MemberProfile.js 15:19-15:80 15:70-38:15
src/components/MemberDirectory/MemberCard.js 75:19-75:40 75:33-81:1

In all three the start columns differ, so the ordinal key proposed in #1066
keeps them apart, and neither span contains the other, so #1051's multi-line
fold leaves them standing.

getRegionCoverage() now keeps the start and end columns it already encoded
into the region key, which is what makes the comparison possible at all.

Why crossing and not containment

#1079's first recommendation was containment. The guard merged in #1114
established that containment is the wrong rule: a covered region that encloses
a zero one is the ordinary shape of a branch arm inside an executed block, and
GroupLinkStatus's checkedAt guard and RadarReports' empty-corpus arms are
enclosed exactly that way. Folding on enclosure would have erased real gaps that
#1094 and #1097 are writing tests for.

Crossing is strictly narrower. The test added in #1114 — "a single-line
zero-count region survives a covered region that encloses it"
— passes
unchanged, including the same-start-column case it pins.

Tests

tests/e2e-coverage-report.test.mjs gains "a zero-count region crossed by a
covered one is treated as source-map drift"
, sitting directly beneath #1114's
guard so the two shapes are read together. Its source map carries mappings at
columns 0, 3 and 6 of line 1 so that a crossing is representable at all, and the
zero region 1:0-1:6 is crossed by the covered 1:3-3:12. The drifted half is
dropped from numerator and denominator, so no file is credited for a region
nobody observed.

  • npm run test:unit — 2026 passed, 0 failed
  • npm run test:unit:coverage:check — passes; tests/tools/e2e-coverage-report.mjs
    at 100.00% lines / 93.65% regions, with every added line covered
  • npx prettier --check on both touched files — clean

Related Issue

Refs #1079 — the last completion criterion, re-deriving --check-source-regions
from the corrected number, is deliberately left open. That floor lives at
.github/workflows/ci.yml:257 (asserted by tests/workflow-scripts.test.mjs:355),
and a diff under .github/workflows/ is rejected server-side for this lane's
contributor-tier app token. Refs #1079 (needs-human: raising the e2e region
floor requires editing .github/workflows/ci.yml, which this lane cannot push).

Leaving the floor at 91 is safe in the meantime: it is a minimum, and this change
only raises the measured percentage.


Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

Two branch spans of one source file either nest or stay disjoint, because
both are AST extents. A covered span that begins inside a zero span and
ends after it is a crossing, which no source can produce; it only appears
when two artifacts of the same chunk map one original branch to different
spans.

getRegionCoverage now carries the start and end columns it already encoded
into the region key, and the report drops a zero-count region that any
covered region crosses. This folds the three regions #1079 names --
MemberProfile.js 10 and 15, MemberCard.js 75 -- which #1051's multi-line
fold and #1066's ordinal key both leave standing because their start
columns differ.

The rule is narrower than containment on purpose: a covered region that
encloses a zero one is the ordinary shape of a branch arm inside an
executed block, so enclosure is still never treated as drift and the guard
added in #1114 continues to pass unchanged.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold label Oct 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
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 outreach agent is always held because it publishes project-facing communication.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

This was referenced Oct 7, 2026
@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit dffcdba Oct 8, 2026
7 checks passed
mrbobbytables added a commit to mrbobbytables/endusers that referenced this pull request Oct 8, 2026
The last completion criterion of cncf#1079: re-derive --check-source-regions
from the corrected number after cncf#1163 folded the crossing-region
source-map drift the issue measured.

A full local run of the pipeline (build:e2e:coverage, 340 passing specs,
seal, report) at main measures source regions at 95.22% (438/460), up
from the 80.98% that set the current floor of 91's predecessor. The
three regions cncf#1079 proved executed (MemberProfile.js 10 and 15,
MemberCard.js 75) now fold, and MemberDirectory/index.js 31/34/40/43
are covered for real since cncf#1060 merged.

Following the established ratchet pattern (measured 91.63 -> floor 91
in cncf#1105), the floor becomes floor(95.22) = 95. Updated in the same
change, as tests/e2e-coverage-gate.test.mjs instructs: the workflow
gate, the FLOORS guard and its fixtures, the workflow-scripts gating
assertion, and the CONTRIBUTING.md recipe.

Closes cncf#1079

Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mrbobbytables added a commit to mrbobbytables/endusers that referenced this pull request Oct 8, 2026
…pt (cncf#1204)

V8 emits a deviation range only where a count differs from the enclosing
one, so an artifact that executes a branch arm uniformly with the code
around it records no range over the arm at all. When every truthy-path
artifact of a chunk records the arm at zero, that silence leaves the zero
standing in the union with no covered twin for the crossing fold (cncf#1163)
to catch: useFocusTrap's previousFocus arm (51:25-51:41) runs exactly once
this way on the trigger-unmounted page, yet the report counted it
uncovered.

The silence is proof, but only within one script: one script has one
source map, so identical skipped text always lands on the same original
span. isContradictedRegion therefore folds a zero region only when some
artifact of a script that recorded the zero itself covers all the
region's lines while recording no zero touching any of them. Cross-chunk
absence proves nothing (drift maps the same dead arm elsewhere), so
RadarReports' and DirectoryFreshness's genuinely dead arms survive, as
pinned by the regression tests.

Measured on a full local run: folds useFocusTrap 51:25-51:41 and
profile-links 51:33-51:45 / 53:16-53:28 (members without websites execute
those return-null arms in-browser); src regions 438/457 = 95.84%, floor
95 unchanged.

The enclosure-pinning fixture now serves its containing covered region
from a second chunk: a same-script artifact that is uniform over the arm
is V8's statement that the arm executed, which is this fold's evidence.

Closes cncf#1202

Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant