Skip to content

test(plugins): cover the non-Error rejection arm of the requireMatchingLabel error report - #227

Merged
github-actions[bot] merged 1 commit into
mainfrom
quality/test-require-matching-label-non-error
Oct 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
quality/test-require-matching-label-non-error

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Test Improvement

Adds one case to describe('requireMatchingLabel handler') in __tests__/plugins/requireMatchingLabel.test.ts: when labelIssue rejects with a non-Error value (vi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited'), the same pattern as sweep.test.ts:189), the per-rule report carries the value verbatim — require-matching-label needs-kind: rate limited. That is the String(error) arm of src/plugins/requireMatchingLabel.ts, which every octokit failure (always an Error) skips.

Reuses serveRules/serveIssue/issueEvent/kindRule; no new file, no module-wide vi.mock. The earlier separate requireMatchingLabelErrorPaths.test.ts and its "still applies the other rules" assertion were dropped on review (requireMatchingLabel.test.ts:392 already 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.

@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 29, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 29, 2026 03:35
@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 automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


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

— 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.

It hits the branch, but it's a new 64-line file for one branch that only mocks can reach.

  1. Move the case into __tests__/plugins/requireMatchingLabel.test.ts and reuse serveRules/serveIssue/issueEvent/kindRule. rulesYaml is copied word for word, and describe('requireMatchingLabel error paths') already exists in pluginErrorPaths.test.ts.
  2. Replace the file-wide vi.mock(..., { spy: true }) with vi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited'), the same pattern as sweep.test.ts:189.
  3. Assert only the needs-kind: rate limited message. "Still applies the other rules" is already covered at requireMatchingLabel.test.ts:392.

…ngLabel rule report

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot force-pushed the quality/test-require-matching-label-non-error branch from 40e7bed to 9bf3ea9 Compare October 3, 2026 05:14
@hivecommons-hive hivecommons-hive Bot added agent/quality Created by Hive for agent-filed issue provenance hive/hosted-available-lke648397-260827-5q9t Created by Hive for agent-filed issue provenance labels Oct 3, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed all three: the case now lives in requireMatchingLabel.test.ts reusing serveRules/serveIssue/issueEvent/kindRule, uses vi.spyOn(labeling, 'labelIssue').mockRejectedValueOnce('rate limited') instead of a file-wide vi.mock, and asserts only the needs-kind: rate limited message. The separate file is deleted. Rebased on main @ a270568.


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

— 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, thanks.

@jeefy

jeefy commented Oct 3, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 2026
@github-actions github-actions Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 3, 2026
@github-actions
github-actions Bot merged commit 3379060 into main Oct 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Created by Hive for agent-filed issue provenance hive/hosted-available-lke648397-260827-5q9t Created by Hive for agent-filed issue provenance 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] requireMatchingLabel: non-Error rejection arm of the per-rule error report is untested

1 participant