fix(build): isolate canonical runtime patch dependencies #19519

Merged
IvanFogel merged 2 commits from upstream-pr/19519 into main 2026-11-14 00:01:03 +00:00
IvanFogel commented 2026-11-13 13:04:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by IvanFogel on 2026-11-13T13:04:40Z.


What

Building one canonical patched runtime currently pulls every unpatched PRX into its dependency closure. Give each existing patched/copy output its own private owning target, and make the public libs aggregate depend on those targets. Focused builds retain their real libc/kernel/backend prerequisites; the full aggregate retains every output. Canonical copy/patch commands, export preservation, paths, optional runtime copies and the CMake 3.20 minimum stay unchanged.

Add a real-project Ninja graph regression and a compiler-free fixture that includes the production helper, proves selected-input invalidation, excludes an intentionally broken unrelated runtime from focused builds, and retains that failure in the full aggregate.

Tested

Current main refresh: d43d250189579f1c475481416841cdbe099cf099 on d261fa6f56657357c39d1d4c26ba2546a94add7e. Every own range-diff entry is unchanged. The actual repository Ninja dependency graph and helper CTests both pass. The helper also passes with Ninja Multi-Config, including focused copy/invalidation, rejection of unrelated failed runtime work, and the complete aggregate. Main already contains upstream CES revert bbc937d05536ad0dce4e7a91b90e0d20cbd21360; the four formerly timing-out cases pass under Wine on the current-main-based extrema candidate. This does not replace fresh upstream full Windows CI. Earlier exact-head results below remain historical, including external reports not rerun here. Refresh pins and full local qualification.

Linux x86-64, CachyOS/Arch, GCC 16.2.1 Release, Ninja 1.13.2. Candidate 0576bd5c2c04749a6ce5f7059b879a633e2e0840, based on main 269242f6e48117c444e6f2c3dfcea17561302a57.

  • Actual main graph fails the new regression because patched ICU requires unrelated Pad. Candidate passes. ICU and Pad each go from 413 unpatched PRX link outputs to their three actual requirements (selected library, libc, libkernel).
  • Matched main/candidate full aggregate: all 4,006 command strings match as sets, including all 413 canonical patch commands. The full candidate aggregate builds; patched_libraries loads all 413 libraries with zero failures.
  • All 16 selected nid_*/patched_libraries CTests pass without CTest skips. A real patched ICU NID call also distinguishes alphabetic ASCII/Greek/CJK input from a digit.
  • Production-helper fixture passes with CMake 3.20.6 and 4.4.5, each using Ninja and Ninja Multi-Config/Release. Selected changes regenerate the output; unrelated changes do not. The complete aggregate generates both patched outputs and the optional copy fixture after the broken runtime is repaired.
  • 69 build-selection/MinGW-host-target Python tests pass. Conventions against current origin/main and git diff --check pass.

Full runtime logs, aggregate equivalence, version matrix and manual overlap audit.

Canonical overlap scan and all 16 reported shared-file patches were inspected. Fifteen only add or adjust independent test registrations. #16793 adds independent APPLE-only executables immediately after the aggregate, giving a textual insertion conflict: a future composition must preserve this helper call and that APPLE block. No implementation duplication or semantic dependency was found; no agreed landing order or joint macOS run is claimed.

Full Windows/macOS builds were not run. Dependency-scope counts are graph evidence; no measured build-speed, FPS or title-unblock claim.

Refresh validation (2026-11-13): based on main c76eb6a26433216e2219fa9937e9cd57254be272, tested PR head f875fa2fd7cb1296256d50b8f456eefe99bbbb13.

All 16 NID/patched-library CTests passed without skips. The new graph regression fails on matched main and passes on this candidate. All 4007 aggregate command strings are unchanged as sets; the full candidate runtime aggregate builds and loads all 413 patched libraries. These are dependency and correctness checks, with no measured build-speed claim.

