Repository navigation
[quality] e2e reporter's source-reference resolution has five untested branches (repoRelative root, bare webpack authority, absent sourcesContent) #1071
Description
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)returnstruefor the root directory
itself (rel === ''is explicitly accepted at line 93). The only thing that
then rejects the root isrepoRelativereturningnullfor 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 insidebuild/
instead of being rejected. - 199 / 202 / 234 —
sourcesContentis optional in the source-map spec.
Every existing fixture intests/e2e-coverage-report.test.mjssupplies it
(28 call sites, all with asourcesContentarray), so the entire
no-sourcesContentpath — read the src source from disk, blank the external
one — is unexercised. A toolchain change that stopped emitting
sourcesContentwould 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 revision900592b—
tests/tools/e2e-coverage-report.mjs100.00% lines / 90.68% regions,
uncovered regions98 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-shellfails on a missing
libglib-2.0.so.0, and installing it needs root), and the published
e2e-coverageartifact 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:
sourcePathFromReference('webpack://endusers', ...)→null(line 109).sourcePathFromReference('../../..', '<root>/build/assets/js/app.js.map', '<root>')
→null(line 98).- A
collectE2ECoveragefixture whose map declares both asrc/source
and anode_modules/source and omitssourcesContententirely, 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.
- test: make the e2e coverage artifact renderable without its build #1040 edits
convertScriptand the script-root resolution in
collectE2ECoverage; it does not touchsourcePathFromReference,
repoRelativeornormalizeSourceMap. - test: fold out phantom e2e coverage regions over covered lines #1051 edits
getRegionCoverageand the region union. - test: name the run in e2e coverage tooling-error artifacts #1070 edits
main()'s catch.
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
sourcesContentis pinned to read src content from disk and blank external sources -
tests/tools/e2e-coverage-report.mjsregion 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
test: cover the e2e reporter's source-reference resolution branches (c…