feat(libSceJson2): implement allocator-backed values and recovery #10378

Merged
kyon-eth merged 120 commits from upstream-pr/10378 into main 2026-11-02 10:22:39 +00:00
kyon-eth commented 2026-10-23 20:04:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kyon-eth on 2026-10-23T20:04:19Z.


What

Implement allocator-backed Json2 values, object trees and iterators, auxiliary callback records, recovery fallbacks, and initialization resources. Preserve allocation ordering, partial failure states, ownership, callback precedence and retry behavior instead of using host-only storage or fabricated success results.

Implement 73 of the 74 inventory exports introduced by #9517. The remaining base allocator deleting destructor deliberately traps and stays explicitly unsupported. Correct member/callback signatures, setter return declarations, special-float settings and SDK-dependent storage behavior. Document remaining unsupported cases in the library debt file.

Expose the four read-only Boolean, signed-integer, unsigned-integer and real fallback objects and the three writable String, Array and Object fallback pointers. The pointers are published after construction, used by getters and initialization admission, and consumed and cleared during cleanup. When a getter reaches its default path, it returns the corresponding exported object's address; successful callback replacements retain their own addresses. These data NIDs also occur in libSceJson; this branch defines them in libSceJson2, and independently loaded provider resolution remains separate.

Original prerequisites #10212, #10353 and #8530 have merged into main. This branch retains their String/Array assignment and parser-cleanup regressions. There is no remaining landing dependency on those PRs.

Preserved the String overload cases from #10212 and the deep-copy/source-independence/self-assignment regression from #10353. Two String expectations are deliberately corrected: out-of-range at returns zero, and a null C-string needle is empty. Existing String boundary regressions cover those contracts. Array assignment keeps the SDK-dependent allocator ordering and partial-failure behavior covered by the allocator tests. The current debt file retains applicable limitations instead of restoring obsolete pending-export declarations.

Integrated #8530 in the agreed order. Array parsing continues to admit an owned placeholder through AppendArray before parsing its payload. Its expanded buffer/callback, malformed/nested, long-key and missing-key checks are retained, with expectations reconciled to the implemented ABI and measured partial-parser states. Host-allocation counts from the former list storage are not treated as guest-allocation coverage.

Other overlap review: #8658 decimal conversion, #9826 placeholder bodies, #6039 debt documentation and #6044 test organization. Same-name matches in #9470 belong to libSceJson, a different module. These are not prerequisites.

Tested

  • Current head: after merging main 50843f45d9, a fresh macOS x86-64 production-source fixture passed all 202 supported JSON tests, including scalar fallback addresses, writable pointer identity and replacement, allocator-callback publication and initialization rollback. A separate historical callback baseline timed out and is excluded from that supported suite. The four scalar objects were present at distinct read-only addresses and the three pointer symbols were exported as writable data in the linked fixture. No patched guest-import, Linux or Windows execution was performed on this head.
  • The refreshed open-PR scan checked 1,610 other PRs and found no overlapping changes.

Current-main refresh: merged 556547da71 in 3a9241afe5, retaining both the existing test links and the new C++23 requirement. The macOS x86-64 production-source fixture passes 202/202 registered guest_json cases; the public-header audit, conventions and whitespace checks pass. The fixture adapts unrelated libc/kernel boundaries; no full product build or new Linux/Windows run is claimed.

Current-main validation (2026-10-28): merged main 6a28efaa27 in da1fb929ea and reconciled its decimal-underflow fix with this PR's reference-backed ParseDecimal, allocator admission and AssignReal path. The registered decimal-range tests cover signed underflow to zero, subnormals and overflow settings. Rebuilt macOS x86-64 production-source fixture: 202/202 guest_json checks pass. Header audit, conventions, whitespace and privacy checks pass. This is a focused fixture with unrelated libc/kernel boundaries adapted, not a full product build.

Current-main validation (2026-10-27): integrated main 9ae2f7d22a in 34632912cf. All 202/202 supported Json2 CTest cases pass in the rebuilt macOS x86-64 production-source fixture. The fixture now also compiles the production macOS guest-image lookup required by main; unrelated libc/kernel boundaries remain substituted. Conventions, whitespace and privacy checks pass. The reviewer independently reports both focused Linux ownership/callback-thread cases passing, including a later QEMU TCG run. No complete Linux-suite or Windows runtime pass is claimed; Windows guest_json remains outstanding.

Historical integration: 18f7696bd6 includes main 941ace5f34 and merged #8530. The production-source macOS x86-64/Rosetta fixture rebuilt and passed 219/219 registered JSON checks, using production process-metadata lookup. File/mutex and unrelated libc boundaries remain substituted; the unsupported-export adapter uses the production diagnostic format. No full product, Linux/Windows or game run is claimed.

  • Retained #8530's expanded copy/parser/insertion checks and the existing iterator-copy and swap regressions. Setters use the canonical void ABI; malformed documents retain their measured partial trees instead of restoring the previous destination.
  • A guest-allocator sweep across 11 documents and both buffer/callback readers exercises 578 allocation failures, checks reachable payload ownership, retained trees, destruction and retry, and leaves no tracked guest allocations after cleanup. It separately observes 26 existing missing-sentinel refusals; these are explicitly unsupported, not successful native-compatible OOM handling. Exact reference-backed partial-state and callback regressions remain unchanged.
  • Negative control: temporarily parsing array payloads in detached values before list admission causes the new cleanup check to fail at allocation budget 11 with unreachable guest allocations. Restored the original ownership-first implementation, forced its object to rebuild, then reran the full 219-check suite successfully.
  • Public-header audit, standalone Json2 umbrella compilation, current-main conventions, strict main-sync and whitespace checks pass. No private names/paths or unrelated library work added.

Previous public-header integration (7f0fe1d09b, main 2e22b67032): reconciled #10706's public-header migration with the implemented ABI layouts and signatures. All Json2 callers/tests use the canonical declarations; raw parameter/layout fixtures retain explicit ABI casts. Private storage helpers remain outside the exported API through a header-derived linker export list, including the existing String::npos data symbol.

  • The production-source macOS x86-64/Rosetta fixture rebuilds and all 219/219 registered module checks pass, using production process-metadata lookup. This is not a full application or Linux/Windows run.
  • All 214 existing Export.cpp function bodies are unchanged by this integration. The built module exports exactly the 216 declared API function/data symbols, with no extra private storage helpers.
  • Repository-wide public-header audit, standalone Json2 umbrella compilation, current-main conventions and whitespace checks pass. Earlier ARM64 results below predate this integration.
  • That earlier run preceded #8530; the combined validation is recorded above.