Refresh logs and installation/validation evidence. Earlier results above remain evidence for their explicitly recorded commits; old Windows/macOS CI reports were not rerun by this local validation. Fresh platform CI results are separate.

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:5295974539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19519). Originally posted by [IvanFogel](https://github.com/IvanFogel) on 2026-11-13T13:04:40Z. --- ### What Building one canonical patched runtime currently pulls every unpatched PRX into its dependency closure. Give each existing patched/copy output its own private owning target, and make the public `libs` aggregate depend on those targets. Focused builds retain their real libc/kernel/backend prerequisites; the full aggregate retains every output. Canonical copy/patch commands, export preservation, paths, optional runtime copies and the CMake 3.20 minimum stay unchanged. Add a real-project Ninja graph regression and a compiler-free fixture that includes the production helper, proves selected-input invalidation, excludes an intentionally broken unrelated runtime from focused builds, and retains that failure in the full aggregate. ### Tested Current main refresh: `d43d250189579f1c475481416841cdbe099cf099` on `d261fa6f56657357c39d1d4c26ba2546a94add7e`. Every own range-diff entry is unchanged. The actual repository Ninja dependency graph and helper CTests both pass. The helper also passes with Ninja Multi-Config, including focused copy/invalidation, rejection of unrelated failed runtime work, and the complete aggregate. Main already contains upstream CES revert `bbc937d05536ad0dce4e7a91b90e0d20cbd21360`; the four formerly timing-out cases pass under Wine on the current-main-based extrema candidate. This does not replace fresh upstream full Windows CI. Earlier exact-head results below remain historical, including external reports not rerun here. [Refresh pins and full local qualification](https://gist.github.com/IvanFogel/e3096e7ad75390006640ba809885967d). <!-- 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. --> Linux x86-64, CachyOS/Arch, GCC 16.2.1 Release, Ninja 1.13.2. Candidate `0576bd5c2c04749a6ce5f7059b879a633e2e0840`, based on main `269242f6e48117c444e6f2c3dfcea17561302a57`. - Actual main graph fails the new regression because patched ICU requires unrelated Pad. Candidate passes. ICU and Pad each go from 413 unpatched PRX link outputs to their three actual requirements (selected library, libc, libkernel). - Matched main/candidate full aggregate: all 4,006 command strings match as sets, including all 413 canonical patch commands. The full candidate aggregate builds; `patched_libraries` loads all 413 libraries with zero failures. - All 16 selected `nid_*`/`patched_libraries` CTests pass without CTest skips. A real patched ICU NID call also distinguishes alphabetic ASCII/Greek/CJK input from a digit. - Production-helper fixture passes with CMake 3.20.6 and 4.4.5, each using Ninja and Ninja Multi-Config/Release. Selected changes regenerate the output; unrelated changes do not. The complete aggregate generates both patched outputs and the optional copy fixture after the broken runtime is repaired. - 69 build-selection/MinGW-host-target Python tests pass. Conventions against current `origin/main` and `git diff --check` pass. [Full runtime logs, aggregate equivalence, version matrix and manual overlap audit](https://gist.github.com/IvanFogel/980f4f143baa8c2d15ec3cc838c38eb7). Canonical overlap scan and all 16 reported shared-file patches were inspected. Fifteen only add or adjust independent test registrations. #16793 adds independent APPLE-only executables immediately after the aggregate, giving a textual insertion conflict: a future composition must preserve this helper call and that APPLE block. No implementation duplication or semantic dependency was found; no agreed landing order or joint macOS run is claimed. Full Windows/macOS builds were not run. Dependency-scope counts are graph evidence; no measured build-speed, FPS or title-unblock claim. <!-- refresh-20261113-pr-19519 --> Refresh validation (2026-11-13): based on main `c76eb6a26433216e2219fa9937e9cd57254be272`, tested PR head `f875fa2fd7cb1296256d50b8f456eefe99bbbb13`. All 16 NID/patched-library CTests passed without skips. The new graph regression fails on matched main and passes on this candidate. All 4007 aggregate command strings are unchanged as sets; the full candidate runtime aggregate builds and loads all 413 patched libraries. These are dependency and correctness checks, with no measured build-speed claim. [Refresh logs and installation/validation evidence](https://gist.github.com/IvanFogel/66bd1758f9aa19acd831265c01a61f04). Earlier results above remain evidence for their explicitly recorded commits; old Windows/macOS CI reports were not rerun by this local validation. Fresh platform CI results are separate. <!-- /refresh-20261113 --> ### 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
Superseabas commented 2026-11-13 14:19:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-13T14:19:52Z.

Review: APPROVED


Windows check of head 0576bd5c2c with GCC 16, merged onto main c76eb6a264 (clean merge). It adds a main comparison, the full aggregate and a focused build to JJenkx's run of the two new tests above.

Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), CMake 4.4.4, Ninja 1.13.2, Release full build, run from PowerShell.

  • The graph, main vs this PR (ninja -t query / ninja -t commands on core/libs/libs/<lib>.prx):
    • On main, patched libSceIcu.prx and libScePad.prx each depend on all 413 unpatched .prx, and building either one takes 3339 commands.
    • With this PR, libSceIcu.prx depends only on unpatched/libSceIcu.prx, libc.prx and libkernel.prx, and takes 419 commands (libScePad.prx: 244).
    • Run against main's graph, the new script in --mode graph fails with focused libSceIcu patch requires unrelated libScePad. Against this PR's graph it passes.
  • The full aggregate is unchanged: ninja -t commands libs gives the same 3753 commands on main and this PR, with 0 lines different as sets. That includes the 413 nid_patcher patch commands and the Windows-only copies (mimalloc.dll, mimalloc-redirect.dll, the MinGW runtime DLLs).
  • A focused build on Windows: ninja core/libs/libs/libSceIcu.prx on a build last brought up to date days earlier ran 178 steps in 25 s. Those were the ICU objects, unpatched/libSceIcu.prx and its NID patch, and no other library. The full libs aggregate then built (2389 steps).
  • Tests: nid_patch_dependencies and nid_patch_dependencies_helper pass in 3 of 3 runs (0.4 s and 1.6 s, well inside the 20 s timeout). The helper fixture handles a temporary directory with spaces and C:\ paths. With the full aggregate built, ctest -R '^nid_|patched_libraries' passes 15 of 15, in 2 of 2 runs.

