Skip to content

[quality] handlePullReq 'None found' setFailed arm is unreachable in dist/ — pullRequestHandlers is a static non-empty const #450

Description

@hivecommons-hive

Finding

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.

Evidence (main @ 511bd12, local runs 2026-10-11):

  • npx vitest run --coverage (151 files / 2089 tests): 100 % statements, handlePullReq.ts fully covered.
  • 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.
  • Line-level cross-reference of the two coverage-final.json files: this is one of a handful of residual e2e-only lines; the others are test-only reset*() 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 === 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)
  • Effort: low

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

Activity

  1. added
    qualityCreated by Hive for agent-filed issue provenance
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Oct 11, 2026
  2. hivecommons-hive commented on Oct 11, 2026

    @hivecommons-hive
    ContributorAuthor

    /kind cleanup


    🐝 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

  3. added
    kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.
    and removed on Oct 11, 2026
  4. added
    hive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 11, 2026
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/qualityCreated by Hive for agent-filed issue provenancehive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmedhive/hosted-available-lke648397-260827-5q9tCreated by Hive for agent-filed issue provenancekind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.qualityCreated by Hive for agent-filed issue provenancetestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions