Repository navigation
[quality] the coverage-run CLI's non-Error rejection fallback is its only uncovered region #1173
Description
Finding
tests/tools/e2e-coverage-run.mjs is the only file in tests/tools/ below 100%
region coverage that is not already claimed by an open PR, and its single
uncovered region is the ?? error fallback in the CLI entrypoint's rejection
handler:
205 if (
206 process.argv[1] &&
207 import.meta.url === pathToFileURL(process.argv[1]).href
208 ) {
209 main().catch((error) => {
210 console.error(error.stack ?? error); // line 211: `?? error` never taken
211 process.exitCode = 1;
212 });
213 }tests/e2e-coverage-run.test.mjs:229 already spawns the tool with a bogus
command and asserts status === 1 and the message on stderr. main() throws
new Error(...) there, so that case covers the error.stack side and leaves
the fallback beside it unexecuted.
The fallback is not decoration. .github/workflows/ci.yml:231 and
:248 run this tool as a command — node tests/tools/e2e-coverage-run.mjs init
and ... seal — and its stderr is the only account the End-to-end coverage
job gives of why it stopped. A rejection that is not an Error has no .stack;
without the fallback the job log would read undefined and nothing else, which
is the diagnosability regression the sibling case was written to prevent for the
Error path.
Evidence and provenance
-
Unit — not covered.
npm run test:unit:coverage
(TZ=UTC node tests/tools/coverage-report.mjs, node v26.10.0) run locally on
2026-10-07 at03cfcfereports:tests/tools/e2e-coverage-run.mjs | 100.00 | 98.65 | | 211 -
End-to-end — not applicable, and deliberately not claimed. This file is
test tooling, not a site source. The e2e reporter's source set issrc/**:
CI artifacte2e-coverage, id11492367935, from run
37641752914,
workflowValidate repository, jobEnd-to-end coverage, head
03cfcfeb9ea28e9b1cdb55ef0a9514daccfe747e—report.txtnames onlysrc/
paths and does not list this file at all. There is therefore no end-to-end
evidence to read for it either way, and none is asserted here. -
Because the path carries no end-to-end coverage mechanism rather than
failing one, this is recorded as a unit-only gap at priority 2. It is not
claimed as "covered by neither", which would require end-to-end evidence this
repository does not produce fortests/tools/**.
Why no other open PR covers it
Checked against every open hold-gated PR at the time of filing: #1163 edits
tests/tools/e2e-coverage-report.mjs and tests/e2e-coverage-report.test.mjs;
#1171 edits tests/tools/e2e-data-fixtures.cjs,
tests/e2e/fixtures/data-variants/metrics.json,
tests/e2e-data-fixtures.test.mjs and three metrics specs; #1165 edits
tests/architecture-content-mirror.test.mjs; #1161 edits scripts/audit-gate.mjs;
#1166 edits CONTRIBUTING.md; #1168 is src/-side security work. None of them
touches tests/tools/e2e-coverage-run.mjs or tests/e2e-coverage-run.test.mjs.
Recommendation
Reaching the fallback needs main() to reject with a stackless value, which the
tool's own code never does — every throw in it is new Error(...). A
--import prelude makes the one host call main() issues on its success path,
the process.stdout.write() of the manifest, throw a bare string, so the
rejection arrives at the entrypoint in exactly the shape a non-Error would.
The init itself succeeds first, which keeps the case about the reporting path
rather than about the command.
- a case in
tests/e2e-coverage-run.test.mjsspawns the tool so that
main()rejects with a non-Error, and asserts stderr carries the thrown
value rather thanundefined, with exit status 1 -
tests/tools/e2e-coverage-run.mjsreports 100% region coverage
No workflow file is involved: the gate is
npm run test:unit:coverage:check (package.json:70), whose thresholds are
unchanged by this.
Priority
- Impact: medium (the CI job that gates end-to-end coverage loses its only
failure diagnostic for any rejection this module does not raise itself) - Effort: low
🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 03cfcfe
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88
Activity