fix(tools): merge only the pull requests that share files or exports with the branch in pr_overlap #9539

Closed
DavidSamir wants to merge 5 commits from upstream-pr/9539 into main
DavidSamir commented 2026-10-22 00:53:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T00:53:08Z.


What

tools/pr_overlap.py --branch merged every open pull request against main before comparing, although a pull request can only appear in that report when it shares a file or an export with the branch. With 1,012 open pull requests a full run took 27 minutes on Windows 11 (jobs=4): scan_all was 1,377 s of it, and git merge-tree against main was 1,012 calls and 4,807 s of subprocess time. On the author's machine the check required by AGENTS.md before opening a pull request did not finish in 25 or 55 minutes.

  • probe(pr) lists a pull request's changed files and, when it touches core/libs/prx/*.cpp, its exports, from git diff refs/pr/base...<head>. That needs no merge and writes no objects.
  • related(prs, executor) scans the branch, probes the other pull requests, and returns those that share a file or an export with it. The rest get empty file, added and export sets and no merged tree, which is what they would contribute to the report.
  • scan_all merges only what related returns when a branch is present (key 0). --out, the CI mode that compares every pair, is unchanged.

The probe finds a superset of what the merge-based scan finds: a merge only drops changes that main already has, and base...head uses the same merge base the conflicted case already used.

A pull request in the Depends on chain of another is not scanned for its own sake: in --branch mode the branch has no dependencies, so overlaps never reads a shared dependency.

Tested

Windows 11, Python 3.12. Open pull requests: 1,021 at the time of the run, main 0c6a5bd593, jobs=4, all four branches in one process so the fetch is shared. Each branch was scanned with this change first and then the old way (every pull request scanned, once for all four branches), and the printed report was compared byte for byte:

Branch Touches Merged with this change scan_all Report vs full scan
worst case, built for the test core/libs/CMakeLists.txt, a debt file 58 of 1,021 94.5 s identical (2,728 bytes)
tcgetsid Export.cpp, Export.Discovery.cpp, CMakeLists.txt, a debt file 69 of 1,020 59.0 s identical (1,067 bytes)
linux fixed base relinker, docs/user/USAGE.md 23 of 1,021 73.7 s identical (3,908 bytes)
provoking vertex Pipeline.cpp, a debt file 129 of 1,020 308.2 s identical (12,224 bytes)

Scanning every pull request the old way took 717.5 s in the same process. It ran after the four new-way runs, so it had warm caches; the first full run, cold, took 1,377 s for the same step. The slowest case here is the provoking-vertex branch: 129 merges, 308 s.

Unit tests: tools/tests/test_pr_overlap_branch_scan.py (new, 3 tests) builds a throwaway repository with a branch and four pull requests (same lines, an unrelated file, the same export in another file, an unrelated export). It checks that the overlaps equal a scan of every pull request, that only the first and third are merged, and that a scan without a branch still merges all four. On main's pr_overlap.py the second test fails (all four are merged); with the change all three pass. All 68 test_pr_overlap* tests pass with the change. python tools/check_conventions.py --base origin/main passes.

python tools/pr_overlap.py --branch fix/pr-overlap-branch-prefilter, run with this change on this branch against about 1,020 open pull requests (Windows 11, jobs=4): 3 min 54 s wall from start to printed report, where the unchanged tool did not finish in 25 or 55 minutes on the same machine. Its report:

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

| Pull request | Shared files not compared |
|---|---|
| PR 988 | `tools/pr_overlap.py` |

#988 appends eleven lines at the end of tools/pr_overlap.py and does not touch scan_all; it conflicts with main for other reasons.

Merge checks with git merge-tree: clean against main, #8970 and #8025, the other two open pull requests that change tools/pr_overlap.py.

