Repository navigation
shepherd: keep approval when a merge of main leaves the PR's own change identical (Part of #7455) - #7464
Closed
squid-protocol wants to merge 1 commit into
Closed
shepherd: keep approval when a merge of main leaves the PR's own change identical (Part of #7455)#7464squid-protocol wants to merge 1 commit into
squid-protocol wants to merge 1 commit into
Conversation
…ge identical (Part of #7455) clean_main_merge gave up when main and the PR shared a file or main moved 300 files. It now compares the PR's own change: against the main parent, the new head names the same files as the approved diff, each with the same mode, status, blob and patch, or (main touched it too) the exact clean three-way merge. Anything else, or any failed read, still drops approval. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
On hold for an owner decision. This widens when approval carries over, by allowing files main also touched through a three-way merge check, and it saves 2 of the 72 recent approval drops. Main's existing |
Owner
Author
|
Waiting on an owner decision (asked privately, 2026-11-01). Nothing is needed from contributors; work resumes once it is answered. |
Owner
Author
|
Closed on the owner's decision. Main's |
This was referenced Nov 1, 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.
Part of #7455 (item 3). No workflow file changes here.
Why. A plain merge of main into an approved PR could still drop
shepherd:merge, flip the PR to draft, cancel its runs and re-run everything.clean_main_merge(#4979) gave up if main and the PR touched the same file, or if main moved 300 files or more.What. It now compares the PR's own change and ignores how much main moved. The approval carries over only when all of these hold:
git merge-fileon bytes read through the API, on fixed temp names; no PR code runs).Anything else drops the approval: a failed read, a file over 1 MB that needs reading, more than 20 such files, a PR of 300 files or more, a rename or add or delete in a file that moved, a patch already on main. The approval marker for the new head is still written by the bot, so each head stays bound to a marker.
Why not
git patch-id --stable. It ignores whitespace and hunk position, and either can be a real change. It would also need a repo with history, and the pass only reads the API. The rule here is stricter.Replay, with the real code against the live API. I ran
clean_main_mergeon the 19 merge-shaped heads among the 72 drops on the 300 newest PRs (2026-10-30..11-01). The other 53 were 52 real commits and 1 unreadable head, and neither can pass rule 1.The honest number: this saves 2 of 72 drops. It does not help the two PRs that prompted it. Both #7441 drops were conflict resolutions that changed its patch, and #7439's was a real commit, so all three are correct drops under the safety rule.
Verified.
tests/tools/test_shepherd_gh.py,test_shepherd_markers_not_hand_written.pyandtest_workflow_draft_gate.py: 239 passed. The new tests cover: identical patch keeps (no draft flip, no cancels), one extra line, unreadable compare and file, evil merge three ways (own file, a file only main changed, inside a shared file), conflict resolution, whitespace-only, same hunk moved, mode change, unreadable mode, truncated compare. Mutation check: removing the file-set test, the blob test, the mode test or the parent test each fails tests (2, 5, 1 and 3 failures).ruff_audit --ciandmypy_audit --ci: no new findings.Not verified. A real merge through a real pass: the workflows run main's code, so this applies only after merge.
clean_main_mergeitself did run against the live API, including the GraphQL mode read on #7332 and #7140. Whether a pass misreads a real carried head end to end is what the first merged PR will show.🤖 Generated with Claude Code