fix(tools): exclude parameter returns from empty progress classifications #14424

Merged
SHOnnay merged 2 commits from upstream-pr/14424 into main 2026-11-14 02:52:29 +00:00
SHOnnay commented 2026-11-01 12:25:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SHOnnay on 2026-11-01T12:25:52Z.


What

The progress scanner classified parameter returns such as WTF::fastMallocGoodSize(size) { return size; } as constant-return, behaviourally empty exports.

Pass parameter context through the inert-classification helpers and their direct callers so parameter returns are not treated as constants, while preserving the existing named-constant and empty-wrapper handling. The scanner remains heuristic; this does not implement full C++ constant resolution.

There is a one-line context overlap with #13801 at the inert_body call in scan_library; I will rebase if #13801 merges first.

Tested

macOS only: Apple M1, macOS 27.0.1 (26A434), Python 3.15.2. Baseline: ba627802e2.

  • python3 tools/tests/test_progress.py: with the same expanded tests, the original implementation ran 63 tests with 10 failures (including subtests); after the fix all 63 tests pass. pytest is not installed, so the existing unittest runner was used.
  • python3 tools/check_conventions.py --base upstream/main: all conventions checks passed.
  • python3 tools/progress.py --json on the same source tree before and after: library exports remain 8,998 implemented / 34,292 declared (26.24%); shader counts remain 1,166 / 1,166 (100%). All export name lists and other labels are identical. The only corrected label is _ZN3WTF18fastMallocGoodSizeEm, removed from inert_names.
  • python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/fix-progress-constant-returns: exit 2, failed closed because #13801 conflicts with main. Manually compared its unchanged head 22b41618e2; the known one-line context overlap is noted above, and the separate test block does not overlap its test hunks.
  • No generated progress output files are tracked or included in this PR.

