feat(stack): port stack push approvals decision to Rust#1536
Conversation
`mergify stack push` skips its trunk-rebase whenever any PR in
the stack is already approved — a rebase force-pushes every
branch in the stack and would dismiss the reviews. The exception:
when the bottom PR has a real merge conflict with trunk, the
rebase has to happen anyway so the conflict gets surfaced. Both
`--skip-rebase` and `--force-rebase` are absolute overrides.
Port `mergify_cli/stack/approvals.py` to
`mergify-stack::approvals`:
- `pull_is_approved` — `GET /repos/{u}/{r}/pulls/{n}/reviews`
with the same "latest review per reviewer wins" semantics as
Python. A reviewer who once APPROVED and later requested
changes counts as requested-changes; without that, a stale
approve would falsely keep the PR in the approved set and a
legitimate change request would get dismissed.
- `fetch_approved_pull_numbers` — sequential fan-out across the
stack's live PRs (same secondary-rate-limit trade-off as
`remote_changes`).
- `bottom_pull_has_conflict` — single GET with a 1s
retry-once-on-null-mergeable to match GitHub's lazy mergeable
computation. Any HTTP error coerces to `false` so a transient
API hiccup can't force a surprise rebase.
- `decide_rebase` — the orchestrator: precedence is
`skip_rebase` → `force_rebase` → approvals/conflict check.
Returns a `RebaseDecision` with a typed `RebaseReason` enum
for the CLI's "skipped because …" log line.
Coverage: 12 wiremock tests covering every branch of
`decide_rebase` plus the latest-review-wins semantics and the
HTTP-error coercion. Adds `tokio` (time feature only) and
`url` to `mergify-stack`'s prod deps for the
mergeable-retry sleep and the wiremock test base-URL parse.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: I57e70b924fd12d0f2d6b9b9a4935a9454b8d4644
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Jun 4, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
This was referenced Jun 4, 2026
This was referenced Jun 4, 2026
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.
mergify stack pushskips its trunk-rebase whenever any PR inthe stack is already approved — a rebase force-pushes every
branch in the stack and would dismiss the reviews. The exception:
when the bottom PR has a real merge conflict with trunk, the
rebase has to happen anyway so the conflict gets surfaced. Both
--skip-rebaseand--force-rebaseare absolute overrides.Port
mergify_cli/stack/approvals.pytomergify-stack::approvals:pull_is_approved—GET /repos/{u}/{r}/pulls/{n}/reviewswith the same "latest review per reviewer wins" semantics as
Python. A reviewer who once APPROVED and later requested
changes counts as requested-changes; without that, a stale
approve would falsely keep the PR in the approved set and a
legitimate change request would get dismissed.
fetch_approved_pull_numbers— sequential fan-out across thestack's live PRs (same secondary-rate-limit trade-off as
remote_changes).bottom_pull_has_conflict— single GET with a 1sretry-once-on-null-mergeable to match GitHub's lazy mergeable
computation. Any HTTP error coerces to
falseso a transientAPI hiccup can't force a surprise rebase.
decide_rebase— the orchestrator: precedence isskip_rebase→force_rebase→ approvals/conflict check.Returns a
RebaseDecisionwith a typedRebaseReasonenumfor the CLI's "skipped because …" log line.
Coverage: 12 wiremock tests covering every branch of
decide_rebaseplus the latest-review-wins semantics and theHTTP-error coercion. Adds
tokio(time feature only) andurltomergify-stack's prod deps for themergeable-retry sleep and the wiremock test base-URL parse.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1535