Reading the change: add_patched_runtime_targets attaches each output's custom command to exactly one libs_output_N target, so no output's command is shared between targets. libs keeps every output through add_dependencies, and patched_libraries_tests still depends on libs as before. The new tests are registered only for Ninja generators, which fits the ninja -t queries.

Not run: macOS, and Multi-Config generators on Windows.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5892586779 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19519#pullrequestreview-5892586779). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-13T14:19:52Z. **Review:** APPROVED --- Windows check of head `0576bd5c2c` with GCC 16, merged onto `main` `c76eb6a264` (clean merge). It adds a `main` comparison, the full aggregate and a focused build to JJenkx's run of the two new tests above. **Setup:** Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), CMake 4.4.4, Ninja 1.13.2, Release full build, run from PowerShell. - **The graph, `main` vs this PR** (`ninja -t query` / `ninja -t commands` on `core/libs/libs/<lib>.prx`): - On `main`, patched `libSceIcu.prx` and `libScePad.prx` each depend on all 413 unpatched `.prx`, and building either one takes 3339 commands. - With this PR, `libSceIcu.prx` depends only on `unpatched/libSceIcu.prx`, `libc.prx` and `libkernel.prx`, and takes 419 commands (`libScePad.prx`: 244). - Run against `main`'s graph, the new script in `--mode graph` fails with `focused libSceIcu patch requires unrelated libScePad`. Against this PR's graph it passes. - **The full aggregate is unchanged:** `ninja -t commands libs` gives the same 3753 commands on `main` and this PR, with 0 lines different as sets. That includes the 413 `nid_patcher` patch commands and the Windows-only copies (`mimalloc.dll`, `mimalloc-redirect.dll`, the MinGW runtime DLLs). - **A focused build on Windows:** `ninja core/libs/libs/libSceIcu.prx` on a build last brought up to date days earlier ran 178 steps in 25 s. Those were the ICU objects, `unpatched/libSceIcu.prx` and its NID patch, and no other library. The full `libs` aggregate then built (2389 steps). - **Tests:** `nid_patch_dependencies` and `nid_patch_dependencies_helper` pass in 3 of 3 runs (0.4 s and 1.6 s, well inside the 20 s timeout). The helper fixture handles a temporary directory with spaces and `C:\` paths. With the full aggregate built, `ctest -R '^nid_|patched_libraries'` passes 15 of 15, in 2 of 2 runs. **Reading the change:** `add_patched_runtime_targets` attaches each output's custom command to exactly one `libs_output_N` target, so no output's command is shared between targets. `libs` keeps every output through `add_dependencies`, and `patched_libraries_tests` still depends on `libs` as before. The new tests are registered only for Ninja generators, which fits the `ninja -t` queries. Not run: macOS, and Multi-Config generators on Windows. 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!19519
No description provided.