Linux and Windows were not run locally. No GPU or game was tested.

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 (tools only)
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5107305623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14424). Originally posted by [SHOnnay](https://github.com/SHOnnay) on 2026-11-01T12:25:52Z. --- ### What The progress scanner classified parameter returns such as `WTF::fastMallocGoodSize(size) { return size; }` as constant-return, behaviourally empty exports. Pass parameter context through the inert-classification helpers and their direct callers so parameter returns are not treated as constants, while preserving the existing named-constant and empty-wrapper handling. The scanner remains heuristic; this does not implement full C++ constant resolution. There is a one-line context overlap with #13801 at the `inert_body` call in `scan_library`; I will rebase if #13801 merges first. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> macOS only: Apple M1, macOS 27.0.1 (26A434), Python 3.15.2. Baseline: `ba627802e2`. - `python3 tools/tests/test_progress.py`: with the same expanded tests, the original implementation ran 63 tests with 10 failures (including subtests); after the fix all 63 tests pass. `pytest` is not installed, so the existing unittest runner was used. - `python3 tools/check_conventions.py --base upstream/main`: all conventions checks passed. - `python3 tools/progress.py --json` on the same source tree before and after: library exports remain 8,998 implemented / 34,292 declared (26.24%); shader counts remain 1,166 / 1,166 (100%). All export name lists and other labels are identical. The only corrected label is `_ZN3WTF18fastMallocGoodSizeEm`, removed from `inert_names`. - `python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/fix-progress-constant-returns`: exit 2, failed closed because #13801 conflicts with main. Manually compared its unchanged head `22b41618e2`; the known one-line context overlap is noted above, and the separate test block does not overlap its test hunks. - No generated progress output files are tracked or included in this PR. Linux and Windows were not run locally. No GPU or game was tested. ### 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 (tools only) - [x] AI-assisted: yes (Codex)
MarcZX10 commented 2026-11-01 12:29:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T12:29:06Z.

Review: COMMENTED


Reviewed — no blocking findings

The change stops treating a returned parameter as a constant, the new tests fail on base as intended, and the hosted checks for this head are still queued.

What I ran

Head 4e6728f8bcc512fd7eb7b79c07b518e0abd8c748, base ba627802e2210187d417deb64c8f2fed8e33011f (the base the precheck used). Environment: Linux 6.1.0-54-amd64 (Debian 12), Python 3.11.2, git 2.39.5. No build or compile was run; the change is Python-only.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14424
git show 4e6728f8bc:tools/progress.py            # extracted to a scratch directory
git show 4e6728f8bc:tools/tests/test_progress.py # extracted to the same scratch directory
python3 /marc/AnyPS5/tools/pr_test_quality.py --root <scratch head copy> --json tools/progress.py tools/tests/test_progress.py

The precheck's test-quality helper was not present in the PR head tree, so I ran tools/pr_test_quality.py by hand against the extracted head files.

Results

Check Result
git diff --check (precheck) passed
Conventions and PR template, tools/check_conventions.py (precheck) passed
py_compile tools/progress.py (precheck) passed
python3 -m unittest tools.tests.test_progress at 4e6728f8bc (precheck, Python 3.11.2) 63 tests, OK
New test file run against base ba627802e2 (precheck negative control) 10 failures, all by assertion
pr_test_quality.py by hand 10 heuristic findings, all in existing tests (lines 26 to 305); none in the new class (lines 872 to 932)
Hosted conventions, labels, intake, eligibility and report queued at 4e6728f8bc when checked
Unedited output: head unit run (precheck stderr)
...............................................................
----------------------------------------------------------------------
Ran 63 tests in 0.345s

OK
Unedited output: negative control on base (precheck, final lines; the tracebacks above them are in the precheck report)
Ran 63 tests in 0.356s

FAILED (failures=10)

Negative control

Assertion Change to code under test New test failed?
return <parameter>; is not behaviourally empty (6 names) base tools/progress.py yes, 6 of 6 subtests
Pointer, function-pointer and reference parameters are not constants (3 forms) base tools/progress.py yes, 3 of 3 subtests
A wrapper that returns its parameter is not inert base tools/progress.py yes
Constant returns and constants in defaults and types stay inert base tools/progress.py no, as expected; they guard against over-correction

Findings

Blocking: none.

Non-blocking:

  1. Identifiers that are not parameters are still treated as constants. CONST_RETURN accepts any \w+ (line 35), and inert_statement rejects only names in parameters (lines 154 to 157). A body such as int APS5_VABI Get() { return gState; }, where gState is a non-constexpr file-scope variable, is still counted as inert. This is the same kind of false positive the PR fixes for parameters. I read this from the source at 4e6728f8bc; I did not run it. The PR body's "heuristic" sentence covers it in general. The smallest useful change is to name this case in the PR body so the remaining limit is explicit.

Sources

Not verified

  • The author's before and after tools/progress.py --json comparison (8,998 implemented and 34,292 declared exports, identical name lists) was not reproduced. I did not run progress.py from the PR head.
  • The author's macOS run (Apple M1, macOS 27.0.1, Python 3.15.2) is author-reported. My unit-test run was on Linux with Python 3.11.2.
  • Windows and Linux hosted results for this head were not available when checked; no result from them is claimed here.
  • pr_overlap.py failed closed on the #13801 conflict. The author's manual comparison at head 22b41618e2 was not re-run.

To get this to a good state

The hosted conventions and the Progress report job need to pass at 4e6728f8bc before approval. The non-blocking point is optional for merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728040814 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14424#pullrequestreview-5728040814). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T12:29:06Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The change stops treating a returned parameter as a constant, the new tests fail on base as intended, and the hosted checks for this head are still queued. ## What I ran Head `4e6728f8bcc512fd7eb7b79c07b518e0abd8c748`, base `ba627802e2210187d417deb64c8f2fed8e33011f` (the base the precheck used). Environment: Linux 6.1.0-54-amd64 (Debian 12), Python 3.11.2, git 2.39.5. No build or compile was run; the change is Python-only. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14424 git show 4e6728f8bc:tools/progress.py # extracted to a scratch directory git show 4e6728f8bc:tools/tests/test_progress.py # extracted to the same scratch directory python3 /marc/AnyPS5/tools/pr_test_quality.py --root <scratch head copy> --json tools/progress.py tools/tests/test_progress.py ``` The precheck's test-quality helper was not present in the PR head tree, so I ran `tools/pr_test_quality.py` by hand against the extracted head files. ## Results | Check | Result | |---|---| | `git diff --check` (precheck) | passed | | Conventions and PR template, `tools/check_conventions.py` (precheck) | passed | | `py_compile tools/progress.py` (precheck) | passed | | `python3 -m unittest tools.tests.test_progress` at 4e6728f8bc (precheck, Python 3.11.2) | 63 tests, OK | | New test file run against base `ba627802e2` (precheck negative control) | 10 failures, all by assertion | | `pr_test_quality.py` by hand | 10 heuristic findings, all in existing tests (lines 26 to 305); none in the new class (lines 872 to 932) | | Hosted conventions, labels, intake, eligibility and report | queued at 4e6728f8bc when checked | <details><summary>Unedited output: head unit run (precheck stderr)</summary> ```text ............................................................... ---------------------------------------------------------------------- Ran 63 tests in 0.345s OK ``` </details> <details><summary>Unedited output: negative control on base (precheck, final lines; the tracebacks above them are in the precheck report)</summary> ```text Ran 63 tests in 0.356s FAILED (failures=10) ``` </details> ## Negative control | Assertion | Change to code under test | New test failed? | |---|---|---| | `return <parameter>;` is not behaviourally empty (6 names) | base `tools/progress.py` | yes, 6 of 6 subtests | | Pointer, function-pointer and reference parameters are not constants (3 forms) | base `tools/progress.py` | yes, 3 of 3 subtests | | A wrapper that returns its parameter is not inert | base `tools/progress.py` | yes | | Constant returns and constants in defaults and types stay inert | base `tools/progress.py` | no, as expected; they guard against over-correction | ## Findings **Blocking:** none. **Non-blocking:** 1. Identifiers that are not parameters are still treated as constants. `CONST_RETURN` accepts any `\w+` ([line 35](https://github.com/boykopovar/AnyPS5/blob/4e6728f8bcc512fd7eb7b79c07b518e0abd8c748/tools/progress.py#L35)), and `inert_statement` rejects only names in `parameters` ([lines 154 to 157](https://github.com/boykopovar/AnyPS5/blob/4e6728f8bcc512fd7eb7b79c07b518e0abd8c748/tools/progress.py#L154-L157)). A body such as `int APS5_VABI Get() { return gState; }`, where `gState` is a non-`constexpr` file-scope variable, is still counted as inert. This is the same kind of false positive the PR fixes for parameters. I read this from the source at 4e6728f8bc; I did not run it. The PR body's "heuristic" sentence covers it in general. The smallest useful change is to name this case in the PR body so the remaining limit is explicit. ## Sources - [`tools/progress.py`, `CONST_RETURN`, line 35, at 4e6728f8bc](https://github.com/boykopovar/AnyPS5/blob/4e6728f8bcc512fd7eb7b79c07b518e0abd8c748/tools/progress.py#L35) - [`tools/progress.py`, `inert_statement`, lines 154 to 157, at 4e6728f8bc](https://github.com/boykopovar/AnyPS5/blob/4e6728f8bcc512fd7eb7b79c07b518e0abd8c748/tools/progress.py#L154-L157) - [`tools/tests/test_progress.py`, `ProgressConstantReturnTests`, lines 872 to 932, at 4e6728f8bc](https://github.com/boykopovar/AnyPS5/blob/4e6728f8bcc512fd7eb7b79c07b518e0abd8c748/tools/tests/test_progress.py#L872-L932) ## Not verified - The author's before and after `tools/progress.py --json` comparison (8,998 implemented and 34,292 declared exports, identical name lists) was not reproduced. I did not run `progress.py` from the PR head. - The author's macOS run (Apple M1, macOS 27.0.1, Python 3.15.2) is author-reported. My unit-test run was on Linux with Python 3.11.2. - Windows and Linux hosted results for this head were not available when checked; no result from them is claimed here. - `pr_overlap.py` failed closed on the #13801 conflict. The author's manual comparison at head `22b41618e2` was not re-run. ## To get this to a good state The hosted conventions and the Progress report job need to pass at 4e6728f8bc before approval. The non-blocking point is optional for merge.
MarcZX10 commented 2026-11-01 12:43:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T12:43:20Z.

Review: COMMENTED


Reviewed — no blocking findings

The progress scanner no longer counts a parameter returned as a constant stub, and the new unit tests pin the constant, default-argument, pointer and multi-statement cases; I found no blocking issue at 4e6728f8bc.

What I ran

Exact head 4e6728f8bcc512fd7eb7b79c07b518e0abd8c748; PR base ba627802e2210187d417deb64c8f2fed8e33011f (current main). I read the diff of tools/progress.py and tools/tests/test_progress.py, and ran the repository's convention checker from main against this head:

python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 4e6728f8bcc512fd7eb7b79c07b518e0abd8c748 --title "<PR title>" --body <PR body file>

Results

Check Result
Conventions and PR template Passed (All conventions checks passed.)
Source read of the scanner change No blocking finding
Unit tests Not run: the PR's tests are Python and were deliberately not executed, per the review rules for PR-code tests
Precheck Not run for this PR, because it executes the PR's related Python tests

Findings

Blocking: none.

Non-blocking: CONST_RETURN accepts any bare identifier (return \w+;), and the change excludes only the function's own parameters from that rule. A return of a non-parameter identifier, such as a global or static variable, is therefore still counted as a constant stub. That behaviour was already present before this PR and is not a regression, but it is the same class of error the PR fixes for parameters, so the same check could cover it.

Not verified

  • The PR's unit tests were not run, so the new assertions are read but not executed.
  • No hosted check result was read for this PR's Python tests.

To get this to a good state

No change is needed for this review. Optional: extend the parameter exclusion to non-parameter identifiers that name variables.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728103312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14424#pullrequestreview-5728103312). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T12:43:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The progress scanner no longer counts a parameter returned as a constant stub, and the new unit tests pin the constant, default-argument, pointer and multi-statement cases; I found no blocking issue at `4e6728f8bc`. ## What I ran Exact head `4e6728f8bcc512fd7eb7b79c07b518e0abd8c748`; PR base `ba627802e2210187d417deb64c8f2fed8e33011f` (current `main`). I read the diff of `tools/progress.py` and `tools/tests/test_progress.py`, and ran the repository's convention checker from `main` against this head: ```sh python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 4e6728f8bcc512fd7eb7b79c07b518e0abd8c748 --title "<PR title>" --body <PR body file> ``` ## Results | Check | Result | |---|---| | Conventions and PR template | Passed (`All conventions checks passed.`) | | Source read of the scanner change | No blocking finding | | Unit tests | Not run: the PR's tests are Python and were deliberately not executed, per the review rules for PR-code tests | | Precheck | Not run for this PR, because it executes the PR's related Python tests | ## Findings **Blocking:** none. **Non-blocking:** `CONST_RETURN` accepts any bare identifier (`return \w+;`), and the change excludes only the function's own parameters from that rule. A `return` of a non-parameter identifier, such as a global or static variable, is therefore still counted as a constant stub. That behaviour was already present before this PR and is not a regression, but it is the same class of error the PR fixes for parameters, so the same check could cover it. ## Not verified - The PR's unit tests were not run, so the new assertions are read but not executed. - No hosted check result was read for this PR's Python tests. ## To get this to a good state No change is needed for this review. Optional: extend the parameter exclusion to non-parameter identifiers that name variables.
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!14424
No description provided.