feat(tools): label pull requests whose merge would not change main #14044

Merged
klosixgaming-arch merged 2 commits from upstream-pr/14044 into main 2026-11-13 00:43:42 +00:00
klosixgaming-arch commented 2026-10-31 16:59:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-31T16:59:53Z.


What

An hourly job that labels an open pull request already in main and comments once, when merging it would not change main. It never closes anything. The label goes away by itself once merging would change main again.

A pull request is flagged only when both of these hold:

  1. GitHub's own test merge of the pull request (potentialMergeCommit) has the same tree as the main commit it was made on. That means the merge added nothing.
  2. That commit is the current main, or every file the pull request touches, including renames' old paths, has the same blob in that commit and in the current main. In that case the old result still holds today.

If anything is unknown, the pull request is not flagged. That covers no test merge (conflicts), more than 100 touched files, or a file that is new, deleted or changed since. This doesn't guess from titles, exports or overlap; it only uses GitHub's merge result and blob IDs.

It costs about 34 GraphQL pages for the current ~1,700 open pull requests, plus 2 requests per candidate.

Tested

  • tools/tests/test_pr_unchanged.py: 25 tests, all passing. They cover candidate detection, a merge tested on current or older main, a changed or added file, the file limit, mode-only and file-type changes, the comment retry, path quoting in the query, the label added and removed, a single comment, dry run, that nothing is ever closed, GraphQL errors and pagination.
  • tools/check_conventions.py passes.
  • Ran the same GraphQL reads with gh against all 1,696 open pull requests on 2026-10-31:
    • 214 test merges were made on current main, 1,183 on an older one, and 299 had none.
    • Two test merges added nothing: #7704 and #8629.
    • #7704 would be flagged: its 4 files have the same blobs on current main.
    • #8629 would not, because one of its 2 files changed since.
  • Not tested: the workflow itself.

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. Written with AI assistance and reviewed by me.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5099658636 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14044). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-31T16:59:53Z. --- ### What An hourly job that labels an open pull request `already in main` and comments once, when merging it would not change `main`. **It never closes anything.** The label goes away by itself once merging would change `main` again. A pull request is flagged only when both of these hold: 1. GitHub's own test merge of the pull request (`potentialMergeCommit`) has the same tree as the `main` commit it was made on. That means the merge added nothing. 2. That commit is the current `main`, or every file the pull request touches, including renames' old paths, has the same blob in that commit and in the current `main`. In that case the old result still holds today. If anything is unknown, the pull request is not flagged. That covers no test merge (conflicts), more than 100 touched files, or a file that is new, deleted or changed since. This doesn't guess from titles, exports or overlap; it only uses GitHub's merge result and blob IDs. It costs about 34 GraphQL pages for the current ~1,700 open pull requests, plus 2 requests per candidate. ### Tested - `tools/tests/test_pr_unchanged.py`: 25 tests, all passing. They cover candidate detection, a merge tested on current or older `main`, a changed or added file, the file limit, mode-only and file-type changes, the comment retry, path quoting in the query, the label added and removed, a single comment, dry run, that nothing is ever closed, GraphQL errors and pagination. - `tools/check_conventions.py` passes. - Ran the same GraphQL reads with `gh` against all 1,696 open pull requests on 2026-10-31: - 214 test merges were made on current `main`, 1,183 on an older one, and 299 had none. - Two test merges added nothing: #7704 and #8629. - #7704 would be flagged: its 4 files have the same blobs on current `main`. - #8629 would not, because one of its 2 files changed since. - Not tested: the workflow itself. ### Checklist - [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. Written with AI assistance and reviewed by me.
MarcZX10 commented 2026-10-31 17:16:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T17:16:07Z.

Review: APPROVED


Reviewed — looks good

The exact-head review found no substantiated blocking issue; the focused Python checks and relevant hosted checks passed.

What I ran

Reviewed head fb65d39962b045bcc70f2de50c23d421ae1ead52 against base 474030e58424fefdb65e5df9f3820810fbb4553c; the merge preview was clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or compilation of AnyPS5 was run.

