Skip to content

[quality] prefixed label commands' and /remove's failure arms are never driven through dist/index.js #340

Description

@hivecommons-hive

Finding

src/labels/prefixed.ts and src/labels/remove.ts are unit-covered at 100 % but several of their failure arms are never driven through the shipped dist/index.js.

Measured with npm run test:coverage:e2e on main @ 3fc21f2 (Node v26.10.0, vitest 5.0.1, @vitest/coverage-v8 5.0.1; the five __tests__/bundle/*.test.ts suites, 142 tests):

file e2e lines e2e-uncovered lines arm
src/labels/prefixed.ts 90.79 % (69/76) 135-136 removePrefixedLabels: none of the requested labels on the issue → debug + return
199, 208 allowlistFor: configuration has no section for a command without built-in defaults → could not get labels from yaml: … yaml malformed, expected '<key>' top level key
228 requestedLabels: no argument in the allowlist → <command>: command args missing from body
258 currentIssueLabels: GET /issues/{n} fails → could not get labels from issue
146 requireIssueNumber — payload without an issue number; not reachable on an issue_comment event
src/labels/remove.ts 83.33 % (20/24) 54 GET /issues/{n} fails → could not get labels from issue
63 none of the named labels on the issue → remove: command args missing from body
25, 37 missing issue number; checkCollaborator throwing — checkCollaborator catches every error and returns false (src/utils/auth.ts:88-102), so neither is reachable

Unit evidence: npx vitest run --coverage on the same revision reports both files at 100 % statements/branches/functions/lines (__tests__/label/prefixed.test.ts, __tests__/label/remove.test.ts). Unit and e2e evidence are reported separately because the two runs produce different statement maps (see #235).

Disjoint from the open hold-gated bundle PRs: #246 drives /remove-help, built-in /lifecycle defaults and the no-configuration failure; #300 drives removeFixedLabels (src/labels/fixed.ts); #337 drives labelIssue's refused write (src/utils/labeling.ts:88); none drives the prefixed-command or /remove arms above.

Recommendation

Add a bundle suite __tests__/bundle/prefixedRemoveArms.test.ts that runs dist/index.js on issue_comment against fakeGithub.ts for:

  • /kind cleanup with a configuration lacking a kind section → exit 1, could not get labels from yaml: Error: kind: yaml malformed, expected 'kind' top level key, no labels read
  • /kind not-allowed → exit 1, kind: command args missing from body, no labels read or written
  • /remove-kind cleanup with no kind/* label on the issue → exit 0, no DELETE
  • /remove-kind cleanup with GET /issues/1 → 500 → exit 1, could not get labels from issue
  • /remove foo by a collaborator with GET /issues/1 → 500 → exit 1, could not get labels from issue
  • /remove foo by a collaborator when the issue does not carry foo → exit 1, remove: command args missing from body

Priority

  • Impact: medium — covered by unit tests but not end-to-end
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 9952fba

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

No activity

Activity on this issue will appear here.

Activity

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 provenanceneeds-kindqualityCreated 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