Not run on Linux or macOS: the speed-up is measured on Windows only.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4960396417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T00:53:08Z. --- ### What `tools/pr_overlap.py --branch` merged every open pull request against `main` before comparing, although a pull request can only appear in that report when it shares a file or an export with the branch. With 1,012 open pull requests a full run took 27 minutes on Windows 11 (jobs=4): `scan_all` was 1,377 s of it, and `git merge-tree` against `main` was 1,012 calls and 4,807 s of subprocess time. On the author's machine the check required by AGENTS.md before opening a pull request did not finish in 25 or 55 minutes. - `probe(pr)` lists a pull request's changed files and, when it touches `core/libs/prx/*.cpp`, its exports, from `git diff refs/pr/base...<head>`. That needs no merge and writes no objects. - `related(prs, executor)` scans the branch, probes the other pull requests, and returns those that share a file or an export with it. The rest get empty file, added and export sets and no merged tree, which is what they would contribute to the report. - `scan_all` merges only what `related` returns when a branch is present (key `0`). `--out`, the CI mode that compares every pair, is unchanged. The probe finds a superset of what the merge-based scan finds: a merge only drops changes that `main` already has, and `base...head` uses the same merge base the conflicted case already used. A pull request in the `Depends on` chain of another is not scanned for its own sake: in `--branch` mode the branch has no dependencies, so `overlaps` never reads a shared dependency. ### Tested Windows 11, Python 3.12. Open pull requests: 1,021 at the time of the run, `main` `0c6a5bd593`, jobs=4, all four branches in one process so the fetch is shared. Each branch was scanned with this change first and then the old way (every pull request scanned, once for all four branches), and the printed report was compared byte for byte: | Branch | Touches | Merged with this change | `scan_all` | Report vs full scan | |---|---|---|---|---| | worst case, built for the test | `core/libs/CMakeLists.txt`, a debt file | 58 of 1,021 | 94.5 s | identical (2,728 bytes) | | tcgetsid | `Export.cpp`, `Export.Discovery.cpp`, `CMakeLists.txt`, a debt file | 69 of 1,020 | 59.0 s | identical (1,067 bytes) | | linux fixed base | relinker, `docs/user/USAGE.md` | 23 of 1,021 | 73.7 s | identical (3,908 bytes) | | provoking vertex | `Pipeline.cpp`, a debt file | 129 of 1,020 | 308.2 s | identical (12,224 bytes) | Scanning every pull request the old way took 717.5 s in the same process. It ran after the four new-way runs, so it had warm caches; the first full run, cold, took 1,377 s for the same step. The slowest case here is the provoking-vertex branch: 129 merges, 308 s. Unit tests: `tools/tests/test_pr_overlap_branch_scan.py` (new, 3 tests) builds a throwaway repository with a branch and four pull requests (same lines, an unrelated file, the same export in another file, an unrelated export). It checks that the overlaps equal a scan of every pull request, that only the first and third are merged, and that a scan without a branch still merges all four. On `main`'s `pr_overlap.py` the second test fails (all four are merged); with the change all three pass. All 68 `test_pr_overlap*` tests pass with the change. `python tools/check_conventions.py --base origin/main` passes. `python tools/pr_overlap.py --branch fix/pr-overlap-branch-prefilter`, run with this change on this branch against about 1,020 open pull requests (Windows 11, jobs=4): 3 min 54 s wall from start to printed report, where the unchanged tool did not finish in 25 or 55 minutes on the same machine. Its report: ``` Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | PR 988 | `tools/pr_overlap.py` | ``` #988 appends eleven lines at the end of `tools/pr_overlap.py` and does not touch `scan_all`; it conflicts with `main` for other reasons. Merge checks with `git merge-tree`: clean against `main`, #8970 and #8025, the other two open pull requests that change `tools/pr_overlap.py`. Not run on Linux or macOS: the speed-up is measured on Windows only. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-22 01:00:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:00:16Z.

Review: CHANGES_REQUESTED


The branch-prefilter tests passed locally when I ran the exact PR script plus all test_pr_overlap*.py files: 68 tests passed. The optimization also retains the existing all-pairs scan when --out is used, and the new test checks report equality plus that only related PRs are merged.

The hosted relinker matrix completed with the same failure on Linux, Windows, macOS arm64 and macOS x86_64: test_script_registration reports tools/tests/test_pr_overlap_branch_scan.py is a test script that no add_test or workflow runs. Please register the new script with add_test (or a workflow as the repository rule allows), then rerun the relinker matrix. The overlap behavior itself passed the focused tests; the required relinker check currently fails on every platform. Eligibility, conventions, intake and labels pass; relinker ASan passes.

I’m requesting changes for the missing test registration and CI failure.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608043720 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#pullrequestreview-5608043720). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:00:16Z. **Review:** CHANGES_REQUESTED --- The branch-prefilter tests passed locally when I ran the exact PR script plus all `test_pr_overlap*.py` files: 68 tests passed. The optimization also retains the existing all-pairs scan when `--out` is used, and the new test checks report equality plus that only related PRs are merged. The hosted relinker matrix completed with the same failure on Linux, Windows, macOS arm64 and macOS x86_64: `test_script_registration` reports `tools/tests/test_pr_overlap_branch_scan.py is a test script that no add_test or workflow runs`. Please register the new script with `add_test` (or a workflow as the repository rule allows), then rerun the relinker matrix. The overlap behavior itself passed the focused tests; the required relinker check currently fails on every platform. Eligibility, conventions, intake and labels pass; relinker ASan passes. I’m requesting changes for the missing test registration and CI failure.
DavidSamir commented 2026-10-22 01:32:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T01:32:04Z.


