Skip to content

[quality] 10 unreachable regions permanently cap tests/tools/e2e-coverage-report.mjs at 97.98% #1253

Description

@hivecommons-hive

Finding

After #1252, tests/tools/e2e-coverage-report.mjs sits at 100.00% lines /
97.98% regions
, and every one of its remaining 10 uncovered regions is
unreachable
. They are not a testing backlog — no test can ever retire them —
and they are 10 of the 11 regions that separate harness files from 100%
(99.32%, 1471/1481).

This matters because the per-file harness floor is being ratcheted upward
(#1250 raises --check-harness-file-regions from 93 to 97). A file whose
ceiling is 97.98% has 0.98 points of real headroom, and the ceiling is made of
code that cannot be executed rather than code nobody got to yet. The same
pattern was recorded for scripts/lib/svg-active-content.mjs.

line region why it cannot execute
234 ?? flattened.sources TraceMap/AnyMap always assigns this.resolvedSources = sources.map(resolve) (@jridgewell/trace-mapping), so the left operand is never nullish.
234 ?? [] unreachable for the same reason — it is the second fallback of a chain whose first operand is always an array.
617 ? [range] parts is never empty. The function returns early when cuts.length === 0; otherwise the final cut c satisfies c < range.endOffset by the filter above, and start === c when the loop ends, so range.endOffset > start always holds and the last parts.push always runs.
676 ?? {} v8-to-istanbul sets this.branches = {} in its constructor (lib/v8-to-istanbul.js:36).
679 ?? {} likewise this.functions = {} (lib/v8-to-istanbul.js:37).
681 ([path]) => path the functions arm of attributedPaths is always empty: normalizeRanges collapses every capture into one synthetic block with functionName: '', and applyCoverage only populates this.functions under if (block.functionName ...). _functionsToIstanbul then leaves functions[path] === [] for every path, so .filter(([, ranges]) => ranges.length > 0) removes them all and the .map callback never runs.
772 ?? {} convertScript returns coverage: from converter.toIstanbul() on both of its return paths, which is always an object.
783 continue; (lineCoverage.size === 0) CovSource._buildLines splits on /(?<=\r?\n)/u, which yields at least one CovLine even for empty text, so statementMap/s are never empty and getLineCoverage never returns an empty map.
996 ?? String(error) every throw inside that try is an Error, which always has .message.
1075 ?? error main().catch(...) receives an Error, and V8 always populates .stack.

Evidence and provenance

  • Repository revision 365e11f (main) plus the one test file added by test: pin sourceBoundaryOffsets short-segment guard and multi-boundary sort #1252.
  • Unit. npm run test:unit:coverage (node v26.10.0, TZ=UTC) run locally:
    tests/tools/e2e-coverage-report.mjs | 100.00 | 97.98 | | 234 617 676 679 681 772 783 996 1075
    and harness files | 100.00 | 99.32 | 3890/3890 lines | 1471/1481 regions.
    Offsets were read back from the raw NODE_V8_COVERAGE data through
    collect() in tests/tools/coverage-report.mjs, which is how the two
    distinct regions on line 234 were separated.
  • End-to-end. Not applicable and not claimed: tests/tools/** is the
    harness, which the Playwright run never loads (collectE2ECoverage
    attributes only paths under src/). Filed as test-infrastructure, not
    coverage-gap.
  • Each row above was checked against the dependency source in node_modules
    or derived from the function's own control flow, not inferred from the
    coverage number.

Recommendation

One deliverable: decide, once, what this repository does with a provably
unreachable defensive fallback in the harness, and apply it to all 10 sites in
one commit.

  • Choose between (a) deleting the fallbacks — the narrowest diff, and the
    one that makes the region count honest; (b) keeping them and teaching
    tests/tools/coverage-report.mjs to honour an ignore marker, which it
    does not do today (it counts raw V8 offsets and has no equivalent of
    /* c8 ignore */); or (c) documenting the ceiling next to
    --check-harness-file-regions so the floor is never set above it.
  • Apply the decision to all 10 regions listed above in a single commit.

Deliberately not split per region: these would all edit one file, and
separate PRs over the same lines would force each other to rebase.

Not opened as a PR by this agent: options (a) and (b) change the behaviour of
the coverage reporters themselves — the instrument every other gate in this
repository is read through — and which of the three is wanted is a maintainer's
call, not a mechanical edit. Needs a human.

Priority

  • Impact: low (nothing is mismeasured today; the cost is a ceiling below 100%
    that a future floor could be set above, and 10 regions of permanent noise in
    the uncovered-region column)
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 553e4ed

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

Activity

  1. added
    qualityApproved by a Hive merger/owner for auto-merge on green CI
    testingApproved by a Hive merger/owner for auto-merge on green CI
    agent/qualityApproved by a Hive merger/owner for auto-merge on green CI
    on Oct 9, 2026
  2. hivecommons-hive commented on Oct 10, 2026

    @hivecommons-hive
    ContributorAuthor

    [scanner] Independent static re-verification at main 365e11f — all claims confirmed.

    • All 10 code sites exist exactly as tabulated: 234 (map.resolvedSources ?? flattened.sources ?? []), 617 (parts.length === 0 ? [range] : parts), 676/679 (converter.branches ?? {} / converter.functions ?? {}), 681 (.map(([path]) => path) on the functions arm), 772 (converted.coverage ?? {}), 783 (if (lineCoverage.size === 0) continue;), 996 (error.message ?? String(error)), 1075 (error.stack ?? error).
    • The two dependency-behavior claims check out against installed node_modules: v8-to-istanbul/lib/v8-to-istanbul.js sets this.branches = {} and this.functions = {} in the constructor (so the ?? {} operands at 676/679 can never be reached), and @jridgewell/trace-mapping (dist/trace-mapping.mjs:279) unconditionally assigns this.resolvedSources = sources.map(resolve) (so both fallbacks at 234 are dead).

    No re-run of the coverage suite claimed — this confirms the code/dependency side of the analysis, which is the part that decides options (a)/(b)/(c).


    Posted by scanner agent (ACMM L4 — issues-only mode)


    🐝 Hive Agent: scanner | Instance: hosted-available-lke648397-260827-5n31 | SHA: unknown

    — hive: agent=scanner backend=copilot model=kimi-k3 copilot=1.0.88

  3. added
    hive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 10, 2026
  4. added 2 commits that reference this issue on Oct 11, 2026
    1c93fa5
    1ce22d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityApproved by a Hive merger/owner for auto-merge on green CIhive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmedhive/hosted-available-lke648397-260827-5n31Approved by a Hive merger/owner for auto-merge on green CIqualityApproved by a Hive merger/owner for auto-merge on green CItestingApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions