SRE-637: Fix false positive stale approval dismissal on base-branch-only updates#47
Open
TimDiekmann wants to merge 1 commit intomainfrom
Open
Conversation
🤖 Augment PR SummarySummary: Prevents false stale-approval dismissals when a PR’s base branch advances but the PR head commit remains unchanged. 🤖 Was this summary useful? React with 👍 or 👎 |
248ea29 to
0f5d34d
Compare
…nly updates When only the base branch advances (e.g., squash-merge of a stacked PR), HEAD_SHA remains unchanged. The shifted merge-base caused git range-diff to report differences even though the PR's own commits were untouched. Short-circuit the range-diff step when HEAD_SHA == PREV_HEAD_SHA: if the PR branch head hasn't changed, the reviewed code hasn't changed. Adds two tests: - Integration test reproducing the stacked PR squash-merge scenario - Structural test verifying the short-circuit exists in action.yml
0f5d34d to
7775608
Compare
CiaranMn
approved these changes
Apr 8, 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.
Summary
Fixes false positive stale approval dismissals when only the base branch advances (e.g., squash-merge of a stacked PR).
Problem
When a stacked PR's base gets squash-merged, the base branch advances but the PR branch is untouched. The shifted merge-base causes
git range-diffto report false differences:Before squash-merge (previous run):
PREV_BASE_SHA= C,PREV_HEAD_SHA= Dmerge-base(C, D)= C → range:C..D(just featureB's commit)After squash-merge (current run):
BASE_SHA= S,HEAD_SHA= D (unchanged!)merge-base(S, D)= B (shifted!) → range:B..D(featureA + featureB)Fix
Extracts the range-diff logic into a testable function
run_check_range_diff_staleinrange-diff-stale.sh. The function checks ifHEAD_SHA == PREV_HEAD_SHAbefore runningrange-diff— same HEAD SHA = same git content by definition, so the review can't be stale.The fix lives in the same code that
action.ymlcalls, not as an untestable YAML short-circuit.Tests
test_base_branch_advance_is_not_stale): verifies the range-diff parser reportsstale=truefor the shifted merge-base, documenting the false positivetest_base_branch_advance_e2e_is_not_stale): reproduces the full stacked PR squash-merge scenario, callsrun_check_range_diff_staledirectly, assertsstale=falsestale=true)stale=false)Related