@MarcZX10 thanks for running it. The failure was test_script_registration: tools/tests/test_pr_overlap_branch_scan.py was not run by any add_test, and I had left it out. It is registered now as pr_overlap_branch_scan in the root CMakeLists.txt, right after pr_overlap_errors (61493f1f07), and I merged the current main into the branch (b163c8784c, no force-push).

On that head, ctest -R "pr_overlap|test_script_registration" passes 9 of 9 on Windows 11, including test_script_registration and the new pr_overlap_branch_scan, and tools/check_conventions.py --base origin/main passes. Could you take another look and rerun the relinker matrix?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330500811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6330500811). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T01:32:04Z. --- @MarcZX10 thanks for running it. The failure was `test_script_registration`: `tools/tests/test_pr_overlap_branch_scan.py` was not run by any `add_test`, and I had left it out. It is registered now as `pr_overlap_branch_scan` in the root `CMakeLists.txt`, right after `pr_overlap_errors` (`61493f1f07`), and I merged the current `main` into the branch (`b163c8784c`, no force-push). On that head, `ctest -R "pr_overlap|test_script_registration"` passes 9 of 9 on Windows 11, including `test_script_registration` and the new `pr_overlap_branch_scan`, and `tools/check_conventions.py --base origin/main` passes. Could you take another look and rerun the relinker matrix?
MarcZX10 commented 2026-10-22 01:44:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:44:10Z.

Review: APPROVED


Thanks for registering test_pr_overlap_branch_scan.py with CTest. This resolves the blocking finding from my previous review. I verified the current head is based on current main, the template remains complete, and the current hosted eligibility, conventions, labels and all relinker matrix jobs (Ubuntu, Windows, macOS x86_64/arm64 and ASAN) pass, including the test_script_registration gate that failed before. Platform product builds are skipped. I did not rerun the focused local test on this head; my earlier local suite run was on the preceding revision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608316127 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#pullrequestreview-5608316127). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:44:10Z. **Review:** APPROVED --- Thanks for registering `test_pr_overlap_branch_scan.py` with CTest. This resolves the blocking finding from my previous review. I verified the current head is based on current main, the template remains complete, and the current hosted eligibility, conventions, labels and all relinker matrix jobs (Ubuntu, Windows, macOS x86_64/arm64 and ASAN) pass, including the `test_script_registration` gate that failed before. Platform product builds are skipped. I did not rerun the focused local test on this head; my earlier local suite run was on the preceding revision.
MarcZX10 commented 2026-10-22 04:17:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:17:23Z.

Review: APPROVED


I rechecked the current head after the test registration fix. The new branch-scan test is registered in CTest, the PR is based on current main, conventions and eligibility pass, and hosted relinker jobs pass on Ubuntu, Windows, macOS arm64/x86_64, and ASAN. Product builds are skipped, and I did not rerun the focused tests locally on this head; the prior local test evidence applies to the preceding revision. I found no remaining blocking issue in the reviewed diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609198611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#pullrequestreview-5609198611). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T04:17:23Z. **Review:** APPROVED --- I rechecked the current head after the test registration fix. The new branch-scan test is registered in CTest, the PR is based on current main, conventions and eligibility pass, and hosted relinker jobs pass on Ubuntu, Windows, macOS arm64/x86_64, and ASAN. Product builds are skipped, and I did not rerun the focused tests locally on this head; the prior local test evidence applies to the preceding revision. I found no remaining blocking issue in the reviewed diff.
xXPBSXx commented 2026-10-22 04:42:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-22T04:42:41Z.


