fix(tools): count only definitions as exports in the overlap report #1741

Merged
SleglJan merged 1 commit from upstream-pr/1741 into main 2026-10-09 21:42:28 +00:00
SleglJan commented 2026-10-08 18:05:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T18:05:25Z.


What

tools/pr_overlap.py took every added line with APS5_VABI before a name and a parenthesis as an export, so a declaration such as extern "C" int* APS5_VABI __error_nid_postfix();, which many source files add to reach the guest errno, made each pull request that adds it "implement the same function" as all the others. The reports of #1641 and #1727 each list five such rows.

The export collection moves into exports(diff), which skips a line that ends in a semicolon. In the tree every declaration the pattern matches ends that way (206 lines), and a definition's first line ends in {, }, ( or , (3086 lines); no declaration is split over lines, so none is lost.

Overlap: #1325 changes open_prs in the same file and adds tools/tests/test_pr_overlap.py, #988 changes its __main__ output; this change is in scan and its own test file, so they merge in any order. #1662 and #1623 add an add_test at the same place in the root CMakeLists.txt; whichever merges second rebases two lines.

Tested

  • python3 tools/tests/test_pr_overlap_exports.py and ctest -R pr_overlap_exports: three cases over one diff: definitions of a POSIX export, an sce export with noexcept, a one-line body and a signature with the brace on the next line are exports; two declarations (one with noexcept and trailing spaces, kept in a separate string so an editor cannot strip them), a _nid_no_patch helper, a removed line and a context line are not. Written before the change; it fails on main with AttributeError: module 'pr_overlap' has no attribute 'exports' and passes with it.
  • --branch runs against the 200 newest open pull requests (the tool's current limit, which #1325 lifts), Linux, Python 3.12:
    • feat/libkernel-socket-read-write (#1727): main's tool reports 9 rows, 6 of them __error_nid_postfix only (#1613, #1616, #1627, #1641, #1675, #1729); this one reports the 3 rows with conflicting lines (#1708, #1711, #1738) and nothing under "Same exports".
    • feat/libkernel-mlock (#1673): 1 row, #1633's conflicting line, with both.
  • tools/check_conventions.py --base upstream/main passes; progress_report and import_audit still pass.
  • The same Build workflow run on this commit in the fork's Actions (merged onto main 6b56175a), run 37822121862: pr_overlap_exports passes its three repeats on Linux and Windows, full suite 474/474 on each, and the relinker job on Ubuntu, macOS and Windows, which the root CMakeLists.txt change triggers.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4790893100 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1741). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-08T18:05:25Z. --- ### What `tools/pr_overlap.py` took every added line with `APS5_VABI` before a name and a parenthesis as an export, so a declaration such as `extern "C" int* APS5_VABI __error_nid_postfix();`, which many source files add to reach the guest errno, made each pull request that adds it "implement the same function" as all the others. The reports of #1641 and #1727 each list five such rows. The export collection moves into `exports(diff)`, which skips a line that ends in a semicolon. In the tree every declaration the pattern matches ends that way (206 lines), and a definition's first line ends in `{`, `}`, `(` or `,` (3086 lines); no declaration is split over lines, so none is lost. Overlap: #1325 changes `open_prs` in the same file and adds `tools/tests/test_pr_overlap.py`, #988 changes its `__main__` output; this change is in `scan` and its own test file, so they merge in any order. #1662 and #1623 add an `add_test` at the same place in the root `CMakeLists.txt`; whichever merges second rebases two lines. ### Tested - `python3 tools/tests/test_pr_overlap_exports.py` and `ctest -R pr_overlap_exports`: three cases over one diff: definitions of a POSIX export, an `sce` export with `noexcept`, a one-line body and a signature with the brace on the next line are exports; two declarations (one with `noexcept` and trailing spaces, kept in a separate string so an editor cannot strip them), a `_nid_no_patch` helper, a removed line and a context line are not. Written before the change; it fails on `main` with `AttributeError: module 'pr_overlap' has no attribute 'exports'` and passes with it. - `--branch` runs against the 200 newest open pull requests (the tool's current limit, which #1325 lifts), Linux, Python 3.12: - `feat/libkernel-socket-read-write` (#1727): `main`'s tool reports 9 rows, 6 of them `__error_nid_postfix` only (#1613, #1616, #1627, #1641, #1675, #1729); this one reports the 3 rows with conflicting lines (#1708, #1711, #1738) and nothing under "Same exports". - `feat/libkernel-mlock` (#1673): 1 row, #1633's conflicting line, with both. - `tools/check_conventions.py --base upstream/main` passes; `progress_report` and `import_audit` still pass. - The same Build workflow run on this commit in the fork's Actions (merged onto `main` 6b56175a), [run 37822121862](https://github.com/SleglJan/AnyPS5/actions/runs/37822121862): `pr_overlap_exports` passes its three repeats on Linux and Windows, full suite 474/474 on each, and the relinker job on Ubuntu, macOS and Windows, which the root `CMakeLists.txt` change triggers. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SleglJan commented 2026-10-08 20:47:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T20:47:54Z.


The Linux failure is agc_driver_buffer_format at the 120 s limit, unrelated to this change, which touches only tools/ and the root CMakeLists.txt. On main's own recent runs the test takes 12 to 15 s (runs 37829320117 and 37826284139), and the fork's run of this commit passed (SleglJan/AnyPS5 run 37822121862, 474/474 on Linux and Windows). A re-run should pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068762832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1741#issuecomment-6068762832). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-08T20:47:54Z. --- The Linux failure is `agc_driver_buffer_format` at the 120 s limit, unrelated to this change, which touches only `tools/` and the root `CMakeLists.txt`. On `main`'s own recent runs the test takes 12 to 15 s (runs 37829320117 and 37826284139), and the fork's run of this commit passed (SleglJan/AnyPS5 run 37822121862, 474/474 on Linux and Windows). A re-run should pass.
MarcZX10 commented 2026-10-09 01:56:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T01:56:52Z.


I verified the current head locally: test_pr_overlap_exports.py passes 3/3, and Conventions plus git diff --check pass. Before merge, CONTRIBUTING still requires rebasing: this head is 50 commits behind current main (f1451396, merge base 6b56175a). The overlap report also shows #1623 and #1662 touching the same root CMake test-registration line; please resolve/check that after rebasing and rerun the final-head checks. The latest upstream Linux Build failed at the 120 s agc_driver_buffer_format timeout while the fork run is reported green. My upstream access is pull-only, so I cannot rerun it. #1949 is a separate UTF-8 follow-up and should stay out of this PR’s export-detection scope.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6072678214 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1741#issuecomment-6072678214). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T01:56:52Z. --- I verified the current head locally: `test_pr_overlap_exports.py` passes 3/3, and Conventions plus `git diff --check` pass. Before merge, CONTRIBUTING still requires rebasing: this head is 50 commits behind current `main` (`f1451396`, merge base `6b56175a`). The overlap report also shows #1623 and #1662 touching the same root CMake test-registration line; please resolve/check that after rebasing and rerun the final-head checks. The latest upstream Linux Build failed at the 120 s `agc_driver_buffer_format` timeout while the fork run is reported green. My upstream access is pull-only, so I cannot rerun it. #1949 is a separate UTF-8 follow-up and should stay out of this PR’s export-detection scope.
rmz-24 commented 2026-10-09 13:10:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T13:10:16Z.


Windows run (Windows 11 Pro 25H2, Python 3.14), db7666b2 cherry-picked onto main d70b8998:

  • tools/tests/test_pr_overlap_exports.py: passes.
  • With tools/pr_overlap.py reset to main and the new tests kept: FAILED (errors=3), so the tests catch what the change fixes.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081547632 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1741#issuecomment-6081547632). Originally posted by [rmz-24](https://github.com/rmz-24) on 2026-10-09T13:10:16Z. --- Windows run (Windows 11 Pro 25H2, Python 3.14), db7666b2 cherry-picked onto `main` d70b8998: - `tools/tests/test_pr_overlap_exports.py`: passes. - With `tools/pr_overlap.py` reset to `main` and the new tests kept: `FAILED (errors=3)`, so the tests catch what the change fixes. AI-assisted: yes
SleglJan commented 2026-10-09 13:11:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-09T13:11:35Z.


Rebased onto main d70b8998; the one conflict was the test registration line in the root CMakeLists.txt, now after hardware_oracle's. On the new head db7666b2: test_pr_overlap_exports.py 3/3, tools/check_conventions.py --base main, git diff --check and tools/check_test_registration.py pass. #1623 and #1662 are closed. The open pull requests that touch tools/pr_overlap.py are #2134 (report encoding) and #1325 (overlap against every open pull request); neither touches the lines this one changes, and each merges cleanly with this branch. Full Linux and Windows builds of this head merged into main, with the relinker matrix, in the fork's Actions: https://github.com/SleglJan/AnyPS5/actions/runs/37932706208 (all jobs pass).

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081569077 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1741#issuecomment-6081569077). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-09T13:11:35Z. --- Rebased onto `main` d70b8998; the one conflict was the test registration line in the root CMakeLists.txt, now after `hardware_oracle`'s. On the new head db7666b2: `test_pr_overlap_exports.py` 3/3, `tools/check_conventions.py --base main`, `git diff --check` and `tools/check_test_registration.py` pass. #1623 and #1662 are closed. The open pull requests that touch `tools/pr_overlap.py` are #2134 (report encoding) and #1325 (overlap against every open pull request); neither touches the lines this one changes, and each merges cleanly with this branch. Full Linux and Windows builds of this head merged into `main`, with the relinker matrix, in the fork's Actions: https://github.com/SleglJan/AnyPS5/actions/runs/37932706208 (all jobs pass). AI-assisted: yes (Claude Code).
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!1741
No description provided.