Skip to content

test(approve): cover the comment/review/notifier error throws, the no-base-ref OWNERS fallback and the notifier ordering - #192

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

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

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/plugins/approveErrorPaths.test.ts (8 tests) for src/plugins/approve.ts:

  • GET /issues/1/comments 500 → rejects could not list comments
  • GET /pulls/1/reviews 500 → rejects could not list reviews
  • PATCH /issues/comments/900 500 with a stale notifier → rejects could not update the approval notifier, posts no new comment
  • a pull request with no changed files → approve: #1 is not approved; nobody approves anything, notifier says the PR changes no files
  • labeled with no label object in the payload → debug skip, no tree request
  • payload without pull_request.base and repository.default_branch: trunk → GET /git/trees/trunk is probed via repoHasOwners and the evaluation proceeds
  • computeApproval ignores an event of unknown kind
  • renderNotifier lists files no OWNERS file covers in name order after the OWNERS files

Coverage of src/plugins/approve.ts (npx vitest run --coverage --coverage.include=src/plugins/approve.ts __tests__/plugins/approve*.test.ts): 96.9% → 100% statements/lines/functions, branches 95.7% → 97.5% (the remaining ?? '' branches at 394/400 are unreachable because find already required a non-null body). npx eslint and tsc --noEmit clean.

Files: __tests__/plugins/approveErrorPaths.test.ts only. Disjoint from #173, #175, #177, #179, #181, #183, #185, #187, #190 — none touch __tests__/plugins/approve*.

Related Issue

Closes #191


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

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

…-base-ref OWNERS fallback and the notifier ordering

Adds __tests__/plugins/approveErrorPaths.test.ts: listComments/listReviews
5xx and a failed notifier edit reject with their wrapped errors; a pull
request with no changed files logs 'nobody approves anything'; labeled
without a label object is skipped; a payload without pull_request.base
probes repository.default_branch; computeApproval ignores an unknown
event kind; renderNotifier orders files no OWNERS file covers by name.

src/plugins/approve.ts goes from 96.9% to 100% statements/lines/functions.

Closes #191

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 26, 2026 23:53
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 26, 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] approve plugin: error throws, no-base-ref OWNERS fallback and notifier ordering in src/plugins/approve.ts are untested

1 participant