Linux data point for b163c8784c: WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal), Python 3.12, PR head alone (not merged onto main; its merge-base is 94fbb8cea).

  • With the PR: tools/tests/test_pr_overlap_branch_scan.py runs 3 tests and passes.
  • With tools/pr_overlap.py restored to the merge-base (the PR's test kept): test_only_pull_requests_sharing_a_file_or_an_export_are_merged fails.
    Not tested: macOS, Windows.
    AI-assisted (Claude Code).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332892548 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6332892548). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-22T04:42:41Z. --- Linux data point for `b163c8784c`: WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal), Python 3.12, PR head alone (not merged onto `main`; its merge-base is `94fbb8cea`). - With the PR: `tools/tests/test_pr_overlap_branch_scan.py` runs 3 tests and passes. - With `tools/pr_overlap.py` restored to the merge-base (the PR's test kept): `test_only_pull_requests_sharing_a_file_or_an_export_are_merged` fails. Not tested: macOS, Windows. AI-assisted (Claude Code).
jotitadev commented 2026-10-22 07:04:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T07:04:43Z.

Review: COMMENTED


Python 3.9 run of the new test, since macOS ships Python 3.9.6 as /usr/bin/python3 (Xcode command line tools) and the other tool tests run there.

Apple M2 Max, macOS 27.2, head b163c8784c, python3 tools/tests/test_pr_overlap_branch_scan.py:

  • Python 3.14.7: Ran 3 tests ... OK
  • Python 3.9.6: FAILED (errors=3), all three in the fixture helper:
  File "tools/tests/test_pr_overlap_branch_scan.py", line 23, in write
    Path(path).write_text(text, encoding="utf-8", newline="\n")
TypeError: write_text() got an unexpected keyword argument 'newline'

Path.write_text(newline=) is 3.10+. The same pattern was replaced before for 3.9 in the other tool tests; something like this keeps the LF output:

with open(path, "w", encoding="utf-8", newline="\n") as handle:
    handle.write(text)

The pr_overlap.py change itself was not exercised beyond these three tests.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5610406811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#pullrequestreview-5610406811). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T07:04:43Z. **Review:** COMMENTED --- Python 3.9 run of the new test, since macOS ships Python 3.9.6 as `/usr/bin/python3` (Xcode command line tools) and the other tool tests run there. Apple M2 Max, macOS 27.2, head `b163c8784c`, `python3 tools/tests/test_pr_overlap_branch_scan.py`: - Python 3.14.7: `Ran 3 tests ... OK` - Python 3.9.6: `FAILED (errors=3)`, all three in the fixture helper: ``` File "tools/tests/test_pr_overlap_branch_scan.py", line 23, in write Path(path).write_text(text, encoding="utf-8", newline="\n") TypeError: write_text() got an unexpected keyword argument 'newline' ``` `Path.write_text(newline=)` is 3.10+. The same pattern was replaced before for 3.9 in the other tool tests; something like this keeps the LF output: ```python with open(path, "w", encoding="utf-8", newline="\n") as handle: handle.write(text) ``` The `pr_overlap.py` change itself was not exercised beyond these three tests. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
DavidSamir commented 2026-10-22 09:06:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T09:06:14Z.


@jotitadev thank you, that was a real defect: Path.write_text takes newline only from Python 3.10, and the fixture helper of the new test is where all three tests errored on macOS's 3.9.6. 4b0c1382b6 writes the fixtures with open(path, "w", encoding="utf-8", newline="\n") and handle.write(text), which gives the same LF bytes on every version. On Windows with Python 3.12 the three tests pass; I have no 3.9 interpreter here, so I only checked that the file parses as 3.9 syntax, and the macOS run is still the real check.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337009000 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6337009000). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T09:06:14Z. --- @jotitadev thank you, that was a real defect: `Path.write_text` takes `newline` only from Python 3.10, and the fixture helper of the new test is where all three tests errored on macOS's 3.9.6. `4b0c1382b6` writes the fixtures with `open(path, "w", encoding="utf-8", newline="\n")` and `handle.write(text)`, which gives the same LF bytes on every version. On Windows with Python 3.12 the three tests pass; I have no 3.9 interpreter here, so I only checked that the file parses as 3.9 syntax, and the macOS run is still the real check.
DavidSamir commented 2026-10-22 09:07:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T09:07:23Z.


Checked on macOS with the system Python the review mentions: macOS 26 (Darwin 25.6), /usr/bin/python3 3.9.6, head 4b0c1382b6: tools/tests/test_pr_overlap_branch_scan.py runs 3 tests, OK, and tools/tests/test_pr_overlap.py runs 22 tests, OK.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337030757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6337030757). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T09:07:23Z. --- Checked on macOS with the system Python the review mentions: macOS 26 (Darwin 25.6), `/usr/bin/python3` 3.9.6, head `4b0c1382b6`: `tools/tests/test_pr_overlap_branch_scan.py` runs 3 tests, OK, and `tools/tests/test_pr_overlap.py` runs 22 tests, OK.
MarcZX10 commented 2026-10-22 11:34:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:34:51Z.