git diff --check 474030e58424fefdb65e5df9f3820810fbb4553c...fb65d39962b045bcc70f2de50c23d421ae1ead52
python3 tools/check_conventions.py --base 474030e58424fefdb65e5df9f3820810fbb4553c --head fb65d39962b045bcc70f2de50c23d421ae1ead52 --title 'feat(tools): label pull requests whose merge would not change main' --body /tmp/anyps5-14044-review/pr-body.md
python3 -m py_compile tools/pr_unchanged.py
python3 tools/tests/test_pr_unchanged.py
python3 tools/check_test_registration.py --scripts
python3 tools/pr_stack_check.py 14044 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-14044-review/stack

The Python syntax and focused test commands ran from an archive of the exact PR head. The stack check reports the PR head merged cleanly into the stated base.

Results

Check Result
Diff whitespace check Passed
Repository conventions and PR template Passed
Python syntax Passed
test_pr_unchanged.py Passed: 19 tests
Python test registration Passed: 231 scripts are registered
Merge preview Clean against the stated base
Hosted CI All completed applicable jobs passed; Linux, register-context, and write-watch were skipped
Raw local check output
# git diff --check

# check_conventions.py
All conventions checks passed.

# py_compile

# test_pr_unchanged.py
...................
----------------------------------------------------------------------
Ran 19 tests in 0.010s

OK

# check_test_registration.py --scripts
231 test script(s), each run by an add_test or a workflow

# pr_stack_check.py
/tmp/anyps5-14044-review/stack/stack-report.md
/tmp/anyps5-14044-review/stack/stack-report.json
Hosted CI status output for the reviewed head
[{"conclusion":"skipped","name":"linux","status":"completed"},{"conclusion":"skipped","name":"register-context","status":"completed"},{"conclusion":"skipped","name":"write-watch","status":"completed"},{"conclusion":"success","name":"relinker (macos-latest, clang++)","status":"completed"},{"conclusion":"success","name":"relinker (macos-latest, clang++, x86_64)","status":"completed"},{"conclusion":"success","name":"windows","status":"completed"},{"conclusion":"success","name":"relinker (windows-latest, g++)","status":"completed"},{"conclusion":"success","name":"relinker (ubuntu-latest, g++)","status":"completed"},{"conclusion":"success","name":"relinker-asan","status":"completed"},{"conclusion":"success","name":"eligibility","status":"completed"},{"conclusion":"success","name":"labels","status":"completed"},{"conclusion":"success","name":"intake","status":"completed"},{"conclusion":"success","name":"conventions","status":"completed"}]

Negative control

Assertion Change to code under test Did the new test fail?
The precheck's baseline negative-control run could import and execute test_pr_unchanged.py No code mutation was reached; the harness failed during test-module import No; it was not exercised
Unedited negative-control error
E
======================================================================
ERROR: test_pr_unchanged (unittest.loader._FailedTest.test_pr_unchanged)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_pr_unchanged
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/anyps5-14044-review/negative-control-base-7d204711/tools/tests/test_pr_unchanged.py", line 10, in <module>
    import pr_unchanged
