Skip to content

test(bundle): drive the missing issue/pull number guards of every command handler and onPrLgtm through dist/index.js - #343

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-missing-number-guards
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-missing-number-guards

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/missingNumberGuards.test.ts (27 tests), driving through dist/index.js the one arm every command handler shares and no bundle fixture had ever reached: the github context payload missing issue number guard (pull number in cc.ts/uncc.ts, pr number in onPrLgtm.ts) thrown before the first API call.

Claimed ground — exactly these 18 statements, all at 0 end-to-end hits on main @ 3fc21f2 and still at 0 after overlaying every open hold-gated bundle PR (#242–#341):

src/issueComment/{assign.ts:29, unassign.ts:25, cc.ts:26, uncc.ts:25, approve.ts:44, retitle.ts:26, close.ts:24, lock.ts:33, reopen.ts:21, milestone.ts:28, meow.ts:35, trigger.ts:207 (prepare)}, src/labels/{remove.ts:25, hold.ts:30, lgtm.ts:39, fixed.ts:70, prefixed.ts:146}, src/pullReq/onPrLgtm.ts:19.

  • For each of /assign /unassign /cc /uncc /approve /retitle /remove /hold /lgtm /close /lock /reopen /milestone /meow /retest /help /kind: an issue_comment payload with issue.number deleted exits 1 and core.setFailed carries error handling issue comment: Error: github context payload missing issue|pull number: [object Object].
  • For the hand-written commands that read nothing before the guard (/assign /cc /retitle /close /lock /reopen /milestone /meow /retest): the fake GitHub receives no request.
  • jobs: lgtm on a pull_request synchronize payload with pull_request.number deleted fails with error handling pull request: Error: github context payload missing pr number.

Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/ 77.9 % → 79.16 % lines; all 18 listed statements go from 0 to ≥1 hits. The file passes against both the committed dist/index.js (npx vitest run __tests__/bundle/missingNumberGuards.test.ts) and the source-mapped coverage bundle; eslint and tsc --noEmit clean. No src/, dist/ or workflow changes.

Related Issue

Closes #342


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

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

…mand handler and onPrLgtm through dist/index.js

Every command handler throws 'github context payload missing issue number'
(pull number in cc/uncc, pr number in onPrLgtm) before its first api call
when the payload carries no number. The unit suite reaches all 18 guards;
the bundle suite never did because every fixture carries a number.

Delete issue.number from the issue_comment fixture for each command (and
pull_request.number from the synchronize payload for the lgtm job) and
assert the guard's message reaches core.setFailed, with no api request for
the hand-written commands that read nothing before the guard.

Closes #342

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 6, 2026 06:36
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 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. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

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

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] the 18 missing-issue/pull-number guards across the command handlers and onPrLgtm have no end-to-end coverage through dist/index.js

0 participants