I reran the complete focused overlap-tool test set on current head 4b0c1382b6: all 69 tests passed, including the branch-prefilter cases; git diff --check and current conventions pass. The fixture now uses open(..., newline="\\n"), so it avoids the Python 3.9 Path.write_text(newline=...) incompatibility. The merge against current main is clean, but the sync check still reports 5 ahead / 116 behind (merge base 94fbb8cea). Please refresh the branch onto current main before merge and rerun the focused suite there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339745246 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6339745246). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:34:51Z. --- I reran the complete focused overlap-tool test set on current head `4b0c1382b6`: all 69 tests passed, including the branch-prefilter cases; `git diff --check` and current conventions pass. The fixture now uses `open(..., newline="\\n")`, so it avoids the Python 3.9 `Path.write_text(newline=...)` incompatibility. The merge against current `main` is clean, but the sync check still reports 5 ahead / 116 behind (merge base `94fbb8cea`). Please refresh the branch onto current `main` before merge and rerun the focused suite there.
THEMANnt commented 2026-10-24 23:41:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-24T23:41:50Z.

Review: CHANGES_REQUESTED


Reviewed 4b0c1382b6e2 against 94fbb8cea80a. Changes requested because the new prefilter can discard a genuinely conflicting PR after a rename on the base branch.

tools/pr_overlap.py:151–155 — Account for base-branch renames before discarding a PR

In a disposable real Git history, start with old.txt, rename it to renamed.txt on main, and change its first line in the reviewed branch. A second PR forked before the rename changes the same first line in old.txt. Merging that older PR onto main cleanly relocates its edit to renamed.txt, so the existing full scan detects a line-1 conflict with the reviewed branch. The new probe instead returns old.txt from the old merge-base diff, compares it against the branch's renamed.txt, and clears the PR's file set. On the exact head, full scan reports the conflict while scan_all reports no overlap; on baseline, scan_all retains the conflict. This is reproduced with actual Git merges and unchanged production source.

Please retain candidates whose paths may be transformed by base-branch renames, or map those paths conservatively before filtering. Add the older-base/renamed-file case to the optimized-versus-full equivalence tests. A raw three-dot diff is not always a superset of merged-tree paths.

Validation: Windows x64 / CPython 3.11: all eight overlap suites — 65 passed, 4 platform skips; 69 total. Baseline: 62 passed, 4 skips; 66 total. New-tests/old-code control has one expected optimization assertion failure and no errors. The separate rename reproduction is decisive. Its initial run encountered a local Windows temporary-directory cleanup error; corrected cleanup reruns exit 0 on both arms and retain the reproduced difference. Conventions, whitespace and registration pass. Hosted relinker matrix/ASan and conventions succeed; product jobs are skipped.

Scope: Local synthetic Git histories; no independent full-open-PR timing benchmark or performance claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640625199 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9539#pullrequestreview-5640625199). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-24T23:41:50Z. **Review:** CHANGES_REQUESTED --- Reviewed [4b0c1382b6e2](https://github.com/boykopovar/AnyPS5/commit/4b0c1382b6e2b4ec36cfc84a3d7f732dcf3ee79d) against [94fbb8cea80a](https://github.com/boykopovar/AnyPS5/commit/94fbb8cea80af91db62ab6ee7e4da23341675c40). Changes requested because the new prefilter can discard a genuinely conflicting PR after a rename on the base branch. **`tools/pr_overlap.py:151–155` — Account for base-branch renames before discarding a PR** In a disposable real Git history, start with `old.txt`, rename it to `renamed.txt` on main, and change its first line in the reviewed branch. A second PR forked before the rename changes the same first line in `old.txt`. Merging that older PR onto main cleanly relocates its edit to `renamed.txt`, so the existing full scan detects a line-1 conflict with the reviewed branch. The new probe instead returns `old.txt` from the old merge-base diff, compares it against the branch's `renamed.txt`, and clears the PR's file set. On the exact head, full scan reports the conflict while `scan_all` reports no overlap; on baseline, `scan_all` retains the conflict. This is reproduced with actual Git merges and unchanged production source. Please retain candidates whose paths may be transformed by base-branch renames, or map those paths conservatively before filtering. Add the older-base/renamed-file case to the optimized-versus-full equivalence tests. A raw three-dot diff is not always a superset of merged-tree paths. **Validation:** Windows x64 / CPython 3.11: all eight overlap suites — 65 passed, 4 platform skips; 69 total. Baseline: 62 passed, 4 skips; 66 total. New-tests/old-code control has one expected optimization assertion failure and no errors. The separate rename reproduction is decisive. Its initial run encountered a local Windows temporary-directory cleanup error; corrected cleanup reruns exit 0 on both arms and retain the reproduced difference. Conventions, whitespace and registration pass. Hosted relinker matrix/ASan and conventions succeed; product jobs are skipped. **Scope:** Local synthetic Git histories; no independent full-open-PR timing benchmark or performance claim.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9539
No description provided.