Repository navigation
Add wait_for_merge_gate for a terminal CI merge verdict - #149
Open
bobby-nandigam wants to merge 1 commit into
Open
bobby-nandigam wants to merge 1 commit into
bobby-nandigam wants to merge 1 commit into
Conversation
A review completing is not the merge gate deciding: the gate is its own state machine (REQUESTED and EVALUATING before a verdict, then ALLOWED, BLOCKED, BYPASSED or SUPERSEDED), so a completed review can still be evaluating and wait_for_review does not report the gate outcome a CI job actually needs. Add wait_for_merge_gate to the sync and async clients. It polls with the same budget, backoff, retry-deadline, and head-pinning discipline as wait_for_review, and returns a typed MergeGateDecision read from the server's recorded gate: a frozen verdict plus allowed, blocking_severity, blocking_finding_count, policy_version, reason_code, and the raw gate. allowed fails closed, true only on an ALLOWED decision, so BYPASSED, SUPERSEDED, an undecided gate at the deadline (TIMED_OUT), and a head with no captured gate (UNAVAILABLE) never read as mergeable. A gate pinned to another head is UNAVAILABLE, never ALLOWED. Classification lives in a separate gates module with no I/O, covered by parametrized sync and async tests, and documented in the README.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
wait_for_merge_gateon bothProoflineClientandAsyncProoflineClient: it waits for a pull request's merge gate to reach a terminal verdict and returns a typedMergeGateDecisiona CI job can act on directly.Who it helps
Anyone gating merges with Proofline from CI. The merge gate is a separate state machine from the review itself —
REQUESTED/EVALUATINGbefore a verdict, thenALLOWED/BLOCKED/BYPASSED/SUPERSEDED— so a review can beCOMPLETEDwhile the gate is still evaluating.wait_for_reviewtells you the review finished; it does not tell you whether the head may merge. Until now a CI script had to readreview.merge_gateby hand, interpret theGateStatus/Outcomeenums, poll for the decision, and re-implement head pinning. This turns that into one call that returns a clear pass/block.Decisions
allowedisTrueonly on anALLOWEDdecision.BYPASSED(a human override),SUPERSEDED, an undecided gate at the deadline (TIMED_OUT), and a head with no captured gate (UNAVAILABLE) all read as not-mergeable. A gate is a safety control, so the conservative default is the correct one.PullRequestMergeGate(verdict,blocking_severity,blocking_finding_count,policy_version,reason_code, rawgate). The SDK does not re-derive what blocks.head_commit_shapinning aswait_for_review, so a gate pinned to another head is never reported asALLOWED— the same correctness guarantee the existing wait makes.gates.pywith no I/O (mirroringoutcomes.py); the clients only drive the polling loop. No change toproofline/_generated/or the OpenAPI contract.Verification
ruff check,ruff format --check, andmypyare all clean.