Overlap follow-up: added a bounded guest-allocation sweep for [1] and malformed [1, parsed into an already owned empty array, through buffer and callback readers. It checks public error propagation, admitted entry ownership, cleanup and retry of the same destination. Existing measured partial-array and nested-parser expectations remain intact. Seven focused parser/allocator/callback checks pass per macOS architecture. This earlier check preceded the combined #8530 validation above. The missing-sentinel refusal remains documented and unsupported.

Allocation-failure follow-up on main c9b2660d56: reproduced the two reported macOS failures with the production ApplicationProcessParameters.cpp lookup instead of the earlier null-returning metadata adapter. A missing process-metadata lookup throws std::runtime_error; repeatedly constructing that exception can allocate from the host heap while the tests deliberately disable host allocations. Json2 now remembers a failed lookup with an atomic flag and keeps the existing unknown-SDK fallback. Successful metadata queries remain unchanged, preserving SDK-dependent behavior. Main-executable metadata cannot appear later without relinking/restarting the process.

  • On the updated source, all 219 module CTest cases pass on macOS x86-64/Rosetta, including both reported failures and the SDK 5/6 initialization regression, using the real production metadata-lookup implementation. File/mutex and other unrelated libc boundaries remain substituted; this is not a full application or complete libc/kernel integration build.
  • All 219 module cases also pass on macOS ARM64 with the original boundary fixture; the two affected cases additionally pass on ARM64 with the real metadata-lookup implementation.
  • No assertions were removed or weakened. No Linux/Windows execution or full 222-case application-suite result is claimed for this follow-up.

Latest review check: the reported PS4 Pro 10.71 measurements corroborate the measured iterator ABI, allocator slots, constructor footprints and Array assignment results. Added the exact {"a":} case to the existing parser-state regression: parsing returns 0x80848101, public getType() returns object (7), a later parse succeeds and teardown reclaims the admitted storage. This behavior already worked on this branch; no parser implementation change was needed. These PS4 observations do not establish PS5 console or cross-firmware compatibility.

  • Existing cases check object-tree invariants, iterator identity, nested copies, allocation failures, callback ABI/precedence, metadata ownership, initialization rollback, exception state and retry. No new export-only tests.
  • Checked Windows CTest DLL-search-path metadata for 69 lifecycle cases. Linux and Windows binaries/runtime execution were not tested.
  • Local conventions checks, including this PR template, pass. The full open-PR overlap check and branch privacy/export checks were performed; declared overlaps are listed above. No demonstrated game unblock or performance claim.

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

Review follow-up: descendant assignment now snapshots aliased payloads before releasing the owning tree; allocation bookkeeping no longer nests the legacy shared recovery mutex under the host state mutex. Public-entry ownership regressions reproduce the old failure. A coordinated legacy mismatch/parser test times out on the old implementation and completes on the fix. Supported Json2 tests pass 202/202 in the rebuilt macOS production-source fixture. Explicitly unsupported throw-pinning tests were removed, while supported rollback, callback exceptions and returning retries remain.

Windows export generation now marks String::npos DATA and retains function exports normally. The real CMake generator produces 216 entries with exactly that one DATA export. This is generation validation, not a Windows runtime rerun. File mocks include the kernel API header and use int descriptors. The vector insertion behind the reported GCC warning was rewritten as equivalent element appends; the independent Linux ASan/LSan report on the prior code found no overflow. No Linux/Windows execution by the author is claimed for this update. Overlapping ancestor/descendant swaps are explicitly unsupported before mutation pending a verified reference contract; partial object-allocation and null-callback-cycle gaps remain documented.

The callback-thread test substitutes the application-heap allocation entry points and kernel mutex primitives; it exercises the real Json2 state locks, mismatch callback and parser. Its five-word SDK fixture supplies only the compatibility SDK query and is not presented as real application-heap metadata. The substitution now also checks that every legacy application-heap allocation is released. The prior implementation still times out with that corrected fixture and the fixed implementation completes. The raw Object descendant setter also has a public-entry regression alongside Array/String/Value assignment.

The Windows CI failure on the previous head reported ambiguous fallback-data references. The seven definitions now use the namespace of their declarations while retaining C linkage. The macOS production-source fixture rebuilds and all 202 registered tests pass; Windows CI passed on head 881f168de66d.

Independent platform evidence

Native supported-CPU Windows report validates prior exact head 34632912cf: 202 registered groups, three runs each (606 successes), including the String::npos DATA import. It closes the previously missing Windows evidence for that head. It predates this main merge; no current-head Windows rerun is claimed. The Linux report on that head also predates this merge and documents an unsupported-CPU guard bypass, so it is not a supported-CPU Linux result.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4988577012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378). Originally posted by [kyon-eth](https://github.com/kyon-eth) on 2026-10-23T20:04:19Z. --- ### What Implement allocator-backed Json2 values, object trees and iterators, auxiliary callback records, recovery fallbacks, and initialization resources. Preserve allocation ordering, partial failure states, ownership, callback precedence and retry behavior instead of using host-only storage or fabricated success results. Implement 73 of the 74 inventory exports introduced by #9517. The remaining base allocator deleting destructor deliberately traps and stays explicitly unsupported. Correct member/callback signatures, setter return declarations, special-float settings and SDK-dependent storage behavior. Document remaining unsupported cases in the library debt file. Expose the four read-only Boolean, signed-integer, unsigned-integer and real fallback objects and the three writable String, Array and Object fallback pointers. The pointers are published after construction, used by getters and initialization admission, and consumed and cleared during cleanup. When a getter reaches its default path, it returns the corresponding exported object's address; successful callback replacements retain their own addresses. These data NIDs also occur in `libSceJson`; this branch defines them in `libSceJson2`, and independently loaded provider resolution remains separate. Original prerequisites #10212, #10353 and #8530 have merged into main. This branch retains their String/Array assignment and parser-cleanup regressions. There is no remaining landing dependency on those PRs. Preserved the String overload cases from #10212 and the deep-copy/source-independence/self-assignment regression from #10353. Two String expectations are deliberately corrected: out-of-range `at` returns zero, and a null C-string needle is empty. Existing String boundary regressions cover those contracts. Array assignment keeps the SDK-dependent allocator ordering and partial-failure behavior covered by the allocator tests. The current debt file retains applicable limitations instead of restoring obsolete pending-export declarations. Integrated #8530 in the agreed order. Array parsing continues to admit an owned placeholder through `AppendArray` before parsing its payload. Its expanded buffer/callback, malformed/nested, long-key and missing-key checks are retained, with expectations reconciled to the implemented ABI and measured partial-parser states. Host-allocation counts from the former list storage are not treated as guest-allocation coverage. Other overlap review: #8658 decimal conversion, #9826 placeholder bodies, #6039 debt documentation and #6044 test organization. Same-name matches in #9470 belong to libSceJson, a different module. These are not prerequisites. ### Tested - Current head: after merging main 50843f45d9, a fresh macOS x86-64 production-source fixture passed all 202 supported JSON tests, including scalar fallback addresses, writable pointer identity and replacement, allocator-callback publication and initialization rollback. A separate historical callback baseline timed out and is excluded from that supported suite. The four scalar objects were present at distinct read-only addresses and the three pointer symbols were exported as writable data in the linked fixture. No patched guest-import, Linux or Windows execution was performed on this head. - The refreshed open-PR scan checked 1,610 other PRs and found no overlapping changes. Current-main refresh: merged `556547da71` in `3a9241afe5`, retaining both the existing test links and the new C++23 requirement. The macOS x86-64 production-source fixture passes 202/202 registered `guest_json` cases; the public-header audit, conventions and whitespace checks pass. The fixture adapts unrelated libc/kernel boundaries; no full product build or new Linux/Windows run is claimed. Current-main validation (2026-10-28): merged main `6a28efaa27` in `da1fb929ea` and reconciled its decimal-underflow fix with this PR's reference-backed `ParseDecimal`, allocator admission and `AssignReal` path. The registered decimal-range tests cover signed underflow to zero, subnormals and overflow settings. Rebuilt macOS x86-64 production-source fixture: **202/202 `guest_json` checks pass**. Header audit, conventions, whitespace and privacy checks pass. This is a focused fixture with unrelated libc/kernel boundaries adapted, not a full product build. Current-main validation (2026-10-27): integrated main `9ae2f7d22a` in `34632912cf`. All **202/202 supported Json2 CTest cases pass** in the rebuilt macOS x86-64 production-source fixture. The fixture now also compiles the production macOS guest-image lookup required by main; unrelated libc/kernel boundaries remain substituted. Conventions, whitespace and privacy checks pass. The reviewer independently reports both focused Linux ownership/callback-thread cases passing, including a later QEMU TCG run. No complete Linux-suite or Windows runtime pass is claimed; Windows `guest_json` remains outstanding. Historical integration: `18f7696bd6` includes main `941ace5f34` and merged #8530. The production-source macOS x86-64/Rosetta fixture rebuilt and passed **219/219 registered JSON checks**, using production process-metadata lookup. File/mutex and unrelated libc boundaries remain substituted; the unsupported-export adapter uses the production diagnostic format. No full product, Linux/Windows or game run is claimed. - Retained #8530's expanded copy/parser/insertion checks and the existing iterator-copy and swap regressions. Setters use the canonical void ABI; malformed documents retain their measured partial trees instead of restoring the previous destination. - A guest-allocator sweep across 11 documents and both buffer/callback readers exercises **578 allocation failures**, checks reachable payload ownership, retained trees, destruction and retry, and leaves no tracked guest allocations after cleanup. It separately observes **26 existing missing-sentinel refusals**; these are explicitly unsupported, not successful native-compatible OOM handling. Exact reference-backed partial-state and callback regressions remain unchanged. - Negative control: temporarily parsing array payloads in detached values before list admission causes the new cleanup check to fail at allocation budget 11 with unreachable guest allocations. Restored the original ownership-first implementation, forced its object to rebuild, then reran the full 219-check suite successfully. - Public-header audit, standalone Json2 umbrella compilation, current-main conventions, strict main-sync and whitespace checks pass. No private names/paths or unrelated library work added. Previous public-header integration (`7f0fe1d09b`, main `2e22b67032`): reconciled #10706's public-header migration with the implemented ABI layouts and signatures. All Json2 callers/tests use the canonical declarations; raw parameter/layout fixtures retain explicit ABI casts. Private storage helpers remain outside the exported API through a header-derived linker export list, including the existing `String::npos` data symbol. - The production-source macOS x86-64/Rosetta fixture rebuilds and all **219/219 registered module checks pass**, using production process-metadata lookup. This is not a full application or Linux/Windows run. - All 214 existing `Export.cpp` function bodies are unchanged by this integration. The built module exports exactly the 216 declared API function/data symbols, with no extra private storage helpers. - Repository-wide public-header audit, standalone Json2 umbrella compilation, current-main conventions and whitespace checks pass. Earlier ARM64 results below predate this integration. - That earlier run preceded #8530; the combined validation is recorded above. Overlap follow-up: added a bounded guest-allocation sweep for `[1]` and malformed `[1,` parsed into an already owned empty array, through buffer and callback readers. It checks public error propagation, admitted entry ownership, cleanup and retry of the same destination. Existing measured partial-array and nested-parser expectations remain intact. Seven focused parser/allocator/callback checks pass per macOS architecture. This earlier check preceded the combined #8530 validation above. The missing-sentinel refusal remains documented and unsupported. Allocation-failure follow-up on main `c9b2660d56`: reproduced the [two reported macOS failures](https://github.com/boykopovar/AnyPS5/pull/10378#issuecomment-6382365509) with the production `ApplicationProcessParameters.cpp` lookup instead of the earlier null-returning metadata adapter. A missing process-metadata lookup throws `std::runtime_error`; repeatedly constructing that exception can allocate from the host heap while the tests deliberately disable host allocations. Json2 now remembers a failed lookup with an atomic flag and keeps the existing unknown-SDK fallback. Successful metadata queries remain unchanged, preserving SDK-dependent behavior. Main-executable metadata cannot appear later without relinking/restarting the process. - On the updated source, all **219 module CTest cases pass on macOS x86-64/Rosetta**, including both reported failures and the SDK 5/6 initialization regression, using the real production metadata-lookup implementation. File/mutex and other unrelated libc boundaries remain substituted; this is not a full application or complete libc/kernel integration build. - All **219 module cases also pass on macOS ARM64** with the original boundary fixture; the two affected cases additionally pass on ARM64 with the real metadata-lookup implementation. - No assertions were removed or weakened. No Linux/Windows execution or full 222-case application-suite result is claimed for this follow-up. Latest review check: the [reported PS4 Pro 10.71 measurements](https://github.com/boykopovar/AnyPS5/pull/10378#issuecomment-6376034872) corroborate the measured iterator ABI, allocator slots, constructor footprints and Array assignment results. Added the exact `{"a":}` case to the existing parser-state regression: parsing returns `0x80848101`, public `getType()` returns object (7), a later parse succeeds and teardown reclaims the admitted storage. This behavior already worked on this branch; no parser implementation change was needed. These PS4 observations do not establish PS5 console or cross-firmware compatibility. - Existing cases check object-tree invariants, iterator identity, nested copies, allocation failures, callback ABI/precedence, metadata ownership, initialization rollback, exception state and retry. No new export-only tests. - Checked Windows CTest DLL-search-path metadata for 69 lifecycle cases. Linux and Windows binaries/runtime execution were not tested. - Local conventions checks, including this PR template, pass. The full open-PR overlap check and branch privacy/export checks were performed; declared overlaps are listed above. No demonstrated game unblock or performance claim. <!-- 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. --> ### 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 Review follow-up: descendant assignment now snapshots aliased payloads before releasing the owning tree; allocation bookkeeping no longer nests the legacy shared recovery mutex under the host state mutex. Public-entry ownership regressions reproduce the old failure. A coordinated legacy mismatch/parser test times out on the old implementation and completes on the fix. Supported Json2 tests pass 202/202 in the rebuilt macOS production-source fixture. Explicitly unsupported throw-pinning tests were removed, while supported rollback, callback exceptions and returning retries remain. Windows export generation now marks String::npos DATA and retains function exports normally. The real CMake generator produces 216 entries with exactly that one DATA export. This is generation validation, not a Windows runtime rerun. File mocks include the kernel API header and use int descriptors. The vector insertion behind the reported GCC warning was rewritten as equivalent element appends; the independent Linux ASan/LSan report on the prior code found no overflow. No Linux/Windows execution by the author is claimed for this update. Overlapping ancestor/descendant swaps are explicitly unsupported before mutation pending a verified reference contract; partial object-allocation and null-callback-cycle gaps remain documented. The callback-thread test substitutes the application-heap allocation entry points and kernel mutex primitives; it exercises the real Json2 state locks, mismatch callback and parser. Its five-word SDK fixture supplies only the compatibility SDK query and is not presented as real application-heap metadata. The substitution now also checks that every legacy application-heap allocation is released. The prior implementation still times out with that corrected fixture and the fixed implementation completes. The raw Object descendant setter also has a public-entry regression alongside Array/String/Value assignment. The Windows CI failure on the previous head reported ambiguous fallback-data references. The seven definitions now use the namespace of their declarations while retaining C linkage. The macOS production-source fixture rebuilds and all 202 registered tests pass; [Windows CI](https://github.com/boykopovar/AnyPS5/actions/runs/41130339097/job/124322628905) passed on head `881f168de66d`. ### Independent platform evidence [Native supported-CPU Windows report](https://github.com/boykopovar/AnyPS5/pull/10378#issuecomment-6450590328) validates prior exact head `34632912cf`: 202 registered groups, three runs each (606 successes), including the `String::npos DATA` import. It closes the previously missing Windows evidence for that head. It predates this main merge; no current-head Windows rerun is claimed. The Linux report on that head also predates this merge and documents an unsupported-CPU guard bypass, so it is not a supported-CPU Linux result.
MarcZX10 commented 2026-10-23 20:07:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T20:07:16Z.

Review: CHANGES_REQUESTED


I reviewed the exact head d88f434966 and the declared overlaps. This branch changes the same Json2 exports and shared files as open #10212 and #10353; direct git merge-tree --write-tree previews conflict in Export.cpp, InventoryExports.cpp and libSceJson2.md with #10212, and additionally GuestJson.cpp with #10353. The checklist is intentionally unchecked for duplicate functions, but Depends on: none and the description says only that coordination is needed; it does not record an agreed order. CONTRIBUTING requires the authors to agree which overlapping work lands first and list prerequisites. Please coordinate with #10212/#10353 authors, update the dependency/order and keep both branches' distinct tests and debt entries in the final tree. This is a merge-order request, not a conclusion that the broader allocator/recovery work is duplicate or unnecessary. Hosted conventions and labels are still pending, so I have not approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5633847799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5633847799). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T20:07:16Z. **Review:** CHANGES_REQUESTED --- I reviewed the exact head d88f4349662b2e49e07036c4763c041989a99d9c and the declared overlaps. This branch changes the same Json2 exports and shared files as open #10212 and #10353; direct `git merge-tree --write-tree` previews conflict in `Export.cpp`, `InventoryExports.cpp` and `libSceJson2.md` with #10212, and additionally `GuestJson.cpp` with #10353. The checklist is intentionally unchecked for duplicate functions, but `Depends on: none` and the description says only that coordination is needed; it does not record an agreed order. CONTRIBUTING requires the authors to agree which overlapping work lands first and list prerequisites. Please coordinate with #10212/#10353 authors, update the dependency/order and keep both branches' distinct tests and debt entries in the final tree. This is a merge-order request, not a conclusion that the broader allocator/recovery work is duplicate or unnecessary. Hosted conventions and labels are still pending, so I have not approved.
jotitadev commented 2026-10-27 01:22:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T01:22:28Z.

Review: COMMENTED


Linux data point for the memcpy warning question above, plus a Linux run of the current head.

Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON. Head 18f7696bd merged onto main e2d457be3 (clean).

  • All 222 json tests pass on Linux, guest_json among them (it fails at line 647 on Windows).
  • GCC 15.2 on Linux gives the same warning: writing 128 bytes into a region of size 24, inlined from CheckInheritedMap at GuestJsonLegacyHandlers.cpp:429.
  • ASan. I rebuilt only guest_json_legacy_handlers_tests (the test TU and libSceJson2/Export.cpp) with -O1 -g -fsanitize=address, linked against the normal libc.prx/libkernel.prx, and ran all 40 registered argument sets with detect_leaks=1. That includes the no-argument run that reaches CheckInheritedMap. All exit 0, with no ASan or LSan report. So on this run, the warning looks like a GCC -Wstringop-overflow false positive on vector::insert after the two push_backs, not a real overflow.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661176284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5661176284). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T01:22:28Z. **Review:** COMMENTED --- Linux data point for the `memcpy` warning question above, plus a Linux run of the current head. Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `18f7696bd` merged onto `main` `e2d457be3` (clean). - All 222 `json` tests pass on Linux, `guest_json` among them (it fails at line 647 on Windows). - GCC 15.2 on Linux gives the same warning: `writing 128 bytes into a region of size 24`, inlined from `CheckInheritedMap` at `GuestJsonLegacyHandlers.cpp:429`. - ASan. I rebuilt only `guest_json_legacy_handlers_tests` (the test TU and `libSceJson2/Export.cpp`) with `-O1 -g -fsanitize=address`, linked against the normal `libc.prx`/`libkernel.prx`, and ran all 40 registered argument sets with `detect_leaks=1`. That includes the no-argument run that reaches `CheckInheritedMap`. All exit 0, with no ASan or LSan report. So on this run, the warning looks like a GCC `-Wstringop-overflow` false positive on `vector::insert` after the two `push_back`s, not a real overflow. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-27 05:32:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:32:04Z.

