feat(tools): show pr_overlap's progress while it lists, fetches, probes and merges #10988

Closed
MarcZX10 wants to merge 0 commits from upstream-pr/10988 into main
MarcZX10 commented 2026-10-25 12:27:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T12:27:10Z.


What

tools/pr_overlap.py, which AGENTS.md asks to run with --branch before opening a pull request, prints nothing until its report. With about 1,300 open pull requests a --branch run takes 54 to 81 s on Linux (75 to 81 s on current main, 54 to 55 s with #9539), and #9539 measured 27 minutes on Windows before its fix, so a run looks stuck.

This writes progress lines to stderr, leaving the report on stdout unchanged:

pr_overlap: 1309 open pull requests against main
pr_overlap: fetched 99/1309 pull request heads
...
pr_overlap: fetched 1309/1309 pull request heads
pr_overlap: probed 100/1309 pull requests, 2 share files or exports with the branch
...
pr_overlap: probed 1309/1309 pull requests, 24 share files or exports with the branch
pr_overlap: merged 24/24 pull requests into the base

The count is reported once the pull requests are listed, the fetch after each batch of 100 heads, and the probe of #9539 and the merges into the base every 100 pull requests and at the end. A run without --branch reports its merges the same way.

This builds on #9539, which adds the probe step, so it depends on it. The first four commits are #9539's, by DavidSamir, applied unchanged on current main with their authorship kept; the five commits after them are this pull request's (two changes, each followed by its test, and the test registration). Once #9539 is merged, rebasing drops its commits from this branch.

Tested

Linux x86-64, Python 3.11: every tools/tests/test_pr_overlap*.py suite passes, including the new test_pr_overlap_progress.py (fetch batches of 99, 199 and 250 of 250 heads, a run without pull requests, probe lines with 4, 8 and 10 related pull requests out of 250, and merge lines at 100 and 150 of 150). The new tests fail before the corresponding commits. A real python3 tools/pr_overlap.py --branch marc/feat-pr-overlap-progress --repo boykopovar/AnyPS5 run took 61 s, printed the lines above and the same kind of report as before; its only conflict is #9539, which this branch contains. python3 tools/check_conventions.py --base upstream/main --head HEAD and git diff --check upstream/main pass. Windows and macOS were not run.

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 (not applicable; no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: #9539
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004715661 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10988). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T12:27:10Z. --- ### What `tools/pr_overlap.py`, which AGENTS.md asks to run with `--branch` before opening a pull request, prints nothing until its report. With about 1,300 open pull requests a `--branch` run takes 54 to 81 s on Linux (75 to 81 s on current `main`, 54 to 55 s with #9539), and #9539 measured 27 minutes on Windows before its fix, so a run looks stuck. This writes progress lines to stderr, leaving the report on stdout unchanged: ``` pr_overlap: 1309 open pull requests against main pr_overlap: fetched 99/1309 pull request heads ... pr_overlap: fetched 1309/1309 pull request heads pr_overlap: probed 100/1309 pull requests, 2 share files or exports with the branch ... pr_overlap: probed 1309/1309 pull requests, 24 share files or exports with the branch pr_overlap: merged 24/24 pull requests into the base ``` The count is reported once the pull requests are listed, the fetch after each batch of 100 heads, and the probe of #9539 and the merges into the base every 100 pull requests and at the end. A run without `--branch` reports its merges the same way. This builds on #9539, which adds the probe step, so it depends on it. The first four commits are #9539's, by DavidSamir, applied unchanged on current `main` with their authorship kept; the five commits after them are this pull request's (two changes, each followed by its test, and the test registration). Once #9539 is merged, rebasing drops its commits from this branch. ### Tested Linux x86-64, Python 3.11: every `tools/tests/test_pr_overlap*.py` suite passes, including the new `test_pr_overlap_progress.py` (fetch batches of 99, 199 and 250 of 250 heads, a run without pull requests, probe lines with 4, 8 and 10 related pull requests out of 250, and merge lines at 100 and 150 of 150). The new tests fail before the corresponding commits. A real `python3 tools/pr_overlap.py --branch marc/feat-pr-overlap-progress --repo boykopovar/AnyPS5` run took 61 s, printed the lines above and the same kind of report as before; its only conflict is #9539, which this branch contains. `python3 tools/check_conventions.py --base upstream/main --head HEAD` and `git diff --check upstream/main` pass. Windows and macOS were not run. ### 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 (not applicable; no third-party code added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #9539 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
thepoppfish commented 2026-10-25 14:33:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thepoppfish on 2026-10-25T14:33:06Z.

Review: COMMENTED


Windows validation of exact head a9051f9aacb223183846c2d124b1db88f057dedc, with the progress-only delta reviewed against dependency-only parent 16b8bed6d6767a46550312b4d87cbeb6405d5fad. I found no actionable defect in that delta. This is a comment review: the inherited #9539 rename omission remains on this head, so these results do not approve the combined branch.

Windows 11 build 26200, Python 3.14.7, native Git for Windows:

  • python -m unittest discover -s tools/tests -p 'test_pr_overlap*.py' -v: 85 methods, 80 passed, 5 skipped, 23.162 s. Skips are three Linux shell-workflow cases, the shell-script fake-gh subdirectory fixture, and a POSIX filename fixture. They remain skips; the separate native CLI fixture below adds Windows coverage.
  • Relinker-only CMake configuration registers pr_overlap_progress; ctest --test-dir <build> -R '^pr_overlap_progress$' -V passes 1/1 in 0.68 s (five Python methods, 0.009 s; total CTest time 0.72 s). No C++ product build or full CTest run was performed for this review.
  • The five new progress methods against the unchanged dependency-only implementation produce five expected assertion failures, zero errors. The committed tests cover pagination, 99/199/250 fetched heads, empty input, 100/200/250 probes, and 100/150 merges.
  • Ten actual CLI runs compare that parent and this head across root-directory branch mode, nested-directory branch mode, all-pairs --out, an empty PR list, and a failed fetch. All paired stdout bytes and all four generated report files match; the nonempty UTF-8 path report also matches between root and nested invocation. The failure case preserves the old error and nonzero exit without reporting a successful fetch. A further streaming run reads the first stderr progress line while the process is still running, then produces the same stdout report.
  • These CLI runs execute the unmodified tools and real Git fetch/merge-tree operations against a disposable local bare repository. Only gh api is replaced by a compiled native fixture reader. They use four synthetic PRs, no network and no GitHub credentials. This is neither a live GitHub scan nor a large-repository performance measurement. No speed claim is made.
  • python tools/check_conventions.py --base origin/main and whitespace checks pass; the source worktree stays clean.

Dependency qualification: I replayed the three regressions already published by veosett in the #9539 follow-up, copying only its test hunk into scratch and keeping this head's production code unchanged. As expected, the older-file/base-rename and implicit-directory-move cases still fail; the surviving-directory filtering case passes (3 methods, 2 assertion failures, 1 pass, zero errors, 11.847 s). This is the existing dependency defect, not a new progress finding. I did not apply or certify the proposed production repair. If that repair is adopted, its two-argument probe and three-item return also need carrying into this PR's enumerated probe loop and fake-probe test before rerunning the suite.

Replay the native Windows CLI parity and streaming fixture

Save the two files below together in a scratch directory. With Python, GCC and native Git available, run:

New-Item -ItemType Directory -Force native-bin
gcc -O2 FakeGh.c -o native-bin/gh.exe
python probe_cli.py <absolute-checkout-of-this-exact-head> <absolute-native-Git-bin-directory>

The checkout must contain dependency-only commit 16b8bed6d6767a46550312b4d87cbeb6405d5fad. The fixture asserts the exact head, creates/removes its own temporary repository, and writes result JSON/stdout/stderr beside itself. It does not edit the checkout or contact GitHub. Compilation here used GCC 16.2.0-6 UCRT. The native shim avoids Windows shell/shebang assumptions in the skipped committed fixture.

FakeGh.c:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv) {
    if (argc != 4 || strcmp(argv[1], "api") || strcmp(argv[2], "--paginate")
        || strncmp(argv[3], "repos/fixture/project/pulls?", 27)) return 2;
    const char* path = getenv("PR_OVERLAP_API_FIXTURE");
    if (!path) return 3;
    FILE* input = fopen(path, "rb");
    if (!input) return 4;
    char buffer[4096];
    size_t count;
    while ((count = fread(buffer, 1, sizeof(buffer), input)))
        if (fwrite(buffer, 1, count, stdout) != count) return 5;
    const int failed = ferror(input);
    fclose(input);
    return failed ? 6 : 0;
}

