Repository navigation
scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK) - #2349
Draft
syfyra wants to merge 1 commit into
Draft
scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK)#2349syfyra wants to merge 1 commit into
syfyra wants to merge 1 commit into
Conversation
…ame files (PR-OVERLAP-CHECK) There was no working way to find the open pull requests that touch a file: GitHub's search does not match pull requests by path, and with about 1,490 of them open, reading them is not an option. Work gets written twice, and the template's "Depends on:" line (every pull request this one conflicts with) is filled in from memory. scripts/pr_overlap.py asks git instead, with no API call and no token. The open pull requests are the ones the remote has a refs/pull/N/merge for; their heads are fetched into refs/pr-overlap/N, a namespace of the tool that follows the open set, so --no-fetch works offline. A pull request's files are those that differ between its head and its merge base with the base branch. With paths it lists the open pull requests that change them. With none it takes the branch's own files, committed or in the working tree, and says how the branch stands to each pull request that changes one: clean or conflict (git merge-tree, with the conflicting files), same, or included. AGENTS.md and CONTRIBUTING.md name it where they ask to check the open pull requests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
lixonik
reviewed
Nov 26, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Windows 11: 19/19 overlap tests passed. The suite used disposable local Git repos for ref discovery, dirty path handling, overlap and ref cleanup. No findings from these checks.
AI-assisted.
This was referenced Nov 26, 2026
Draft
Draft
Draft
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.
Claimed in the coordination issue as: PR-OVERLAP-CHECK (#1608 (comment))
Depends on: none. It merges cleanly with the two open pull requests that change the same files (#2103 in
AGENTS.md, #2151 inAGENTS.mdandCONTRIBUTING.md), as the script itself reports.What and why
There is no working way to find the open pull requests that touch a file. GitHub's search does not match pull requests by path: the VIEWER-HUNT finding in the coordination issue records
gh search prs 'path:viewer/'returning nothing while four open pull requests changed those files. With about 1,490 pull requests open, reading them is not an option, so work gets written twice, and the template'sDepends on:line (every pull request this one builds on or conflicts with) is filled in from memory.scripts/pr_overlap.pyasks git instead, with no API call and no token:refs/pull/N/mergefor. GitHub keeps that ref while a pull request is open:git ls-remoteshowed 1,485 of them today (of 2,283 pull request heads), against 1,484 open pull requests in the search API, 317 of them labeledneeds rebase.refs/pr-overlap/N, a namespace of the tool. Refs of pull requests that are no longer open are deleted, so the namespace is the open set as of the last run and--no-fetchworks offline.--base(defaultorigin/main), so whatmainchanged since it branched is not counted as its own. A rename counts as both paths.python -I scripts/pr_overlap.py <file or folder>...lists the open pull requests that change those paths: the check to run before starting on a file. With no argument it takes the branch's own files (committed against the merge base, plus what is modified or untracked in the working tree) and says how the branch stands to each pull request that changes one of them:cleanorconflictfromgit merge-tree, with the conflicting files,samefor the branch's own pull request,includedfor one the branch is built on.--jsongives the same as one object.It writes refs under
refs/pr-overlap/and nothing else: no tags, noFETCH_HEAD, and no pull request code is checked out or run.AGENTS.mdandCONTRIBUTING.mdname it where they ask to check the open pull requests.What it found on real branches here:
scripts/run_semantic_tests.py), whose description names one conflicting pull request, it lists 21 open pull requests on the same three files, 8 of which conflict with that branch.AGENTS.md. I moved my paragraph to the end of that section, and it now reports both pull requests as clean.viewer/serve.pyit lists none, which is what the VIEWER-HUNT finding concluded by hand.Tested
Windows 11, Python 3.14.7, git 2.55.0:
python -I tests/test_pr_overlap.py: 19 tests on throwaway repositories, an "upstream" withrefs/pull/N/headandrefs/pull/N/mergelaid out as GitHub does and a clone of it. They cover paths and folders, closed pull requests left out, files measured from the merge base, renames, paths relative to the current folder and with spaces and non-ASCII names, the branch mode with committed, modified and untracked files, the four standings, the kept refs following the open set,--no-fetchwith the remote gone, a fork asorigin, a shallow clone, and the errors.main, where the script does not exist.--no-fetchabout 4.6 s. The first run fetched 1,487 heads and took 12 s, in a clone that already had most of their objects from an earlier fetch of the pull request refs; a clone without them will take longer.python -Iontests/test_tool_stdout_encoding.py,tests/test_text_write_line_endings.py,tests/test_ci_registration.py, the 13tests/test_docs_*.pyandtests/test_i18n_index.py;python -I scripts/check_no_game_data.pyon the four changed files.contextlib.chdirin the test needs 3.11), a git older than 2.55 (2.29 forfetch --stdinand 2.38 formerge-tree --write-treeare from git's release notes, not from a run), and a host other than GitHub (the merge-ref rule is GitHub's).GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator rule in this change.)🤖 Generated with Claude Code