Review: CHANGES_REQUESTED


The Windows export list still treats String::npos as a function. include/Api.hpp declares _ZN3sce4Json6String4nposE as an extern std::size_t data object (line 93), but the WIN32 branch in CMakeLists.txt extracts every _ZN... declaration and writes the names to json2.def without a DATA attribute (lines 8–23). The Windows import library therefore creates a function-style import for this data symbol, and the new guest_json assertion reads the import thunk as the value at line 647. This is the reported Windows failure: guest_json fails at this assertion, while the other 218 tests pass; the discussion reports that marking data exports DATA makes all 222 Linux-style JSON tests pass on Windows.

Please generate the .def entry with DATA for declarations that are data objects (currently String::npos) and retain ordinary function entries for the rest. Then rerun the Windows guest_json test at this head. The current PR checks skip both Windows and Linux build jobs due to path policy, so they do not cover this regression. I could not reproduce the Windows executable locally: the installed MinGW cross-toolchain is missing the required runtime DLL, and the local Linux configure is blocked because SDL2 development files are unavailable.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662648570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5662648570). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T05:32:04Z. **Review:** CHANGES_REQUESTED --- The Windows export list still treats `String::npos` as a function. `include/Api.hpp` declares `_ZN3sce4Json6String4nposE` as an `extern std::size_t` data object (line 93), but the `WIN32` branch in `CMakeLists.txt` extracts every `_ZN...` declaration and writes the names to `json2.def` without a `DATA` attribute (lines 8–23). The Windows import library therefore creates a function-style import for this data symbol, and the new `guest_json` assertion reads the import thunk as the value at line 647. This is the reported Windows failure: `guest_json` fails at this assertion, while the other 218 tests pass; the discussion reports that marking data exports `DATA` makes all 222 Linux-style JSON tests pass on Windows. Please generate the `.def` entry with `DATA` for declarations that are data objects (currently `String::npos`) and retain ordinary function entries for the rest. Then rerun the Windows `guest_json` test at this head. The current PR checks skip both Windows and Linux build jobs due to path policy, so they do not cover this regression. I could not reproduce the Windows executable locally: the installed MinGW cross-toolchain is missing the required runtime DLL, and the local Linux configure is blocked because SDL2 development files are unavailable.
MarcZX10 commented 2026-10-27 05:57:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:57:45Z.

