Repository navigation
test(bundle): drive the approve.github_review refusals, short-circuits and failures through dist/index.js - #286
Conversation
…s and failures through dist/index.js Adds __tests__/bundle/approveReview.test.ts: /approve and /approve cancel against the fake GitHub with approve.github_review enabled, routing POST /pulls/1/reviews, PUT .../dismissals and GET /user to the answers src/plugins/approveReview.ts handles — 422 not-permitted, other 403, self-approval refusal, a user token that authored the pull request, a draft, a review already on the head, a refused dismissal, an unidentifiable token and a hard createReview failure — and asserts the warning or error text, the exit status and that the approved label is written first. approveReview.ts end-to-end line coverage (npm run test:coverage:e2e): 65.38% -> 92.3%. Signed-off-by: quality <quality@hive.kubestellar.io>
|
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 keep the |
|
The red 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
build-test triage for the red run on 9173f6c (run 37157845384):
🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
The previous run failed only on the pre-existing unhandled TLS error from __tests__/issueCommentTest/meow.test.ts (fixed separately in #287); every test in this PR passed. Signed-off-by: quality <quality@hive.kubestellar.io>
|
CI triage for Root cause is the status-only msw mock passthrough socket tracked in #284 and fixed by #287 ( 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
The red 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
/kind cleanup |
🔒 Hold-gate integrity: branch changed while hold-gated — fresh review requiredThis PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was Commits not present in the hold-time snapshot (1):
A human should review the FULL diff at the current head — a rebase or force-push renames every commit, so everything above needs eyes even if it looks familiar. Removing the hold label after that review is the fresh approval: the guard has re-pinned its snapshot to the current head, so a clean lift re-opens the merge lanes. |
|
/lgtm |
Test Improvement
Adds
__tests__/bundle/approveReview.test.ts, which drives/approveand/approve cancelthrough the committeddist/index.jswithapprove.github_review: trueagainst the fake GitHub and routesPOST …/pulls/1/reviews,PUT …/reviews/71/dismissalsandGET /userto the answerssrc/plugins/approveReview.tshas to handle. Nine cases, each a distinct path the e2e suite did not reach:GitHub Actions is not permitted to approve pull requests.::warning::with the "Allow GitHub Actions to create and approve pull requests" hint, exit 0,approvedstill written::warning::asking forpull-requests: write, exit 0Can not approve your own pull request::warning::naming the author, exit 0GET /user= the PR authorPOST …/reviewsat all::error:: could not submit the approval review, exit 1, label written first::debug::says so/approve cancel, dismissal refused (403)::error:: could not dismiss the approval review 71, exit 1, label removedGET /user500::error:: could not identify the token for approve.github_review, exit 1, nothing writtenThe happy path and the plain
/approve canceldismissal already live inbundle.test.tsand are not duplicated. Importsrepo,tokenandrouteOwnersfrom./helpers;helpers.tsitself is untouched so this does not collide with #246's move ofrepoLabels(the one-lineGET /labelsroute is inline here and can switch to the shared helper once #246 lands).Measured with
npm run test:coverage:e2eonmain@ 3fc21f2:approveReview.tsend-to-end line coverage 65.38 % → 92.3 % (remaining: the closed-PR and no-files edges). Lint andtsc --noEmitclean; the suite makes no network calls beyond the loopback fake.Related Issue
Closes #285
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88