Skip to content

Read the merge-group review in ci review on a merge_group event - #148

Open
kunalgoesbyken wants to merge 2 commits into
prooflinedev:mainfrom
kunalgoesbyken:fix/ci-review-merge-group
Open

kunalgoesbyken wants to merge 2 commits into
prooflinedev:mainfrom
kunalgoesbyken:fix/ci-review-merge-group

Conversation

@kunalgoesbyken

@kunalgoesbyken kunalgoesbyken commented Dec 2, 2026 •

Copy link
Copy Markdown

Fixes #147.

A repo with a GitHub merge queue has to add merge_group to the workflow that runs proofline ci review, or the required check never reports for the queue. On that event GITHUB_SHA is the commit the queue built, and Proofline reviews that commit as a MERGE_GROUP review. Before this change ci review only accepted PULL_REQUEST reviews. It skipped the MERGE_GROUP review at the exact commit, waited out --timeout (30 minutes by default), and exited 2. With the check required, nothing could merge through the queue.

What changes

  • CiSubject::for_event picks the review kind once from GITHUB_EVENT_NAME: MERGE_GROUP on merge_group, PULL_REQUEST on every other event. Both the search in wait_for_head_review and the subject check in confirm_ci_subject use it, so they can't drift apart.
  • Each job accepts only its own kind. A merge_group job never takes a pull-request review of the same SHA, and a pull_request job never takes a merge-group review.
  • The verdict is unchanged. A completed MERGE_GROUP review carries open_items (the API leaves them out only while a review is pending or running, and for audits), so --fail-on works on it the same way it does on a pull-request review.
  • proofline review show ID --fail-on makes the same decision through review_verdict. It now measures a MERGE_GROUP review by its open_items, as ci review does, so a dismissed finding no longer fails one path while passing the other.
  • --sarif accepts a MERGE_GROUP review. It is also of one immutable commit, so validate_subject no longer refuses it.
  • Text output names the queued pull requests from merge_group_pull_request_numbers, for example acme/app merge group of #12, #13 run 1 at 89abcdef0123: COMPLETED, and prints merge group until Proofline has read the group's members.
  • The no-review message names the right kind on each event.
  • Unchanged: the job still asks for a review only on pull_request, the OIDC exchange still verifies a pull-request head only on merge-ref events, and commit_under_test still uses GITHUB_SHA on merge_group.

Verification

On main (22c86ca), a mock console listing one completed, clean MERGE_GROUP review at the job's commit gives:

No pull-request review of acme/app has head commit 89abcdef… after 3 minutes. Proofline reviews a commit once it is the head of an open pull request.
verdict=Unavailable waited=180s

On this branch the same job returns Done straight away.

a_merge_group_job_reads_the_merge_group_review_of_its_commit runs ci_job against a local console for each of these rows:

event listed review read review open serious --fail-on result
merge_group MERGE_GROUP MERGE_GROUP 0 none Done
merge_group MERGE_GROUP MERGE_GROUP 0 serious Done
merge_group MERGE_GROUP MERGE_GROUP 1 serious exit 3
merge_group PULL_REQUEST PULL_REQUEST 0 none not established (wrong kind)
pull_request MERGE_GROUP MERGE_GROUP 0 none not established (wrong kind)
push MERGE_GROUP MERGE_GROUP 0 none not established (wrong kind)
pull_request PULL_REQUEST PULL_REQUEST 0 none Done (unchanged)
merge_group MERGE_GROUP PULL_REQUEST 0 none refused: the detail is not the merge-group review

There are also only_a_merge_group_event_reads_the_merge_group_review (event to kind, including pull_request_target, an empty event and wrong case), a_merge_group_review_names_the_queued_pull_requests (headline with members, an empty list, no list, no repository), and sarif_exports_a_merge_group_review_of_the_queued_commit.

To reproduce:

cargo test --lib a_merge_group_job_reads_the_merge_group_review_of_its_commit -- --nocapture
cargo test --lib merge_group
cargo test --test sarif

cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings pass. I ran cargo test --locked on Windows: everything this change touches passes. 12 tests in agent_install, hooks, local_patch, mcp and update fail the same way on unchanged main on Windows (CI runs the suite only on Linux, see #85 and #103).

Question

On a merge_group job the OIDC exchange runs as it does on push: no pull-request head is sent. ci/github-actions/credentials isn't in openapi.public.json, so I couldn't confirm from this repo that the server issues a read credential for a merge_group identity. If it doesn't, PROOFLINE_TOKEN still works, and I'm happy to add whatever the exchange needs.

--annotations on a merge group appear on the job's check run, since there is no pull-request diff to place them on.

Proofline review

I ran Proofline on this branch in my fork (kunalgoesbyken/cli#1, run 2 at f1dc392). It raised 4 warnings, and I fixed 3 of them in b52d5c7:

  • Doc drift, README --fail-on. The README still said only pull-request reviews use open-item counts, but review_verdict now uses them for MERGE_GROUP too. Fixed: it now names both kinds and says a result without counts is unavailable, which is what ci_verdict returns.
  • Doc drift, --commit. The help and README promised "the commit the queue built", but --commit or COMMIT_SHA can name another SHA, and the job still reads that SHA's MERGE_GROUP review. Fixed: both now say the queued commit is the default and the overrides still apply.
  • Test quality, headline arm order. My render test cleared pull_request_number in every case, so moving the PR arm ahead of the merge-group arm would still pass. Fixed: three of the four cases now carry PR number 42.
  • Test quality, member order. Not changed. It suggested [13, 12] to pin that the CLI doesn't sort. The API says merge_group_pull_request_numbers is "in number order", so the server never sends [13, 12]. For every input it can send, sorting and not sorting print the same thing, so the test would only cover data the contract rules out.

The run itself finished as "Review incomplete" ("could not read everything it needed"). Run 1 never finished: all 6 attempts failed (support ref rev_01a23723684c77b9ac41802b502249a0).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci review never passes on a merge_group event: the MERGE_GROUP review of the queue's commit is skipped

1 participant