Review: CHANGES_REQUESTED


The previous Windows export blocker is fixed in this head: the generated .def now marks the data symbol String::npos as DATA. I also built guest_json_tests and the new guest_json_callback_threads_tests from this head on Linux. The existing guest_json test passes when I temporarily bypass only this host's unsupported-CPU guard in the isolated review checkout.

The new callback-thread test fails before reaching its assertions with application heap: invalid process parameters. Its ApplicationProcessParameters_nid_no_patch() fixture at core/libs/tests/GuestJsonCallbackThreads.cpp:13-15 returns five zero-initialized uint32_t words with 0x05000000 at offset 16. ApplicationHeapInitialize requires a process-parameter length of at least 0x40 and the 0x4942524f magic at offset 8, then reads nested libc and allocator-replacement records. The fixture therefore cannot initialize the application heap, so the test does not exercise the regression it was added to cover. Please provide a valid process-parameter/allocator fixture (or mock the application-heap boundary) and rerun this test.

The host CPU guard bypass was confined to the temporary review checkout and has been restored. Without it, the local host (Xeon E5-1620 v2) cannot execute guest tests because it lacks required AVX2-era features. Hosted Linux and Windows product jobs are currently skipped by path policy, so this new test failure is not covered there.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662836347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5662836347). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T05:57:45Z. **Review:** CHANGES_REQUESTED --- The previous Windows export blocker is fixed in this head: the generated `.def` now marks the data symbol `String::npos` as `DATA`. I also built `guest_json_tests` and the new `guest_json_callback_threads_tests` from this head on Linux. The existing `guest_json` test passes when I temporarily bypass only this host's unsupported-CPU guard in the isolated review checkout. The new callback-thread test fails before reaching its assertions with `application heap: invalid process parameters`. Its `ApplicationProcessParameters_nid_no_patch()` fixture at `core/libs/tests/GuestJsonCallbackThreads.cpp:13-15` returns five zero-initialized `uint32_t` words with `0x05000000` at offset 16. `ApplicationHeapInitialize` requires a process-parameter length of at least `0x40` and the `0x4942524f` magic at offset 8, then reads nested libc and allocator-replacement records. The fixture therefore cannot initialize the application heap, so the test does not exercise the regression it was added to cover. Please provide a valid process-parameter/allocator fixture (or mock the application-heap boundary) and rerun this test. The host CPU guard bypass was confined to the temporary review checkout and has been restored. Without it, the local host (Xeon E5-1620 v2) cannot execute guest tests because it lacks required AVX2-era features. Hosted Linux and Windows product jobs are currently skipped by path policy, so this new test failure is not covered there.
MarcZX10 commented 2026-10-27 09:04:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T09:04:20Z.

