Skip to content

chore(coverage): v8-ignore the bundle-unreachable fallback arms in run.ts:40, command.ts:23 and config.ts:657 - #544

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/coverage-bundle-unreachable-fallback-arms
Oct 21, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/coverage-bundle-unreachable-fallback-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Coverage annotation

npm run test:coverage:e2e on main @ 88241f4 reports three fallback arms at zero hits that no input to dist/index.js can reach. This marks each with /* v8 ignore next -- … */, the form src/utils/config.ts:219 already uses and #510 / #537 apply to the same class of arm. No behaviour changes; the unit tests that drive the arms stay. dist/ repacked (comment lines only).

record arm why the bundle cannot reach it
src/run.ts BRDA:40,2,1,0 run()'s catch: the String(error) arm Every handler folds its rejections into an Error before run() sees them (runEventHandlers at events.ts:50, normalizeError at handleIssueComment.ts:217, the jobs .catch in handlePullReq.ts:76 / handleCronJob.ts:69). The one throw that does reach this catch from the bundle — found by instrumenting the coverage bundle locally — is TypeError: body.replace is not a function from splitLines on a non-string comment body: a built-in, so an Error.
src/utils/command.ts BRDA:23,0,1,0 getLineArgs's .at(-1) ?? '' Its only callers, /milestone (milestone.ts:43) and /retitle (retitle.ts:31), run only after handleIssueComment matched the body with hasCommand for the same commandPattern, and neither has an alias in commandAliases, so findCommandArgs is never empty here.
src/utils/config.ts BRDA:657,83,1,0 normalizeSweep's e instanceof Error ? e.message : e, the non-Error arm parseDuration (duration.ts:26) throws only new Error(...).

Placement: the hint sits on the alternate of the ?: in run.ts and config.ts, so their Error arms stay measured (run.ts BRF 6 → 5 in the unit lane, the hit arm kept). @vitest/coverage-v8's AST mapper does not honour a hint on one operand of a ?? (verified with a scratch file: inline hints before/inside the logical expression change nothing), so for command.ts it sits on the return statement, as #537 did for lgtm.ts.

Files / functions claimed: src/run.ts (run, the catch), src/utils/command.ts (getLineArgs), src/utils/config.ts (normalizeSweep, the catch after parseDuration), dist/index.js. Disjoint in src/ from every open held PR: #510 is auth.ts, #537 is lgtm.ts, #528 drives events.ts:50 / handleIssueComment.ts:217 / labelSync.ts:107 for real and touches only __tests__/bundle/. dist/index.js is shared with #510 and #537; git merge-tree --write-tree HEAD pr-510|pr-537|pr-528 exits 0 for each (no textual conflict).

Verification (this branch, local)

  • npm run build && npm run lint && npm run pack: clean (the one jsdoc/check-param-names warning in cc.ts:81 is present on main); dist/index.js diff is the comment lines
  • npm run test:coverage:e2e: 83 files / 502 tests pass; coverage-e2e/lcov.info no longer carries BRDA:40 (run.ts), BRDA:23 (command.ts) or BRDA:657 (config.ts) at zero hits; branches 1636/1656 (98.79 %) → 1635/1652 (98.97 %), zero-hit records 18 → 15, every remaining one is named by an open held PR
  • npm run test:coverage: 163 files / 2206 tests pass, 100 % lines / 99.75 % branches (unchanged), thresholds met

Related Issue

Refs #523 — the hive consolidated this finding onto that tracker (already_existed: true, consolidated: true). This PR is the complete fix for the folded run.ts:40 / config.ts:657 / command.ts:23 v8 ignore entries it names; the issue's own trigger.ts boxes are #524's, so #524 is what closes it.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…n.ts, command.ts and config.ts

The e2e coverage run reports three fallback arms at zero hits that no
input to dist/index.js can reach:

- run.ts: the String(error) arm of run()'s catch. Every handler folds
  its rejections into an Error (runEventHandlers, normalizeError, the
  jobs .catch), and the only throw that reaches this catch from the
  bundle is a built-in TypeError.
- command.ts: getLineArgs's ?? '' fallback. Its callers (/milestone,
  /retitle) run only after hasCommand matched the same pattern.
- config.ts: the non-Error arm in normalizeSweep; parseDuration throws
  only Error.

Mark them with /* v8 ignore next */, the form config.ts already uses
for its test-only hooks. The hint sits on the alternate of the ?: so
the Error arms stay measured; for the ?? it has to sit on the statement
because the coverage mapper does not honour a hint on one operand of a
logical expression. No behaviour change; the unit tests that drive the
arms stay. dist/ repacked.

Refs #523

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 21, 2026 02:54
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2026
@hivecommons-hive

Copy link
Copy Markdown
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. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

@mrbobbytables mrbobbytables left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review performed under the maintainer's explicit authorization to update, review, release reviewed holds, and merge eligible PRs in this cleanup.

Reviewed the guarded getLineArgs callers and wrapped run/config failures. The annotations preserve defensive behavior; ternary ignores target only the fallback and the documented logical-expression limitation accounts for the statement-level command hint.

Verified successful build-test, e2e-coverage and DCO results on head fae60ed. Any folded issue findings remain assigned to the canonical destinations in the updated scope tables.

@mrbobbytables mrbobbytables added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind labels Oct 21, 2026
@mrbobbytables
mrbobbytables merged commit 0f21c2b into main Oct 21, 2026
18 checks passed
mrbobbytables pushed a commit that referenced this pull request Oct 26, 2026
…overage work landed (#556)

Measured npm run test:coverage:e2e on main@e3119ad with #528, #537, #544,
#548 and #549 merged: 100 / 99.46 / 100 / 100 (1686/1695 branches). The
97 floor set at 1062ce7 (97.96 measured) now sits 2.46 pp under main;
98 keeps the same just-under-main convention. 99 was considered and not
taken: it would leave 8 branches of slack, two of which are already
consumed by the negative-count await artifacts at approve.ts:504 and
auth.ts:220 that no test can recover.

Closes #551

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@mrbobbytables
mrbobbytables deleted the quality/coverage-bundle-unreachable-fallback-arms branch October 26, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant