fix(tools): report deeply nested JSON as invalid input and run the reserved-name archive test #12266
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12266"
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 MarcZX10 on 2026-10-28T06:05:44Z.
What
Three defects in repository tooling. One commit each; the two Python fixes have a test commit each:
tools/hw-oracle/compare_results.py:read_reportpasses the file tojson.loads, and a report nested a few hundred thousand levels deep raisesRecursionError, whichmaindoes not catch. The command ended in a traceback with exit code 1, the code the tool documents as "different outputs", so a corrupt file looked like a hardware difference. It now raises aValueErrornaming the file, andmainreports it with exit code 2 like every other invalid report.tools/import_audit.py:read_registryandread_needed_registrycatchOSError,UnicodeDecodeErrorandJSONDecodeErrorbut notRecursionError.mainreturns 2 for anAuditErrorand 1 for missing imports, so a deeply nested registry ended in a traceback with exit code 1 and looked like a failed import audit.RecursionErroris now reported as anAuditError(exit code 2).tools/test_web.pylaunchedarchive-root,archive-windowsandarchive.testbut notdemo/web/tests/archive-reserved.test.mjs, which covers the superscript Windows device names added with3397e873bc. No workflow, script or CTest entry referenced it, so a regression invalidPathfor those names went unnoticed. It runs next to the other archive tests now. I did not run it (it needs a web build and the zip library download).Tested
python3 -m unittest test_compare_resultsintools/hw-oracle(12 tests) andpython3 -m unittest test_import_auditintools/tests(157 tests, 1 skipped) pass. Each of the two new tests fails againstmain's version of its script.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.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.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T11:22:36Z.
Review: APPROVED
Review of
70cd9c91c2, macOS arm64, run locally on this machine. The head merges cleanly ontomain3a40945e62.JSON depth (does the fixture trigger on every supported Python?)
json.loads("[" * n):At 20000 the input is caught on 3.14+ already. 200000 hits the uncaught path on all four versions, so the fixture depth is the right choice.
Python fixes
test_compare_results(12 tests) andtest_import_audit(157 tests, 1 skipped) pass on 3.9.6, 3.13 and 3.14.main(3.9.6), each module fails exactly one test: the new one.RecursionErrorfromread_registryonly, dropping it fromread_needed_registryonly, and changing thenested too deeplymessage. The second half of the import_audit test does its job.json.loadscall sites in these two files are all covered now.archive-reserved.test.mjswiring (the body says this was not run, so I ran it).build_web.copy_sourcescopiesdemo/webas-is, so I put a scratch<build>/webcopy together and fetched the pinned zip.js:node demo/web/tests/archive-reserved.test.mjs <build>/webexits 0 on Node 26.4.0.archive.mjsback to the regex from before3397e873bc(com[1-9]|lpt[1-9]), it fails withAssertionError: Missing expected exception., so the newly wired test does catch the regression it was written for.tools/test_web.py --build <scratch>run stops later, atarchive.test.mjs, because it needs the realnative/relinker_wasm.mjs. That is expected without a wasm build and is not part of this change.web-tests.ymltriggers ontools/test_web.pybut never runs it; it only runsarchive-rootplusnode --testfor 4 files.test_web.pyruns only inrelease.yml, so the reserved-name test will run at release time, not on PRs. Adding a step toweb-tests.ymlthe wayarchive-rootis wired would catch it per PR. That could be a follow-up.Gates (merged tree)
check_conventions --base upstream/mainpasses. Relinker-only build 270/270,ctest378/378.pr_overlapreports only #6171 and #7454 as not comparable (both conflicting) on the import_audit files; this diff adds lines to the except tuples and one test, so I don't see a topical overlap.Approving.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T11:26:52Z.
Review: APPROVED
Reviewed
70cd9c91c2afdb3348e644b83772346c7058acfc— approve. Deeply nested import registries are reported as invalid input instead of escaping as RecursionError. The Windows reserved-name archive case is enabled as part of this patch.Windows/Python 3.11: head test_import_audit.py: 154 passed, 3 skipped (157 total); base test_import_audit.py: 153 passed, 3 skipped (156 total). The new nested-registry case fails against old production with the reproduced RecursionError. This control establishes the parsing fix; it does not imply that every platform-only archive case executed. Full command/output evidence is retained locally. Hosted CI and mergeability are rechecked before publication. No game or full product execution is claimed.