Skip to content

test(bundle): drive the approve.github_review refusals, short-circuits and failures through dist/index.js - #286

Merged
github-actions[bot] merged 2 commits into
mainfrom
quality/test-bundle-approve-review
Oct 7, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
quality/test-bundle-approve-review

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/approveReview.test.ts, which drives /approve and /approve cancel through the committed dist/index.js with approve.github_review: true against the fake GitHub and routes POST …/pulls/1/reviews, PUT …/reviews/71/dismissals and GET /user to the answers src/plugins/approveReview.ts has to handle. Nine cases, each a distinct path the e2e suite did not reach:

GitHub's answer expected
422 GitHub Actions is not permitted to approve pull requests. ::warning:: with the "Allow GitHub Actions to create and approve pull requests" hint, exit 0, approved still written
any other 403 ::warning:: asking for pull-requests: write, exit 0
422 Can not approve your own pull request ::warning:: naming the author, exit 0
GET /user = the PR author warning, no POST …/reviews at all
any other error (500) ::error:: could not submit the approval review, exit 1, label written first
draft PR no review, ::debug:: says so
own marked review already on the head no review, no dismissal
/approve cancel, dismissal refused (403) ::error:: could not dismiss the approval review 71, exit 1, label removed
GET /user 500 ::error:: could not identify the token for approve.github_review, exit 1, nothing written

The happy path and the plain /approve cancel dismissal already live in bundle.test.ts and are not duplicated. Imports repo, token and routeOwners from ./helpers; helpers.ts itself is untouched so this does not collide with #246's move of repoLabels (the one-line GET /labels route is inline here and can switch to the shared helper once #246 lands).

Measured with npm run test:coverage:e2e on main @ 3fc21f2: approveReview.ts end-to-end line coverage 65.38 % → 92.3 % (remaining: the closed-PR and no-files edges). Lint and tsc --noEmit clean; 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

…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>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 3, 2026 22:16
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

The red build-test on 9173f6c (run 37157845384, pull_request) is the flake tracked in #284, not this diff: all 81 files / 1648 tests passed, and the sole failure is the uncaught assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID") originating in __tests__/issueCommentTest/meow.test.ts — a file this PR does not touch. The sibling push run on the same SHA (37157835975) is green. Re-running the failed job once; the durable fix is being prepared against #284.


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

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

build-test triage for the red run on 9173f6c (run 37157845384):


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

— 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>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

CI triage for build-test run 37157845384: all 81 files / 1648 tests passed; the red is a single vitest Unhandled Error (assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') from undici) originating in __tests__/issueCommentTest/meow.test.ts, which this PR does not touch (this PR adds only __tests__/bundle/approveReview.test.ts). The same head went green on the push-event run 37157835975.

Root cause is the status-only msw mock passthrough socket tracked in #284 and fixed by #287 (content-length: 0 framing + dns.lookup guard). This PR stays as-is; retriggering once rather than duplicating #287's change here.


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

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

The red build-test on run(s) 37176045750 and 37176043225 (f143cea) is the shared meow.test.ts → api.thecatapi.com passthrough failure tracked as incident #294 (root cause #284, fix held in #287) — all 81 files / 1648 tests passed and this PR does not touch that file. Deferring this PR until #287 lands; no further re-runs or pushes for this failure.


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

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

This was referenced Oct 4, 2026
@jeefy

jeefy commented Oct 7, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot added 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. and removed hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

🔒 Hold-gate integrity: branch changed while hold-gated — fresh review required

This PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was 9173f6c3fa53, but the branch now sits at f143cea305ec. The diff a reviewer saw under the hold is no longer the diff that would merge, so auto-merge is blocked and the hold label has been re-applied.

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.

@jeefy

jeefy commented Oct 7, 2026

Copy link
Copy Markdown
Member

/lgtm

@github-actions
github-actions Bot merged commit a20e1f4 into main Oct 7, 2026
7 of 10 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-bundle-approve-review branch October 9, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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] approve.github_review refusal paths in src/plugins/approveReview.ts are unit-covered but never driven through dist/index.js

1 participant