ModuleNotFoundError: No module named 'pr_unchanged'


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

  • The scheduled workflow was not dispatched, and the full read-only scan against GitHub's live PR queue was not run.
  • The optional precheck test-quality heuristic was unavailable because tools/pr_test_quality.py was absent from its checked-out head directory.
  • No AnyPS5 build, console test, or live labeling/commenting behavior was run.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724016529 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14044#pullrequestreview-5724016529). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T17:16:07Z. **Review:** APPROVED --- # Reviewed — looks good The exact-head review found no substantiated blocking issue; the focused Python checks and relevant hosted checks passed. ## What I ran Reviewed head `fb65d39962b045bcc70f2de50c23d421ae1ead52` against base `474030e58424fefdb65e5df9f3820810fbb4553c`; the merge preview was clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or compilation of AnyPS5 was run. ```sh git diff --check 474030e58424fefdb65e5df9f3820810fbb4553c...fb65d39962b045bcc70f2de50c23d421ae1ead52 python3 tools/check_conventions.py --base 474030e58424fefdb65e5df9f3820810fbb4553c --head fb65d39962b045bcc70f2de50c23d421ae1ead52 --title 'feat(tools): label pull requests whose merge would not change main' --body /tmp/anyps5-14044-review/pr-body.md python3 -m py_compile tools/pr_unchanged.py python3 tools/tests/test_pr_unchanged.py python3 tools/check_test_registration.py --scripts python3 tools/pr_stack_check.py 14044 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-14044-review/stack ``` The Python syntax and focused test commands ran from an archive of the exact PR head. The stack check reports the PR head merged cleanly into the stated base. ## Results | Check | Result | |---|---| | Diff whitespace check | Passed | | Repository conventions and PR template | Passed | | Python syntax | Passed | | `test_pr_unchanged.py` | Passed: 19 tests | | Python test registration | Passed: 231 scripts are registered | | Merge preview | Clean against the stated base | | Hosted CI | All completed applicable jobs passed; Linux, register-context, and write-watch were skipped | <details><summary>Raw local check output</summary> ```text # git diff --check # check_conventions.py All conventions checks passed. # py_compile # test_pr_unchanged.py ................... ---------------------------------------------------------------------- Ran 19 tests in 0.010s OK # check_test_registration.py --scripts 231 test script(s), each run by an add_test or a workflow # pr_stack_check.py /tmp/anyps5-14044-review/stack/stack-report.md /tmp/anyps5-14044-review/stack/stack-report.json ``` </details> <details><summary>Hosted CI status output for the reviewed head</summary> ```text [{"conclusion":"skipped","name":"linux","status":"completed"},{"conclusion":"skipped","name":"register-context","status":"completed"},{"conclusion":"skipped","name":"write-watch","status":"completed"},{"conclusion":"success","name":"relinker (macos-latest, clang++)","status":"completed"},{"conclusion":"success","name":"relinker (macos-latest, clang++, x86_64)","status":"completed"},{"conclusion":"success","name":"windows","status":"completed"},{"conclusion":"success","name":"relinker (windows-latest, g++)","status":"completed"},{"conclusion":"success","name":"relinker (ubuntu-latest, g++)","status":"completed"},{"conclusion":"success","name":"relinker-asan","status":"completed"},{"conclusion":"success","name":"eligibility","status":"completed"},{"conclusion":"success","name":"labels","status":"completed"},{"conclusion":"success","name":"intake","status":"completed"},{"conclusion":"success","name":"conventions","status":"completed"}] ``` </details> ## Negative control | Assertion | Change to code under test | Did the new test fail? | |---|---|---| | The precheck's baseline negative-control run could import and execute `test_pr_unchanged.py` | No code mutation was reached; the harness failed during test-module import | No; it was not exercised | <details><summary>Unedited negative-control error</summary> ```text E ====================================================================== ERROR: test_pr_unchanged (unittest.loader._FailedTest.test_pr_unchanged) ---------------------------------------------------------------------- ImportError: Failed to import test module: test_pr_unchanged Traceback (most recent call last): File "/usr/lib/python3.11/unittest/loader.py", line 154, in loadTestsFromName module = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/anyps5-14044-review/negative-control-base-7d204711/tools/tests/test_pr_unchanged.py", line 10, in <module> import pr_unchanged ModuleNotFoundError: No module named 'pr_unchanged' ---------------------------------------------------------------------- Ran 1 test in 0.000s FAILED (errors=1) ``` </details> ## Findings ### Blocking None. ### Non-blocking None. ## Sources - Reviewed implementation at the pinned PR head: [tools/pr_unchanged.py](https://github.com/boykopovar/AnyPS5/blob/fb65d39962b045bcc70f2de50c23d421ae1ead52/tools/pr_unchanged.py) - Reviewed workflow at the pinned PR head: [pr-unchanged.yml](https://github.com/boykopovar/AnyPS5/blob/fb65d39962b045bcc70f2de50c23d421ae1ead52/.github/workflows/pr-unchanged.yml) ## Not verified - The scheduled workflow was not dispatched, and the full read-only scan against GitHub's live PR queue was not run. - The optional precheck test-quality heuristic was unavailable because `tools/pr_test_quality.py` was absent from its checked-out head directory. - No AnyPS5 build, console test, or live labeling/commenting behavior was run.
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!14044
No description provided.