Repository navigation
test(e2e-coverage): pin attribution to converter.branches and drop the dead functions arm - #1305
Merged
mrbobbytables merged 2 commits intoOct 11, 2026
Merged
Conversation
…e dead functions arm
convertScript built attributedPaths from converter.branches and
converter.functions, each behind a '?? {}' guard. Three of those regions
cannot be evaluated: v8-to-istanbul writes this.functions[path] only for a
named block (lib/v8-to-istanbul.js:167,178) and normalizeRanges rebuilds
every script's record as one block with functionName: '', so functions is
permanently {}; and both maps are initialised to {} in the constructor
(lib/v8-to-istanbul.js:36-37), so neither guard can fire.
Reduce the set to the arm that decides attribution and record why the
others are gone. Removing a guard is only safe while its premise holds and
nothing held v8-to-istanbul to this one, so tests/e2e-coverage-attribution
.test.mjs states the premises against the installed converter -- both maps
empty after load() and object-valued after applyCoverage, an anonymous
block attributing both sources through branches and none through
functions, a named block populating functions for its first range's source
only -- plus the end-to-end consequence, that a two-source bundle keeps
both sources in report.sources.
Harness region coverage 99.32% -> 99.53%; tests/tools/e2e-coverage-report
.mjs 97.98% -> 98.57%.
Closes #1304
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 |
…sidual note and re-record the ceiling The header list and tests/coverage-gate-thresholds.test.mjs both said 10 unreachable regions capped the file at 97.98%. With the convertScript guards gone the residual is 7 regions and the ceiling is 98.57% (harness files 3925/3925 lines, 1467/1474 regions). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
mrbobbytables
added a commit
that referenced
this pull request
Oct 11, 2026
Rebased onto main: src is 2777/2777 regions, the harness row now includes tests/helpers*.mjs (5336/5336 lines, 1867/1875 regions, lowest file helpers-script-sandbox.mjs at 97.06), and e2e-coverage-report.mjs's ceiling is 98.57 with 7 residual regions. All three ratcheted floors still clear. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
mrbobbytables
deleted the
quality/e2e-coverage-attribution-functions-arm
branch
October 12, 2026 13:11
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
convertScript(tests/tools/e2e-coverage-report.mjs) builtattributedPathsfrom two arms, each behind a
?? {}guard. Three of those regions can never beevaluated:
converter.functionsarm. v8-to-istanbul writesthis.functions[path]only under a truthy
block.functionName(lib/v8-to-istanbul.js:167,178), andnormalizeRangesrebuilds every script's V8 record as exactly one block withfunctionName: ''.converter.functionsis therefore permanently{}.?? {}guards.this.branches = {}andthis.functions = {}are setin the converter's constructor (
lib/v8-to-istanbul.js:36-37) and neverreassigned.
This reduces the set to the arm that actually decides attribution and records
why the others are gone, so they are not restored later as defensiveness.
Removing a guard is only safe while the premise under it holds, and nothing in
this repository held v8-to-istanbul — a pinned, Dependabot-bumped dependency —
to it. So the same change adds
tests/e2e-coverage-attribution.test.mjs, whichstates the premises against the installed converter rather than its source,
plus the end-to-end consequence:
branchesandfunctionsare{}afterload()and object-valued afterapplyCoverage, so neither needs a nullish guard;branchesand none throughfunctions;functions, for its first range's source only— non-vacuity for (2), and the reason that arm would be the weaker signal
even if
normalizeRangesever named a block;report.sources, including onewhose coverage is a single uninterrupted covered range — the case
collectE2ECoverage:786-791would drop silently, with no diagnostic, ifattribution ever stopped naming it.
No production code and no workflow changes: both files are under
tests/.Verification
At
4184f33, clean clone,npm ci, node v26.10.0,TZ=UTC:node --test tests/e2e-coverage-attribution.test.mjs→ 4 tests, 0 failures.npm run test:unit:coverage:check→ 2321 tests, 0 failures, exit0.tests/tools/e2e-coverage-report.mjs97.98% → 98.57%, its uncoveredregion lines going from
244 627 686 689 691 782 793 1017 1096to244 627 796 807 1031 1110— the 686/689/691 trio, and nothing else.npx prettier --checkclean on both files.Scope and overlap
Claims exactly one cluster: the
attributedPathsexpression inconvertScript(
tests/tools/e2e-coverage-report.mjs) and the newtests/e2e-coverage-attribution.test.mjs. Disjoint from #1303, which is onsplitRangeAtBoundariesand its line-627[range]fallback in the same file,and from #1294 (
tests/tools/coverage-report.mjs,tests/helpers*.mjsscoring)and #1298 (threshold floors in
package.json/tests/coverage-gate-thresholds.test.mjs).Related Issue
Closes #1304
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88