mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #2349] scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK) #2355
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2355
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2349
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:feat/pr-overlap-check📝 Commits (1)
a3184a4scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK)📊 Changes
4 files changed (+744 additions, -0 deletions)
View changed files
📝
AGENTS.md(+4 -0)📝
CONTRIBUTING.md(+5 -0)➕
scripts/pr_overlap.py(+330 -0)➕
tests/test_pr_overlap.py(+405 -0)📄 Description
Claimed in the coordination issue as: PR-OVERLAP-CHECK (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194375468)
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.