Review: COMMENTED


Follow-up on exact head 3e03f8df73d6b02e1f1f70e1af86d2fcc259e450:

  • The callback-thread fixture issue from my previous review is fixed in 397f3e3ca2: it now mocks the public legacy allocation/deallocation entry points and checks that those allocations balance after teardown.
  • I configured and built the exact head's guest_json_callback_threads_tests and guest_json_value_ownership_tests targets on Linux. Both focused CTest cases pass (2/2) after temporarily bypassing only the static host CPU guard in the isolated review checkout; the Xeon E5-1620 v2 host lacks the AVX2-era features required by AnyPS5. I restored the guard and rebuilt the normal library and test executables. The isolated checkout is clean.
  • The latest reported macOS fixture result is 202/202 Json2 tests, as reported by the author; I did not independently run that fixture.
  • The Windows String::npos export now carries DATA in the generated .def, addressing the previous import-thunk defect. The Windows job is skipped by this PR's automatic path filter. I attempted the repository-documented manual full build workflow, but GitHub rejected dispatch with HTTP 403 (Must have admin rights to Repository), so no remote build was started.

The targeted Linux changes now pass, but I still cannot independently verify the Windows import at runtime or run the full platform suite here. I am leaving this as a comment rather than approving; a Windows guest_json run on this exact head would close the outstanding platform check.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5664549880 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5664549880). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T09:04:20Z. **Review:** COMMENTED --- Follow-up on exact head `3e03f8df73d6b02e1f1f70e1af86d2fcc259e450`: - The callback-thread fixture issue from my previous review is fixed in `397f3e3ca2`: it now mocks the public legacy allocation/deallocation entry points and checks that those allocations balance after teardown. - I configured and built the exact head's `guest_json_callback_threads_tests` and `guest_json_value_ownership_tests` targets on Linux. Both focused CTest cases pass (2/2) after temporarily bypassing only the static host CPU guard in the isolated review checkout; the Xeon E5-1620 v2 host lacks the AVX2-era features required by AnyPS5. I restored the guard and rebuilt the normal library and test executables. The isolated checkout is clean. - The latest reported macOS fixture result is 202/202 Json2 tests, as reported by the author; I did not independently run that fixture. - The Windows `String::npos` export now carries `DATA` in the generated `.def`, addressing the previous import-thunk defect. The Windows job is skipped by this PR's automatic path filter. I attempted the repository-documented manual full build workflow, but GitHub rejected dispatch with HTTP 403 (`Must have admin rights to Repository`), so no remote build was started. The targeted Linux changes now pass, but I still cannot independently verify the Windows import at runtime or run the full platform suite here. I am leaving this as a comment rather than approving; a Windows `guest_json` run on this exact head would close the outstanding platform check.
MarcZX10 commented 2026-10-29 06:57:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:57:34Z.

