Repository navigation
test(plugins): cover the non-Error rejection arm of the requireMatchingLabel error report - #227
Conversation
|
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 Hive will automatically remove the |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
It hits the branch, but it's a new 64-line file for one branch that only mocks can reach.
- Move the case into
__tests__/plugins/requireMatchingLabel.test.tsand reuseserveRules/serveIssue/issueEvent/kindRule.rulesYamlis copied word for word, anddescribe('requireMatchingLabel error paths')already exists inpluginErrorPaths.test.ts. - Replace the file-wide
vi.mock(..., { spy: true })withvi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited'), the same pattern assweep.test.ts:189. - Assert only the
needs-kind: rate limitedmessage. "Still applies the other rules" is already covered atrequireMatchingLabel.test.ts:392.
…ngLabel rule report Signed-off-by: quality <quality@hive.kubestellar.io>
40e7bed to
9bf3ea9
Compare
|
Addressed all three: the case now lives in 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
/kind cleanup |
Test Improvement
Adds one case to
describe('requireMatchingLabel handler')in__tests__/plugins/requireMatchingLabel.test.ts: whenlabelIssuerejects with a non-Error value (vi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited'), the same pattern assweep.test.ts:189), the per-rule report carries the value verbatim —require-matching-label needs-kind: rate limited. That is theString(error)arm ofsrc/plugins/requireMatchingLabel.ts, which every octokit failure (always anError) skips.Reuses
serveRules/serveIssue/issueEvent/kindRule; no new file, no module-widevi.mock. The earlier separaterequireMatchingLabelErrorPaths.test.tsand its "still applies the other rules" assertion were dropped on review (requireMatchingLabel.test.ts:392already covers the latter).Verification on
main@ a270568:npx eslint,npx tsc --noEmit,npx vitest run __tests__/plugins/requireMatchingLabel.test.ts— 50 pass.Related Issue
Closes #226
Filed by quality agent (hold-gated mode). Human review required.