feat(tools): validate complete patch catalogs offline #12263
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12263"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by WhiteAssassins on 2026-10-28T05:54:18Z.
What
Add
tools/validate_patch_catalog.py --catalog DIRto check every format-1 catalog entry offline before sharing it or running a catalog CI job. It reuses the advisor's index and entry validation, checks relative target paths, duplicate JSON keys and patch-file format, and reports all invalid entries with their catalog numbers. It also rejects duplicate IDs that could match one title build while allowing the same ID for mutually exclusive target hashes or another content version.The command needs no game files or relinker and does not download or apply patches. It performs structural checks; the relinker's stricter TOML parser and
--verify-patchesremain necessary to establish applicability. The advisor's recommendation behavior is unchanged. This follows #8900, #10719 and #11489 and supports the external catalog proposal in #8893.Malformed deeply nested
index.jsondata, deeply nested patch TOML, and a looping--catalogsymlink are reported as catalog errors with exit code2, without a traceback.Tested
python3 -m unittest tools.tests.test_validate_patch_catalog tools.tests.test_suggest_patchesand the same command with/usr/bin/python3.11(50 passed on each version). The CLI regressions check exit code2, no traceback, and preserved input for deeply nested JSON/TOML, looping catalog paths, and duplicate JSON keys.python3 core/relinker/relinker/tests/test_patch_advisor.py <relinker>passed with the real relinker.python3 tools/check_conventions.py --base origin/main,python3 tools/check_test_registration.py --scripts, andgit diff --check origin/main...HEADpassed.python3 tools/validate_patch_catalog.py --helppassed. No game files were used.tomllibrequirement. Python 3.9/3.10 was not available for a local CMake run.python3 tools/pr_overlap.py --branch feat/patch-catalog-validatorcompleted. I reviewed the sharedCMakeLists.txtandUSAGE.mdhunks it could not compare automatically; they concern other features.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file (n/a: Python tool only).mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T08:58:12Z.
Review: APPROVED
The validator reuses the advisor’s catalog and entry validation, then checks every entry independent of local title files, verifies patch format/target coverage, confines paths, and reports duplicate IDs only when entries could match the same title/version. The tests cover malformed entries, escaping and Windows-drive target paths, duplicate IDs, mutually exclusive hashes, and valid empty catalogs. I checked the PR head’s
validate_entryreturn shape and metadata validation; the validator uses them consistently. The reported Python 3.14 tests and current cross-platform relinker/ASan, Windows, conventions and eligibility checks pass. No blocking issue found.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T11:36:38Z.
Review: CHANGES_REQUESTED
Reviewed
1d7bdd81caac641370b5404feb45c26362e30359— request changes.[P2] Report decoder-depth failures as invalid catalogs —
tools/validate_patch_catalog.py:52–55. The new command documents exit 2 for invalid catalogs, but a valid JSON index whoseentriescontains 2,500 nested arrays escapes asRecursionError, prints a traceback and exits 1. The same CLI returns the intended exit 2 forentries: [null]and exit 0 for an empty catalog. A generated or malformed deep index therefore bypasses the validator's controlled failure contract. Catch the decoder-depth failure at the catalog boundary and add a real CLI regression that checks exit 2, no traceback and input preservation.Windows/Python 3.11: all 11 supplied validator tests passed; the existing advisor suite passed 33 cases with 2 symlink-privilege skips (35 total). The independent probe uses the exact submitted CLI and preserves each input. This is a new command, so missing old helper APIs are not behavioral regression proof. No game files or relinker-applicability claim is involved.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T17:25:14Z.
Review: APPROVED
Re-reviewed
c6c35d1a538929fdbcf11b428daa979af3dee1f7— approve. My decoder-depth change request is addressed: deeply nested index JSON and patch TOML now exit 2 without a traceback. Duplicate JSON keys and looping catalog paths are also rejected without modifying the input files. The default advisor path remains compatible.Windows/Python 3.11: the validator/advisor suites run 50 tests, with 47 passed and 3 symlink-privilege skips; the baseline advisor runs 35, with 33 passed and 2 skips. Independent CLI controls cover the original 2,500-level index, a 200,000-array index, nested patch TOML, duplicate top-level and entry keys, and an actual Windows junction loop, plus valid controls. All fixed-head invalid cases return 2 without a traceback and preserve every fixture file. The previously reviewed head still crashes on the depth/loop cases and silently accepts the duplicate-key controls.
A fresh Windows/GCC 15.3 Release relinker build passes the synthetic real-relinker advisor integration, and the registered validator CTest passes (14 passed, 1 symlink skip internally). Conventions, script registration and whitespace checks pass. The current Windows/Ubuntu relinker and ASan CI jobs pass; the macOS matrix remains pending. This approval closes the reviewed code defect; no console/title or game-file validation is claimed.