probe_cli.py:

import hashlib
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile

harness = Path(__file__).resolve().parent
work = harness.parent
repo = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else work / "review-10988"
parent = "16b8bed6d6767a46550312b4d87cbeb6405d5fad"
git_bin = Path(sys.argv[2]).resolve() if len(sys.argv) > 2 else Path(shutil.which("git")).parent
environment = dict(os.environ, GCM_INTERACTIVE="Never", GIT_TERMINAL_PROMPT="0", GIT_PAGER="")
environment["PATH"] = str(git_bin) + os.pathsep + environment["PATH"]
for key in ("GH_TOKEN", "GITHUB_TOKEN", "GH_ENTERPRISE_TOKEN"):
    environment.pop(key, None)
baseline = harness / "BeforeProgress.py"
assert subprocess.check_output(["git", "-C", str(repo), "rev-parse", "HEAD"], env=environment, text=True).strip() == "a9051f9aacb223183846c2d124b1db88f057dedc"
baseline.write_bytes(subprocess.check_output(["git", "-C", str(repo), "show", parent + ":tools/pr_overlap.py"], env=environment))

with tempfile.TemporaryDirectory(prefix="cli fixture ", dir=harness) as directory:
    root = Path(directory).resolve()
    assert root.is_relative_to(work)
    client, remote = root / "client", root / "remote.git"
    client.mkdir()

    def git(*args):
        return subprocess.check_output(["git", "-c", "user.name=Fixture", "-c", "[email protected]",
            "-c", "commit.gpgsign=false", "-c", "maintenance.auto=false", *args],
            cwd=client, env=environment, stderr=subprocess.PIPE).decode("utf-8").strip()

    def commit(files):
        for name, text in files.items():
            path = client / name
            path.parent.mkdir(parents=True, exist_ok=True)
            path.write_text(text, encoding="utf-8", newline="\n")
        git("add", "-A")
        git("commit", "-qm", "fixture")
        return git("rev-parse", "HEAD")

    git("init", "-q", "-b", "main")
    git("config", "core.autocrlf", "false")
    git("config", "core.hooksPath", str(root / "no-hooks"))
    base = commit({"shared file.txt": "one\nbase\n", "caf\u00e9 note.txt": "one\nbase\n", "other.txt": "base\n",
                   "core/libs/prx/lib/Existing.cpp": "int Existing() { return 0; }\n"})
    symbol = "int APS5_VABI shared_nid_postfix(int value) { return value; }\n"
    branch = commit({"shared file.txt": "branch\nbase\n", "caf\u00e9 note.txt": "branch\nbase\n",
                     "core/libs/prx/lib/Branch.cpp": symbol})
    git("update-ref", "refs/heads/candidate", branch)
    changes = [
        {"shared file.txt": "other\nbase\n", "caf\u00e9 note.txt": "other\nbase\n"},
        {"other.txt": "unrelated\n"},
        {"core/libs/prx/lib/Other.cpp": symbol},
        {"core/libs/prx/lib/Fourth.cpp": symbol},
    ]
    pulls = []
    for number, files in enumerate(changes, 1):
        git("checkout", "-q", "--detach", base)
        sha = commit(files)
        git("update-ref", f"refs/heads/pull{number}", sha)
        pulls.append({"number": number, "head": {"sha": sha}, "user": {"login": f"author{number}"}, "body": ""})
    git("update-ref", "refs/heads/main", base)
    git("clone", "--bare", "--quiet", str(client), str(remote))
    git("config", "url." + remote.as_uri() + ".insteadOf", "https://github.com/fixture/project.git")
    nested = client / "nested folder"
    nested.mkdir()
    api = root / "pulls.json"
    environment["PR_OVERLAP_API_FIXTURE"] = str(api)
    environment["PYTHONPATH"] = str(repo / "tools")
    environment["PATH"] = str(harness / "native-bin") + os.pathsep + environment["PATH"]
    rows = []

    def run(version, mode, args, cwd, records):
        api.write_text(json.dumps(records), encoding="utf-8")
        script = baseline if version == "before" else repo / "tools/pr_overlap.py"
        result = subprocess.run([sys.executable, str(script), "--repo", "fixture/project", "--jobs", "2", *args],
                                cwd=cwd, env=environment, capture_output=True, timeout=60)
        (harness / f"{mode}-{version}.stdout").write_bytes(result.stdout)
        (harness / f"{mode}-{version}.stderr").write_bytes(result.stderr)
        rows.append({"mode": mode, "version": version, "exit": result.returncode,
                     "stdout_sha256": hashlib.sha256(result.stdout).hexdigest(),
                     "stderr": result.stderr.decode("utf-8").splitlines()})
        return result

    root_report = None
    for mode, cwd in (("root", client), ("nested", nested)):
        before = run("before", mode, ["--branch", "candidate"], cwd, pulls)
        after = run("after", mode, ["--branch", "candidate"], cwd, pulls)
        assert before.returncode == after.returncode == 0
        assert before.stdout == after.stdout
        assert "caf\u00e9 note.txt".encode("utf-8") in after.stdout and b"shared" in after.stdout
        assert not before.stderr
        assert after.stderr.decode("utf-8").splitlines() == [
            "pr_overlap: 4 open pull requests against main",
            "pr_overlap: fetched 4/4 pull request heads",
            "pr_overlap: probed 4/4 pull requests, 3 share files or exports with the branch",
            "pr_overlap: merged 3/3 pull requests into the base",
        ]
        if root_report is None:
            root_report = after.stdout
        else:
            assert root_report == after.stdout

    api.write_text(json.dumps(pulls), encoding="utf-8")
    process = subprocess.Popen([sys.executable, str(repo / "tools/pr_overlap.py"), "--repo", "fixture/project",
        "--jobs", "2", "--branch", "candidate"], cwd=client, env=environment, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    first = process.stderr.readline()
    running_at_first_line = process.poll() is None
    stdout, stderr = process.communicate(timeout=60)
    assert process.returncode == 0 and stdout == root_report
    assert first == b"pr_overlap: 4 open pull requests against main\r\n" or first == b"pr_overlap: 4 open pull requests against main\n"
    streaming = {"first_line": first.decode("utf-8").strip(), "process_running_when_read": running_at_first_line,
                 "stdout_matches_paired_runs": stdout == root_report}
    (harness / "streaming.stderr").write_bytes(first + stderr)

    reports = []
    for version in ("before", "after"):
        out = root / ("reports-" + version)
        result = run(version, "all-pairs", ["--out", str(out)], client, pulls)
        assert result.returncode == 0 and not result.stdout
        reports.append({path.name: path.read_bytes() for path in out.glob("*.md")})
    assert reports[0] == reports[1] and len(reports[1]) == 4 and reports[1]["3.md"]

    before = run("before", "empty", ["--branch", "candidate"], client, [])
    after = run("after", "empty", ["--branch", "candidate"], client, [])
    assert before.returncode == after.returncode == 0 and before.stdout == after.stdout
    assert after.stderr.decode("utf-8").splitlines() == [
        "pr_overlap: 0 open pull requests against main", "pr_overlap: fetched 0/0 pull request heads"]

    args = ["--base", "missing-base", "--branch", "candidate"]
    before = run("before", "failed-fetch", args, client, pulls)
    after = run("after", "failed-fetch", args, client, pulls)
    assert before.returncode == after.returncode != 0 and before.stdout == after.stdout == b""
    assert after.stderr.decode("utf-8").splitlines()[1:] == before.stderr.decode("utf-8").splitlines()
    assert b"fetched" not in after.stderr and b"Traceback" not in after.stderr

(harness / "result.json").write_text(json.dumps({"head": "a9051f9aacb223183846c2d124b1db88f057dedc",
    "parent": parent, "actual_git_and_cli": True, "gh_api": "compiled fixture-only shim", "network": False,
    "rows": rows, "streaming": streaming}, indent=2), encoding="utf-8")
print("PASS: 10 paired CLI runs plus one streaming run, identical reports, root/nested, all-pairs, empty and failed fetch")
print(json.dumps(streaming))

No Linux/macOS runtime, hosted CI, game, GPU or whole-product validation is claimed. AI-assisted review and fixture: yes (OpenAI Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643680784 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10988#pullrequestreview-5643680784). Originally posted by [thepoppfish](https://github.com/thepoppfish) on 2026-10-25T14:33:06Z. **Review:** COMMENTED --- Windows validation of exact head `a9051f9aacb223183846c2d124b1db88f057dedc`, with the progress-only delta reviewed against dependency-only parent `16b8bed6d6767a46550312b4d87cbeb6405d5fad`. I found no actionable defect in that delta. This is a comment review: the inherited #9539 rename omission remains on this head, so these results do not approve the combined branch. Windows 11 build 26200, Python 3.14.7, native Git for Windows: - `python -m unittest discover -s tools/tests -p 'test_pr_overlap*.py' -v`: **85 methods, 80 passed, 5 skipped**, 23.162 s. Skips are three Linux shell-workflow cases, the shell-script fake-gh subdirectory fixture, and a POSIX filename fixture. They remain skips; the separate native CLI fixture below adds Windows coverage. - Relinker-only CMake configuration registers `pr_overlap_progress`; `ctest --test-dir <build> -R '^pr_overlap_progress$' -V` passes **1/1** in 0.68 s (five Python methods, 0.009 s; total CTest time 0.72 s). No C++ product build or full CTest run was performed for this review. - The five new progress methods against the unchanged dependency-only implementation produce **five expected assertion failures, zero errors**. The committed tests cover pagination, 99/199/250 fetched heads, empty input, 100/200/250 probes, and 100/150 merges. - Ten actual CLI runs compare that parent and this head across root-directory branch mode, nested-directory branch mode, all-pairs `--out`, an empty PR list, and a failed fetch. All paired stdout bytes and all four generated report files match; the nonempty UTF-8 path report also matches between root and nested invocation. The failure case preserves the old error and nonzero exit without reporting a successful fetch. A further streaming run reads the first stderr progress line while the process is still running, then produces the same stdout report. - These CLI runs execute the unmodified tools and real Git fetch/merge-tree operations against a disposable local bare repository. Only `gh api` is replaced by a compiled native fixture reader. They use four synthetic PRs, no network and no GitHub credentials. This is neither a live GitHub scan nor a large-repository performance measurement. No speed claim is made. - `python tools/check_conventions.py --base origin/main` and whitespace checks pass; the source worktree stays clean. Dependency qualification: I replayed the three regressions already published by **veosett** in [the #9539 follow-up](https://github.com/boykopovar/AnyPS5/pull/9539#issuecomment-6397459530), copying only its test hunk into scratch and keeping this head's production code unchanged. As expected, the older-file/base-rename and implicit-directory-move cases still fail; the surviving-directory filtering case passes (**3 methods, 2 assertion failures, 1 pass, zero errors**, 11.847 s). This is the existing dependency defect, not a new progress finding. I did not apply or certify the proposed production repair. If that repair is adopted, its two-argument `probe` and three-item return also need carrying into this PR's enumerated probe loop and fake-probe test before rerunning the suite. <details> <summary>Replay the native Windows CLI parity and streaming fixture</summary> Save the two files below together in a scratch directory. With Python, GCC and native Git available, run: ```powershell New-Item -ItemType Directory -Force native-bin gcc -O2 FakeGh.c -o native-bin/gh.exe python probe_cli.py <absolute-checkout-of-this-exact-head> <absolute-native-Git-bin-directory> ``` The checkout must contain dependency-only commit `16b8bed6d6767a46550312b4d87cbeb6405d5fad`. The fixture asserts the exact head, creates/removes its own temporary repository, and writes result JSON/stdout/stderr beside itself. It does not edit the checkout or contact GitHub. Compilation here used GCC 16.2.0-6 UCRT. The native shim avoids Windows shell/shebang assumptions in the skipped committed fixture. `FakeGh.c`: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char** argv) { if (argc != 4 || strcmp(argv[1], "api") || strcmp(argv[2], "--paginate") || strncmp(argv[3], "repos/fixture/project/pulls?", 27)) return 2; const char* path = getenv("PR_OVERLAP_API_FIXTURE"); if (!path) return 3; FILE* input = fopen(path, "rb"); if (!input) return 4; char buffer[4096]; size_t count; while ((count = fread(buffer, 1, sizeof(buffer), input))) if (fwrite(buffer, 1, count, stdout) != count) return 5; const int failed = ferror(input); fclose(input); return failed ? 6 : 0; } ``` `probe_cli.py`: ```python import hashlib import json import os from pathlib import Path import shutil import subprocess import sys import tempfile harness = Path(__file__).resolve().parent work = harness.parent repo = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else work / "review-10988" parent = "16b8bed6d6767a46550312b4d87cbeb6405d5fad" git_bin = Path(sys.argv[2]).resolve() if len(sys.argv) > 2 else Path(shutil.which("git")).parent environment = dict(os.environ, GCM_INTERACTIVE="Never", GIT_TERMINAL_PROMPT="0", GIT_PAGER="") environment["PATH"] = str(git_bin) + os.pathsep + environment["PATH"] for key in ("GH_TOKEN", "GITHUB_TOKEN", "GH_ENTERPRISE_TOKEN"): environment.pop(key, None) baseline = harness / "BeforeProgress.py" assert subprocess.check_output(["git", "-C", str(repo), "rev-parse", "HEAD"], env=environment, text=True).strip() == "a9051f9aacb223183846c2d124b1db88f057dedc" baseline.write_bytes(subprocess.check_output(["git", "-C", str(repo), "show", parent + ":tools/pr_overlap.py"], env=environment)) with tempfile.TemporaryDirectory(prefix="cli fixture ", dir=harness) as directory: root = Path(directory).resolve() assert root.is_relative_to(work) client, remote = root / "client", root / "remote.git" client.mkdir() def git(*args): return subprocess.check_output(["git", "-c", "user.name=Fixture", "-c", "[email protected]", "-c", "commit.gpgsign=false", "-c", "maintenance.auto=false", *args], cwd=client, env=environment, stderr=subprocess.PIPE).decode("utf-8").strip() def commit(files): for name, text in files.items(): path = client / name path.parent.mkdir(parents=True, exist_ok=True) path.write_text(text, encoding="utf-8", newline="\n") git("add", "-A") git("commit", "-qm", "fixture") return git("rev-parse", "HEAD") git("init", "-q", "-b", "main") git("config", "core.autocrlf", "false") git("config", "core.hooksPath", str(root / "no-hooks")) base = commit({"shared file.txt": "one\nbase\n", "caf\u00e9 note.txt": "one\nbase\n", "other.txt": "base\n", "core/libs/prx/lib/Existing.cpp": "int Existing() { return 0; }\n"}) symbol = "int APS5_VABI shared_nid_postfix(int value) { return value; }\n" branch = commit({"shared file.txt": "branch\nbase\n", "caf\u00e9 note.txt": "branch\nbase\n", "core/libs/prx/lib/Branch.cpp": symbol}) git("update-ref", "refs/heads/candidate", branch) changes = [ {"shared file.txt": "other\nbase\n", "caf\u00e9 note.txt": "other\nbase\n"}, {"other.txt": "unrelated\n"}, {"core/libs/prx/lib/Other.cpp": symbol}, {"core/libs/prx/lib/Fourth.cpp": symbol}, ] pulls = [] for number, files in enumerate(changes, 1): git("checkout", "-q", "--detach", base) sha = commit(files) git("update-ref", f"refs/heads/pull{number}", sha) pulls.append({"number": number, "head": {"sha": sha}, "user": {"login": f"author{number}"}, "body": ""}) git("update-ref", "refs/heads/main", base) git("clone", "--bare", "--quiet", str(client), str(remote)) git("config", "url." + remote.as_uri() + ".insteadOf", "https://github.com/fixture/project.git") nested = client / "nested folder" nested.mkdir() api = root / "pulls.json" environment["PR_OVERLAP_API_FIXTURE"] = str(api) environment["PYTHONPATH"] = str(repo / "tools") environment["PATH"] = str(harness / "native-bin") + os.pathsep + environment["PATH"] rows = [] def run(version, mode, args, cwd, records): api.write_text(json.dumps(records), encoding="utf-8") script = baseline if version == "before" else repo / "tools/pr_overlap.py" result = subprocess.run([sys.executable, str(script), "--repo", "fixture/project", "--jobs", "2", *args], cwd=cwd, env=environment, capture_output=True, timeout=60) (harness / f"{mode}-{version}.stdout").write_bytes(result.stdout) (harness / f"{mode}-{version}.stderr").write_bytes(result.stderr) rows.append({"mode": mode, "version": version, "exit": result.returncode, "stdout_sha256": hashlib.sha256(result.stdout).hexdigest(), "stderr": result.stderr.decode("utf-8").splitlines()}) return result root_report = None for mode, cwd in (("root", client), ("nested", nested)): before = run("before", mode, ["--branch", "candidate"], cwd, pulls) after = run("after", mode, ["--branch", "candidate"], cwd, pulls) assert before.returncode == after.returncode == 0 assert before.stdout == after.stdout assert "caf\u00e9 note.txt".encode("utf-8") in after.stdout and b"shared" in after.stdout assert not before.stderr assert after.stderr.decode("utf-8").splitlines() == [ "pr_overlap: 4 open pull requests against main", "pr_overlap: fetched 4/4 pull request heads", "pr_overlap: probed 4/4 pull requests, 3 share files or exports with the branch", "pr_overlap: merged 3/3 pull requests into the base", ] if root_report is None: root_report = after.stdout else: assert root_report == after.stdout api.write_text(json.dumps(pulls), encoding="utf-8") process = subprocess.Popen([sys.executable, str(repo / "tools/pr_overlap.py"), "--repo", "fixture/project", "--jobs", "2", "--branch", "candidate"], cwd=client, env=environment, stdout=subprocess.PIPE, stderr=subprocess.PIPE) first = process.stderr.readline() running_at_first_line = process.poll() is None stdout, stderr = process.communicate(timeout=60) assert process.returncode == 0 and stdout == root_report assert first == b"pr_overlap: 4 open pull requests against main\r\n" or first == b"pr_overlap: 4 open pull requests against main\n" streaming = {"first_line": first.decode("utf-8").strip(), "process_running_when_read": running_at_first_line, "stdout_matches_paired_runs": stdout == root_report} (harness / "streaming.stderr").write_bytes(first + stderr) reports = [] for version in ("before", "after"): out = root / ("reports-" + version) result = run(version, "all-pairs", ["--out", str(out)], client, pulls) assert result.returncode == 0 and not result.stdout reports.append({path.name: path.read_bytes() for path in out.glob("*.md")}) assert reports[0] == reports[1] and len(reports[1]) == 4 and reports[1]["3.md"] before = run("before", "empty", ["--branch", "candidate"], client, []) after = run("after", "empty", ["--branch", "candidate"], client, []) assert before.returncode == after.returncode == 0 and before.stdout == after.stdout assert after.stderr.decode("utf-8").splitlines() == [ "pr_overlap: 0 open pull requests against main", "pr_overlap: fetched 0/0 pull request heads"] args = ["--base", "missing-base", "--branch", "candidate"] before = run("before", "failed-fetch", args, client, pulls) after = run("after", "failed-fetch", args, client, pulls) assert before.returncode == after.returncode != 0 and before.stdout == after.stdout == b"" assert after.stderr.decode("utf-8").splitlines()[1:] == before.stderr.decode("utf-8").splitlines() assert b"fetched" not in after.stderr and b"Traceback" not in after.stderr (harness / "result.json").write_text(json.dumps({"head": "a9051f9aacb223183846c2d124b1db88f057dedc", "parent": parent, "actual_git_and_cli": True, "gh_api": "compiled fixture-only shim", "network": False, "rows": rows, "streaming": streaming}, indent=2), encoding="utf-8") print("PASS: 10 paired CLI runs plus one streaming run, identical reports, root/nested, all-pairs, empty and failed fetch") print(json.dumps(streaming)) ``` </details> No Linux/macOS runtime, hosted CI, game, GPU or whole-product validation is claimed. AI-assisted review and fixture: yes (OpenAI Codex).
THEMANnt commented 2026-10-26 18:50:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T18:50:11Z.

Review: CHANGES_REQUESTED


Reviewed a9051f9aacb223183846c2d124b1db88f057dedc. Changes requested for a reproduced conflict-detection regression.

[P2] tools/pr_overlap.py, probe / related: retain candidates affected by base-branch renames. Start with old.txt, rename it to renamed.txt on main, and edit its first line in the reviewed branch. An older PR changes that same line under old.txt. Its clean merge onto main relocates the edit, and a full scan correctly detects the line-1 conflict on renamed.txt.

The new three-dot probe sees only old.txt, discards the candidate and reports no overlap. I reproduced this with real Git histories on the exact head; the comparison base retains the conflict. A raw merge-base path list is not a conservative substitute for the merged-tree paths.

Please account for base-branch renames or retain uncertain candidates, and add this older-base case to the optimized-versus-full equivalence tests.

Validation: Windows/Python 3.11. The eight added branch-scan/progress tests pass. The separate rename reproduction is the decisive failing behavior; no timing or full-repository performance claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5657339442 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10988#pullrequestreview-5657339442). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-26T18:50:11Z. **Review:** CHANGES_REQUESTED --- Reviewed `a9051f9aacb223183846c2d124b1db88f057dedc`. Changes requested for a reproduced conflict-detection regression. **[P2] `tools/pr_overlap.py`, `probe` / `related`: retain candidates affected by base-branch renames.** Start with `old.txt`, rename it to `renamed.txt` on main, and edit its first line in the reviewed branch. An older PR changes that same line under `old.txt`. Its clean merge onto main relocates the edit, and a full scan correctly detects the line-1 conflict on `renamed.txt`. The new three-dot probe sees only `old.txt`, discards the candidate and reports no overlap. I reproduced this with real Git histories on the exact head; the comparison base retains the conflict. A raw merge-base path list is not a conservative substitute for the merged-tree paths. Please account for base-branch renames or retain uncertain candidates, and add this older-base case to the optimized-versus-full equivalence tests. **Validation:** Windows/Python 3.11. The eight added branch-scan/progress tests pass. The separate rename reproduction is the decisive failing behavior; no timing or full-repository performance claim.
THEMANnt commented 2026-10-27 03:24:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-27T03:24:00Z.

Review: APPROVED


Reviewed 642caa0e558d4547975d171cedf88f1efb605010. Approve: the updated prefilter retains candidates whose existing paths disappeared from the base, and the submitted rename and deletion cases cover the prior finding.

An independent real-Git rename history now reports the same conflict in the optimized and full scans. The same control against the previously reviewed head loses that conflict, demonstrating the correction. A separate reused-path history also matched, although that case does not exercise rename detection because Git treated the old path as a replacement.

Windows, Python 3.11.9: 82 passed, 5 skipped, 87 total across the overlap suites. Hosted relinker jobs on Windows, Linux and both macOS architectures ran the branch-scan and progress tests on merges containing this head; product jobs were skipped. ASan ran its targeted TLS coverage, not these overlap tests.

This review covers the pinned branch, including its #9539 dependency; preserve the correction when resolving the dependency and landing order. No whole-product or performance validation is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661862411 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10988#pullrequestreview-5661862411). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-27T03:24:00Z. **Review:** APPROVED --- Reviewed `642caa0e558d4547975d171cedf88f1efb605010`. Approve: the updated prefilter retains candidates whose existing paths disappeared from the base, and the submitted rename and deletion cases cover the prior finding. An independent real-Git rename history now reports the same conflict in the optimized and full scans. The same control against the previously reviewed head loses that conflict, demonstrating the correction. A separate reused-path history also matched, although that case does not exercise rename detection because Git treated the old path as a replacement. Windows, Python 3.11.9: 82 passed, 5 skipped, 87 total across the overlap suites. Hosted relinker jobs on Windows, Linux and both macOS architectures ran the branch-scan and progress tests on merges containing this head; product jobs were skipped. ASan ran its targeted TLS coverage, not these overlap tests. This review covers the pinned branch, including its #9539 dependency; preserve the correction when resolving the dependency and landing order. No whole-product or performance validation is claimed.

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!10988
No description provided.