Skip to content

test(plugins): cover the error and fallback branches of lgtmBinding, ownersLabel and requireMatchingLabel - #204

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-plugin-error-paths
Sep 28, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-plugin-error-paths

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/plugins/pluginErrorPaths.test.ts (5 tests) — the only file this PR touches. Covers the five previously unexercised branches in src/plugins/{lgtmBinding,ownersLabel,requireMatchingLabel}.ts:

  • lgtmOnPullRequest binds the label as lgtm by unknown and posts no target_url when the labeled payload has neither sender nor pull_request.html_url (lgtmBinding.ts:177).
  • ownersLabel rejects with could not list the repository labels: … when GET /repos/:o/:r/labels returns 500 (ownersLabel.ts:70).
  • requireMatchingLabel rejects with github context payload missing issue or pull request when the payload has neither (requireMatchingLabel.ts:184).
  • requireMatchingLabel rejects with require-matching-label needs-kind: could not list comments: … when GET /issues/:n/comments returns 500 (requireMatchingLabel.ts:245).
  • a bot comment with body: null is treated as unmarked, so nothing is deleted on the remove path (requireMatchingLabel.ts:248).

Coverage (npm run test:coverage, origin/main 187c5e3 + this commit): lgtmBinding.ts and ownersLabel.ts 100% lines/branches (were 96.29% branches and 97.14% lines); requireMatchingLabel.ts 100% lines, 98.46% branches (was 97.7% / 95.38%; only the non-Error rejection at line 167 remains). Overall lines 96.16% → 96.29%, branches 94.55% → 94.75%. Full suite 59 files green; eslint clean. No src/ or dist/ changes.

Disjoint from #173–#202: none of those PRs touch __tests__/plugins/{lgtmBinding,ownersLabel,requireMatchingLabel}.test.ts or add a file under __tests__/plugins/ other than approveErrorPaths, tide and tideMergeQueue.

Related Issue

Closes #203


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

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

…ownersLabel and requireMatchingLabel

Adds __tests__/plugins/pluginErrorPaths.test.ts (5 tests):

- lgtmOnPullRequest binds as 'unknown' with no target_url when the
  labeled payload has no sender and no html_url (lgtmBinding.ts:177)
- ownersLabel fails with 'could not list the repository labels' when
  GET /labels returns 500 (ownersLabel.ts:70)
- requireMatchingLabel fails without an issue or pull request in the
  payload (requireMatchingLabel.ts:184)
- requireMatchingLabel names the rule when GET /issues/:n/comments
  returns 500 (requireMatchingLabel.ts:245)
- a bot comment with body: null is treated as unmarked
  (requireMatchingLabel.ts:248)

lgtmBinding.ts and ownersLabel.ts reach 100% lines and branches;
requireMatchingLabel.ts 100% lines, 98.46% branches.

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 27, 2026 12:16
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 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 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.

@github-actions

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] plugins: cover the untested error and fallback branches of lgtmBinding, ownersLabel and requireMatchingLabel

1 participant