Skip to content

test(bundle): drive /approve's membership-mode review failures and no-review cancel through dist/index.js - #355

Open
hivecommons-hive[bot] wants to merge 3 commits into
mainfrom
quality/test-approve-membership-arms
Open

hivecommons-hive[bot] wants to merge 3 commits into
mainfrom
quality/test-approve-membership-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/approveMembershipArms.test.ts (new file only; helpers.ts, bundle.test.ts, fakeGithub.ts, source and dist/ untouched). Five issue_comment runs through the committed dist/index.js against the fake GitHub, on a pull request whose repository has no OWNERS files so /approve falls back to org membership and a bot GitHub review — the failure arms of src/issueComment/approve.ts the bundle suite never reached:

run GitHub's answer expected
/approve by an org member POST …/pulls/1/reviews 500 exit 1, could not create review (L82); body {event:'APPROVE', comments:[]}
/approve cancel GET …/pulls/1/reviews 500 exit 1, could not remove latest review: Error: could not list reviews for PR 1 (L67, L160)
/approve cancel listing with no bot APPROVED review (user review, bot DISMISSED, bot COMMENTED) exit 1, no latest review found to cancel (L173), no dismissal
/approve cancel PUT …/reviews/12/dismissals 500 exit 1, could not dismiss review (L185); dismissal message names the commenter
/approve by a stranger (members 404, collaborator 404) POST …/issues/1/comments 500 exit 1 with three ::error:: lines in order: the refusal, Could not comment with an auth error: Error: could not add comment: HttpError: boom (L131), and the dispatcher's wrap of the refusal

Each test asserts the exact request sequence via expectCommandThenConfig: the OWNERS/membership reads, the command's own calls, then the post-command sweep (config reads, GET pulls/1, base-branch OWNERS probe, merge-queue query), which still runs after the failure.

Cluster: src/issueComment/approve.ts L67, 82, 131, 160, 173, 185. Disjoint from the held bundle PRs — #343 claims L44 (missing issue number) and #333 claims L96 (require_self_approval); #286 drives approve.github_review, which is the OWNERS-mode mirror, not this path.

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3)

suite issueComment/approve.ts lines branches
unit (npx vitest run --coverage) 51/51 —
e2e before (npm run test:coverage:e2e) 43/51 19/26
e2e with this PR 49/51 20/26

Remaining e2e-missed: L44 (#343) and L96 (#333). Whole-bundle e2e: 77.90 % → 78.24 % lines. npx eslint clean; 5/5 pass in ~1.3 s.

Related Issue

Closes #354


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

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

…-review cancel through dist/index.js

Adds __tests__/bundle/approveMembershipArms.test.ts: five issue_comment runs
on a pull request whose repository has no OWNERS files, where /approve falls
back to org membership and a GitHub review from the bot. Covers the refused
APPROVE review, the failed review listing, the cancel with no bot APPROVED
review, the refused dismissal, and the refusal whose comment write fails
(src/issueComment/approve.ts lines 67, 82, 131, 160, 173, 185).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 18:47
@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.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind failing-test or /kind cleanup.

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

All five cases add coverage, but one pins three whole error strings.

  • approveMembershipArms.test.ts:120–124: use toHaveLength(3) plus fragments (is not a org member or collaborator, Could not comment with an auth error) instead of toEqual on strings that contain HttpError: boom and the TypeError: wrapper.

quality added 2 commits October 7, 2026 21:50
…t the authorization.review reads

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

Copy link
Copy Markdown
Contributor Author

Addressed: the three error lines are now toHaveLength(3) plus the is not a org member or collaborator and Could not comment with an auth error fragments. The request assertion also now expects the authorization.review config reads #367 added when membership refuses. Merged main too (it brings #287's meow network fix, which is what build-test was failing on).


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

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

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's membership-mode review failures and the no-review cancel in src/issueComment/approve.ts have no end-to-end coverage

1 participant