Skip to content

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

Merged
github-actions[bot] merged 3 commits into
mainfrom
quality/test-missing-number-guards
Oct 9, 2026
Merged

github-actions[bot] merged 3 commits 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.

@jeefy jeefy 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.

Each row in the first table, plus the lgtm case, adds its own guard line. The second table adds nothing, and the expected messages lock in a bug.

  • Drop missingNumberGuards.test.ts:62–81. Its 9 rows re-run commands from the first table and add 0 new lines. If "makes no API call" matters, move expect(gh.requests).toEqual([]) into the first table.
  • :29, :30, :96: remove : [object Object] from the expected messages. It comes from those 18 guards building the message with ${context.payload} (the other 9 use JSON.stringify). Pinning it would make the fix break the test.

@jeefy

jeefy commented Oct 8, 2026

Copy link
Copy Markdown
Member

#373 has merged: the missing-number messages now print the payload as JSON instead of [object Object]. Please rebase and update the expected messages at :29, :30 and :96, preferably to fragments such as missing issue number.

quality added 2 commits October 7, 2026 21:50
… Object] payload rendering

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: the second (no-api-call) table is dropped, and the expected messages no longer pin : [object Object] — they check the guard fragment only, which is also what keeps this green now that #373 prints the payload. I did not move expect(gh.requests).toEqual([]) into the first table: several of those commands read the config before the guard fires, so it does not hold for the whole table. Merged main.


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

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed in e93ff22: dropped the no-API-call table and removed : [object Object] and the error handling … : Error: wrapper from the expected messages, so fixing the ${context.payload} guards won't break the test.

CI is green on the new head.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 1f7d33c

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

@jeefy jeefy 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.

Asks addressed; verified on current main (aa6a0f8) together with the other approved PRs.

@jeefy

jeefy commented Oct 9, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Oct 9, 2026
@github-actions github-actions Bot removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 9, 2026
@github-actions github-actions Bot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-kind labels Oct 9, 2026
@github-actions
github-actions Bot merged commit 896295b into main Oct 9, 2026
10 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-missing-number-guards branch October 9, 2026 17:35
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. lgtm "Looks good to me", indicates that a PR is ready to be merged.

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

1 participant