Review: APPROVED


Re-reviewed — approved

Reviewed exact PR head da1fb929eabd09573783570048a07438fad59f8d against current main edf6804cf52c62eacafc592dd6142cb4efe5bd05.

What I checked

  • Re-read the latest source/test delta and the decimal-underflow integration. Since the prior Windows-tested head 34632912cfb6d6861443eb73be13ad6538582575, every PR-touched file is byte-identical at the current head; the intervening update merges current main.
  • Current merge base is 6a28efaa277ca38291ba263aa2774859858161a0. Current main has changed 358 paths since then, with no overlap with the PR's 51 changed paths.
  • git merge-tree --write-tree upstream/main refs/review/upstream-10378: clean tree b041b021928f387c1cd070aad408e02e8c380828.
  • git diff --check upstream/main...refs/review/upstream-10378: pass.
  • python3 tools/check_conventions.py --base upstream/main: pass.

Results

Check Result
Current-main merge preview Clean
Diff check and conventions Pass
Linux Json2 tests I previously ran 203/203 on head 34632912cfb6d6861443eb73be13ad6538582575 under QEMU after bypassing only this host's unsupported-CPU guard; not rerun on this merge head
macOS Json2 tests Author reports 202/202 on exact current head da1fb929 in a production-source fixture
Windows Json2 tests Author reports 606/606 executions on 34632912cfb6d6861443eb73be13ad6538582575; the PR-touched files are unchanged at the current head
Hosted Windows job Passes, but product test execution is skipped by the path filter
Full project suite/title/GPU Not reported as run

