You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[quality] handlePullReq 'None found' setFailed arm is unreachable in dist/ — pullRequestHandlers is a static non-empty const #450
src/pullReq/handlePullReq.ts:44-48 still carries the pre-plugin-registry failure arm:
if(runConfig.length===0){if(pullRequestHandlers.length===0){core.setFailed('please provide a list of space delimited commands / jobs to run. None found')}return}
pullRequestHandlers is declared six lines above (handlePullReq.ts:18) as a const array of seven handlers (requireMatchingLabel, ownersLabel, blunderbuss, lgtmOnPullRequest, approveOnPullRequest, okToTestOnPullRequest, tideOnPullRequest). Nothing in src/ mutates it, so pullRequestHandlers.length === 0 can never be true in the shipped dist/index.js and the setFailed call is dead.
It only counts as covered because the unit suite empties the registry to reach it:
__tests__/pullReqTest/handlePullReq.test.ts — snapshots registeredHandlers = [...pullRequestHandlers], clears the array in setup, and asserts setFailed is called exactly once with the None found message.
__tests__/pullReqTest/readOnlyFork.test.ts:73-78 — same length = 0 / restore pattern.
npm run test:coverage:e2e (72 files / 452 tests, bundle run against dist/index.js): handlePullReq.ts line 46 is the only uncovered statement in the file.
This is the same finding class as #366 (fixed by #421): production code that nothing in the action can execute, kept green by a unit test that exists only to exercise it. The generic handlers.length === 0 debug no-op in src/utils/events.ts:48 is a different case — runEventHandlers is shared by four registries and that guard is reasonable to keep.
Recommendation
One PR:
Drop the inner if (pullRequestHandlers.length === 0) { core.setFailed(...) } from handlePullReq.ts, leaving if (runConfig.length === 0) return (or fold it into the switch below).
Remove the None found assertion test in __tests__/pullReqTest/handlePullReq.test.ts and the pullRequestHandlers.length = 0 scaffolding it needed; keep the "does not fail when no jobs are configured but a handler is registered" case.
Check whether readOnlyFork.test.ts:73-78 still needs to clear the registry once the arm is gone (it may — it isolates the fork short-circuit from the real handlers), and leave it if so.
npm run pack so dist/ matches.
Priority
Impact: low (dead code; no behaviour change, slightly misleading unit coverage)
Finding
src/pullReq/handlePullReq.ts:44-48still carries the pre-plugin-registry failure arm:pullRequestHandlersis declared six lines above (handlePullReq.ts:18) as aconstarray of seven handlers (requireMatchingLabel, ownersLabel, blunderbuss, lgtmOnPullRequest, approveOnPullRequest, okToTestOnPullRequest, tideOnPullRequest). Nothing insrc/mutates it, sopullRequestHandlers.length === 0can never be true in the shippeddist/index.jsand thesetFailedcall is dead.It only counts as covered because the unit suite empties the registry to reach it:
__tests__/pullReqTest/handlePullReq.test.ts— snapshotsregisteredHandlers = [...pullRequestHandlers], clears the array in setup, and assertssetFailedis called exactly once with theNone foundmessage.__tests__/pullReqTest/readOnlyFork.test.ts:73-78— samelength = 0/ restore pattern.Evidence (
main@511bd12, local runs 2026-10-11):npx vitest run --coverage(151 files / 2089 tests): 100 % statements,handlePullReq.tsfully covered.npm run test:coverage:e2e(72 files / 452 tests, bundle run againstdist/index.js):handlePullReq.tsline 46 is the only uncovered statement in the file.coverage-final.jsonfiles: this is one of a handful of residual e2e-only lines; the others are test-onlyreset*()helpers or ground already held by refactor(auth): drop the 14 unreachable commenter-auth catch wrappers #449.This is the same finding class as #366 (fixed by #421): production code that nothing in the action can execute, kept green by a unit test that exists only to exercise it. The generic
handlers.length === 0debug no-op insrc/utils/events.ts:48is a different case —runEventHandlersis shared by four registries and that guard is reasonable to keep.Recommendation
One PR:
if (pullRequestHandlers.length === 0) { core.setFailed(...) }fromhandlePullReq.ts, leavingif (runConfig.length === 0) return(or fold it into the switch below).None foundassertion test in__tests__/pullReqTest/handlePullReq.test.tsand thepullRequestHandlers.length = 0scaffolding it needed; keep the "does not fail when no jobs are configured but a handler is registered" case.readOnlyFork.test.ts:73-78still needs to clear the registry once the arm is gone (it may — it isolates the fork short-circuit from the real handlers), and leave it if so.npm run packsodist/matches.Priority
Filed by quality agent (hold-gated mode)
🐝 Hive Agent:
quality| Instance:hosted-available-lke648397-260827-5q9t| SHA:511bd12— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88