Skip to content

[quality] e2e reporter's source-reference resolution has five untested branches (repoRelative root, bare webpack authority, absent sourcesContent) #1071

Description

@hivecommons-hive

Finding

Five reachable branches in the reference-resolution path of
tests/tools/e2e-coverage-report.mjs have no unit coverage. That path is the
containment gate that decides which source files e2e coverage is attributed to,
so its untested arms are the ones that would silently mis-attribute or silently
drop coverage.

At 900592b the file reports 100.00% lines / 90.68% regions, with these
among the uncovered regions:

line branch what is untested
98 rel === '' || rel.startsWith('..') in repoRelative a reference resolving to the repository root itself
109 slash === -1 ? '' : value.slice(slash) in sourcePathFromReference webpack://<authority> with no path after the authority
199 map.sourcesContent?.[index] ?? null in normalizeSourceMap a map carrying no sourcesContent array at all
202 sourcesContent.push(suppliedContent ?? '') blanking an external source when no content was supplied
234 sourcesContent.push(suppliedContent ?? diskContent) reading a src source from disk when no content was supplied

Why these matter

  • 98 — isInside(root, candidate) returns true for the root directory
    itself (rel === '' is explicitly accepted at line 93). The only thing that
    then rejects the root is repoRelative returning null for an empty
    relative path. Nothing exercises that arm, so the guard that stops the
    repository root being treated as a source file is unpinned.
  • 109 — a webpack:// reference with no slash after the authority yields an
    empty path. If that arm regressed to returning the unsliced value, the
    reference would resolve against the map's own directory inside build/
    instead of being rejected.
  • 199 / 202 / 234 — sourcesContent is optional in the source-map spec.
    Every existing fixture in tests/e2e-coverage-report.test.mjs supplies it
    (28 call sites, all with a sourcesContent array), so the entire
    no-sourcesContent path — read the src source from disk, blank the external
    one — is unexercised. A toolchain change that stopped emitting
    sourcesContent would exercise it for the first time in CI.

Note that line 188 (map.resolvedSources ?? flattened.sources ?? []) is also
reported uncovered but appears unreachable, since AnyMap always populates
resolvedSources. It is deliberately excluded from this issue.

Evidence and provenance

  • Unit: npm run test:unit:coverage (TZ=UTC node tests/tools/coverage-report.mjs,
    node v26.10.0), run locally at revision 900592b —
    tests/tools/e2e-coverage-report.mjs 100.00% lines / 90.68% regions,
    uncovered regions 98 109 188 199 202 234 255-256 301 303 318-319 322 325-327 329 331 405 408 410 424 485 495 497 509 520 549 565 708 751.
  • This is a unit branch-coverage gap in test tooling. No claim is made here
    about any source path's end-to-end coverage: Playwright could not be launched
    in this environment (chrome-headless-shell fails on a missing
    libglib-2.0.so.0, and installing it needs root), and the published
    e2e-coverage artifact cannot be rendered without the build that produced
    it — which is the subject of the already-open test: make the e2e coverage artifact renderable without its build #1040.

Recommendation

Add three cases to tests/e2e-coverage-report.test.mjs:

  1. sourcePathFromReference('webpack://endusers', ...) → null (line 109).
  2. sourcePathFromReference('../../..', '<root>/build/assets/js/app.js.map', '<root>')
    → null (line 98).
  3. A collectE2ECoverage fixture whose map declares both a src/ source
    and a node_modules/ source and omits sourcesContent entirely, asserting
    the src source is still attributed with the right per-line counts
    (lines 199, 202, 234).

Measured effect of exactly these three: regions 90.68% → 92.23%, with 98 109 199 202 234 leaving the uncovered list and nothing else changing. Repository
region total 94.87% → 94.94%, against the --check-regions 94 floor.

No production change is needed; this is test-only.

Coordination

Appends to tests/e2e-coverage-report.test.mjs and changes no .mjs tooling.

All three also append to this test file, so the only possible interaction is an
append-order rebase, not a logic conflict.

Completion criteria

  • A webpack:// reference with no path after the authority is pinned as rejected
  • A reference resolving to the repository root is pinned as rejected
  • A map omitting sourcesContent is pinned to read src content from disk and blank external sources
  • tests/tools/e2e-coverage-report.mjs region coverage rises and lines 98, 109, 199, 202 and 234 leave the uncovered list

Priority

  • Impact: medium (untested arms of the containment gate that decides e2e coverage attribution)
  • Effort: low

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 900592b

— 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
    hive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 5, 2026
  2. added a commit that references this issue on Oct 8, 2026
    8afaa67
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