Negative control

The author reports the callback-thread regression times out with the previous implementation and completes with the fix. No full negative-control run was reported for the current merged tree.

Findings

Blocking

None. The Windows-specific String::npos data export, callback ownership changes, and decimal-range behavior were covered by the reported platform tests. The current-head macOS suite exercises the merged integration; source and test files for this PR are unchanged from the extensive Windows run.

Non-blocking

  • No Windows runtime suite was rerun after the main merge. The Windows run is on the prior head, but the PR's 51 touched files are identical at the reviewed head; current main has no overlapping path changes.
  • The Linux runtime result required QEMU and a temporary host CPU guard bypass because this machine lacks the required CPU features. It is not a native supported-CPU run.
  • The 202-test macOS result is author-reported; I did not reproduce it in this environment.

Sources

Not verified

I did not rerun the Linux or Windows suites on the merged head, nor the macOS fixture. Platform results are attributed above to my earlier run or the authors' reports.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693952491 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10378#pullrequestreview-5693952491). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T06:57:34Z. **Review:** APPROVED --- # Re-reviewed — approved Reviewed exact PR head `da1fb929eabd09573783570048a07438fad59f8d` against current `main` `edf6804cf52c62eacafc592dd6142cb4efe5bd05`. ## What I checked - Re-read the latest source/test delta and the decimal-underflow integration. Since the prior Windows-tested head `34632912cfb6d6861443eb73be13ad6538582575`, every PR-touched file is byte-identical at the current head; the intervening update merges current main. - Current merge base is `6a28efaa277ca38291ba263aa2774859858161a0`. Current main has changed 358 paths since then, with no overlap with the PR's 51 changed paths. - `git merge-tree --write-tree upstream/main refs/review/upstream-10378`: clean tree `b041b021928f387c1cd070aad408e02e8c380828`. - `git diff --check upstream/main...refs/review/upstream-10378`: pass. - `python3 tools/check_conventions.py --base upstream/main`: pass. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Diff check and conventions | Pass | | Linux Json2 tests | I previously ran 203/203 on head `34632912cfb6d6861443eb73be13ad6538582575` under QEMU after bypassing only this host's unsupported-CPU guard; not rerun on this merge head | | macOS Json2 tests | Author reports 202/202 on exact current head `da1fb929` in a production-source fixture | | Windows Json2 tests | Author reports 606/606 executions on `34632912cfb6d6861443eb73be13ad6538582575`; the PR-touched files are unchanged at the current head | | Hosted Windows job | Passes, but product test execution is skipped by the path filter | | Full project suite/title/GPU | Not reported as run | ## Negative control The author reports the callback-thread regression times out with the previous implementation and completes with the fix. No full negative-control run was reported for the current merged tree. ## Findings ### Blocking None. The Windows-specific `String::npos` data export, callback ownership changes, and decimal-range behavior were covered by the reported platform tests. The current-head macOS suite exercises the merged integration; source and test files for this PR are unchanged from the extensive Windows run. ### Non-blocking - No Windows runtime suite was rerun after the main merge. The Windows run is on the prior head, but the PR's 51 touched files are identical at the reviewed head; current main has no overlapping path changes. - The Linux runtime result required QEMU and a temporary host CPU guard bypass because this machine lacks the required CPU features. It is not a native supported-CPU run. - The 202-test macOS result is author-reported; I did not reproduce it in this environment. ## Sources - [PR source at reviewed head](https://github.com/boykopovar/AnyPS5/tree/da1fb929eabd09573783570048a07438fad59f8d/core/libs/prx/libSceJson2) - [Current PR discussion and test reports](https://github.com/boykopovar/AnyPS5/pull/10378) - [Contribution rules at current main](https://github.com/boykopovar/AnyPS5/blob/edf6804cf52c62eacafc592dd6142cb4efe5bd05/CONTRIBUTING.md) ## Not verified I did not rerun the Linux or Windows suites on the merged head, nor the macOS fixture. Platform results are attributed above to my earlier run or the authors' reports.
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!10378
No description provided.