Skip to content

test: pin the e2e region fold's same-key max arm - #1142

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-region-union-max
Oct 7, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-region-union-max

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/e2e-coverage-region-union.test.mjs, pinning the same-key max arm of
getRegionCoverage (tests/tools/e2e-coverage-report.mjs:360):

if (!existing || count > existing.count) {
  regions.set(key, { line, endLine, count });
}

Two branch locations sharing one key is what the pipeline produces for every
file it measures, not a corner case. normalizeRanges flattens a V8 record into
non-overlapping ranges, so an inner zero-count range in the middle of a line
splits that line into an uncovered range and a covered remainder; both halves
resolve to the same original span, because the generated columns they start at
carry no mapping of their own. Keyed by branch id they would be two regions, one
permanently zero; keyed by coordinates they are one region the covered half
carries.

Two cases:

  • two branch locations on one original span fold to a single covered region — a fixture whose inner zero-count range stops short of the end of
    line 2, asserting the file reports 2 regions both covered rather than 3 with
    line 2 named, in the per-file rows and in the summary the merge gate reads.
  • the same file measured by both builds folds rather than doubling — the
    real build and the /e2e-coverage-variant/ build compile the same source, so
    the second script contributes the same two keys; the report stays at 2 regions
    rather than 4, with scripts.converted at 2 to show both were read.

Both were mutation-checked against main: replacing the guard with
if (!existing) (first wins) turns both red, and adding branchId to the key
turns both red.

tests/tools/e2e-coverage-report.mjs moves 92.89% → 93.15% region coverage and
line 360 leaves the uncovered-region list. npm run test:unit:coverage:check,
npm run check:spelling and npx prettier --check are all green at
7ab301e + this commit (node v26.10.0, TZ=UTC).

Scope and coordination

One new file. It does not edit tests/e2e-coverage-report.test.mjs
(occupied by #1114), tests/e2e-coverage-scripts.test.mjs (#1128),
tests/e2e-data-fixture-loader.test.mjs (#1130), or
tests/tools/e2e-coverage-report.mjs itself. Distinct from #1066 / #1079, which
are about whether the two builds emit matching coordinates in a real run; this
covers the fold that runs once they do, reachable from a unit fixture with no
variant build.

Related Issue

Closes #1141


Human review required.

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

getRegionCoverage keys a region on its original coordinates and keeps the
higher of two counts recorded against one key. normalizeRanges splits a
line carrying an inner zero-count range into an uncovered half and a
covered remainder, and both halves map back to the same original span, so
that fold is what stops every measured file carrying a phantom zero
region -- yet line 360 had no unit coverage.

Adds a fixture whose inner zero-count range stops short of the end of its
line, asserting the file reports two regions both covered rather than
three with the line named, and that the same source measured by the real
build and the variant build folds to the same two regions instead of
four.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 51d7dcd Oct 7, 2026
7 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-region-union-max branch October 7, 2026 15:18
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.

[quality] the e2e region fold's same-key max arm has no unit coverage

1 participant