feat(libSceNpUniversalDataSystem): implement the Int record builders #14912

Merged
edubox merged 4 commits from upstream-pr/14912 into main 2026-11-06 23:07:56 +00:00
edubox commented 2026-11-02 00:47:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-11-02T00:47:30Z.


What

The libSceNpUniversalDataSystem Int record API threw not implemented. This implements the record builders whose signatures and checks are visible in the 11.00 module wrappers:

  • IntInitialize, IntTerminate, IntDeleteAllRecord, IntGetMemoryStat.
  • IntCreateRecordArray / IntCreateRecordObject / IntCreateRecordData, their three destroy functions, and IntRecordDataEstimateSize.
  • The eleven IntRecordArraySet* setters and the eleven IntRecordObjectSet* setters.

The host models record arrays and objects with the event property array and object types: arrays append typed values, objects set string keys, nested objects and arrays are cloned, and the stored copy is returned through value_ptr. IntCreateRecordData records the validated type in recordType and an empty context object. A returned child stays usable while its owner is alive and is invalidated when the owner is destroyed. Lifecycle and record operations share one lock, and IntInitialize uses a compare-exchange.

The wrappers at 0x1410 (array), 0x1c00/0x3050 (data/object), 0x1540–0x18f0 (array setters), 0x3190–0x3600 (object setters), 0xf40/0xfb0 (initialize/terminate), 0x1000 (memory stat), 0x2fa0 (estimate) and 0x13f0 (delete all) establish the signatures and the confirmed error codes 0x80553101, 0x80553102, 0x8055310D, 0x80553114, 0x80553115, 0x80553119 and 0x8055311A.

IntInitialize requires a 16-byte {size, memory} parameter. The console's record store, serialization and estimate are not measured: the 11.00 module calls its SceNpUds imports for the allocator and size contract, so IntGetMemoryStat and IntRecordDataEstimateSize throw after their argument checks instead of inventing output values. The memory pool passed to IntInitialize is ignored. IntPostRecordData, the streams, the context/handle Int exports and IntGetObjectState still throw.

Tested

  • Linux, GCC 14, Release, BUILD_TESTING=ON: built guest_np_uds_records_tests; ctest -R '^guest_np_uds_records$' passes.
  • The new test covers every export before initialization, the initialize parameter checks and already-initialized error, create/destroy for arrays, objects and data, every array and object setter including null/unknown values and keys, mutation through each returned nested child, clone independence, invalidation when the owner is destroyed, concurrent initialization, an operation racing destruction, and IntDeleteAllRecord/IntTerminate.
  • The existing np_uds_events, guest_np_uds_queries and guest_np_trophy_* tests still pass.
  • python3 tools/check_conventions.py --base origin/main: all checks pass.

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:5113244628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14912). Originally posted by [edubox](https://github.com/edubox) on 2026-11-02T00:47:30Z. --- ### What The `libSceNpUniversalDataSystem` Int record API threw `not implemented`. This implements the record builders whose signatures and checks are visible in the 11.00 module wrappers: - `IntInitialize`, `IntTerminate`, `IntDeleteAllRecord`, `IntGetMemoryStat`. - `IntCreateRecordArray` / `IntCreateRecordObject` / `IntCreateRecordData`, their three destroy functions, and `IntRecordDataEstimateSize`. - The eleven `IntRecordArraySet*` setters and the eleven `IntRecordObjectSet*` setters. The host models record arrays and objects with the event property array and object types: arrays append typed values, objects set string keys, nested objects and arrays are cloned, and the stored copy is returned through `value_ptr`. `IntCreateRecordData` records the validated type in `recordType` and an empty `context` object. A returned child stays usable while its owner is alive and is invalidated when the owner is destroyed. Lifecycle and record operations share one lock, and `IntInitialize` uses a compare-exchange. The wrappers at `0x1410` (array), `0x1c00`/`0x3050` (data/object), `0x1540`–`0x18f0` (array setters), `0x3190`–`0x3600` (object setters), `0xf40`/`0xfb0` (initialize/terminate), `0x1000` (memory stat), `0x2fa0` (estimate) and `0x13f0` (delete all) establish the signatures and the confirmed error codes `0x80553101`, `0x80553102`, `0x8055310D`, `0x80553114`, `0x80553115`, `0x80553119` and `0x8055311A`. `IntInitialize` requires a 16-byte `{size, memory}` parameter. The console's record store, serialization and estimate are not measured: the 11.00 module calls its `SceNpUds` imports for the allocator and size contract, so `IntGetMemoryStat` and `IntRecordDataEstimateSize` throw after their argument checks instead of inventing output values. The memory pool passed to `IntInitialize` is ignored. `IntPostRecordData`, the streams, the context/handle Int exports and `IntGetObjectState` still throw. ### Tested - Linux, GCC 14, Release, `BUILD_TESTING=ON`: built `guest_np_uds_records_tests`; `ctest -R '^guest_np_uds_records$'` passes. - The new test covers every export before initialization, the initialize parameter checks and already-initialized error, create/destroy for arrays, objects and data, every array and object setter including null/unknown values and keys, mutation through each returned nested child, clone independence, invalidation when the owner is destroyed, concurrent initialization, an operation racing destruction, and `IntDeleteAllRecord`/`IntTerminate`. - The existing `np_uds_events`, `guest_np_uds_queries` and `guest_np_trophy_*` tests still pass. - `python3 tools/check_conventions.py --base origin/main`: all checks pass. ### Checklist - [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
MarcZX10 commented 2026-11-02 10:05:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T10:05:56Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The current implementation still rejects its returned nested children, is unsafe against concurrent lifecycle operations, and implements success semantics that the PR itself says are unmeasured.

What I ran

Reviewed head 5b9869d185c7523bef3b4dd048b2b30c01ff381e against base 93dbd0f82aea684e95f15f06e7d42c0064af18cf. The PR is open and the head was unchanged at final refresh. Environment: Linux x86_64, Python 3.11.2, Git 2.39.5. I did not configure, build, or run C++ tests locally.

git diff --check 93dbd0f82aea684e95f15f06e7d42c0064af18cf...5b9869d185c7523bef3b4dd048b2b30c01ff381e
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14912 --output-dir /tmp/review-14912-precheck
python3 tools/pr_abi_audit.py --base 93dbd0f82aea684e95f15f06e7d42c0064af18cf --head 5b9869d185c7523bef3b4dd048b2b30c01ff381e --json

Results

Check Result Note
Patch and conventions passed No whitespace errors; convention check passed.
Export/declaration audit passed 93 symbols, no lexical findings.
Dependency / merge preview passed Precheck stack check passed.
Source and test review failed Three blocking issues remain.
Local C++ tests not run Exact-head binaries require a build.
Hosted checks mixed Windows passed; Linux and specialized jobs skipped.
Precheck summary and test evidence

The precheck reported diff_check: passed, conventions_and_pr_template: passed, and live_dependency_and_mergeability_check: passed. Its ABI and test-quality helper invocations could not execute because those scripts are absent from the isolated PR snapshot. The standalone ABI audit passed with 93 symbols and no findings. The test-quality heuristic did not establish registration; manual CMake inspection confirms GuestNpUniversalDataSystemRecords.cpp is registered as guest_np_uds_records.

GitHub checks at this head: eligibility, conventions, library-portability, intake, labels, report, and windows succeeded; relinker, relinker-asan, register-context, write-watch, and linux were skipped. The PR description reports a Linux GCC 14 Release build and focused CTest pass; I did not independently reproduce that result.

Negative control

Not run: no C++ binary was built, so I could not remove any new behavior and demonstrate that the corresponding test fails. The new tests also do not exercise the nested-child mutation, lifecycle-contention, or destruction-race cases described below.

Findings

Blocking

  1. Returned nested values cannot be used as records. The setters clone nested objects/arrays and return child.get() through valuePtr (for example, Record.cpp:331-356). But FindObject and FindArray accept only pointers registered as roots in g_objects/g_arrays (:30-37); these children are owned only by the parent property and are never registered. Passing a successful valuePtr to a subsequent object/array setter therefore returns kNullObject/kNullArray. The tests only assert that the pointers are non-null (GuestNpUniversalDataSystemRecords.cpp:91-94, 116-120). Make returned children usable for their documented lifetime, define invalidation when an owner is destroyed, and test mutation through each returned type plus clone independence.

  2. Lifecycle and record operations can race into invalid memory. IntInitialize performs a separate atomic load() and store(true) (Record.cpp:48-54), so concurrent initializers can both pass the already-initialized check. More seriously, setters call Owned::Contains, which releases its mutex before returning a raw pointer (NpUniversalDataSystem.hpp:39-50); DestroyRecord*, DeleteAllRecord, or Terminate can then free that object while the setter uses it. Concurrent setters also mutate the same event-property vector/map without synchronization. Serialize initialization and make record ownership/lifetime cover each operation through its final access, or otherwise establish and enforce a documented single-thread contract. Add contention and operation-versus-destruction tests.

  3. Successful record behavior is explicitly unverified. The PR's debt entry says the host ignores the supplied memory pool, reports all memory statistics as zero, models Int records with event property types, and uses event MessagePack size for IntRecordDataEstimateSize, while also stating that console record storage, serialization, and estimate behavior are not measured (docs/dev/debt/libSceNpUniversalDataSystem.md:16). The tests assert these chosen host semantics, but do not establish that they match the console contract. Provide implementation-source or hardware evidence for the successful representation, memory statistics, and size results; keep the affected success paths unimplemented until those results are supported.

Non-blocking

None identified.

Sources

Not verified

  • The local C++ build and focused test binary.
  • Runtime behavior on PS5 and the successful record/serialization/statistics contract.
  • Thread-safety expectations from the native library; the current host implementation itself is not safe if these exported operations overlap.

To get this to a good state

Make returned nested children usable and lifetime-safe, serialize lifecycle and record access or demonstrate/enforce a single-thread contract, and provide evidence for the successful data/stat/size semantics or leave those paths unimplemented. Add regressions for each addressed case. On the new head I will repeat the no-build checks and inspect the updated tests; build-dependent results should be confirmed by CI or a focused build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5734895040 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14912#pullrequestreview-5734895040). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T10:05:56Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The current implementation still rejects its returned nested children, is unsafe against concurrent lifecycle operations, and implements success semantics that the PR itself says are unmeasured. ## What I ran Reviewed head `5b9869d185c7523bef3b4dd048b2b30c01ff381e` against base `93dbd0f82aea684e95f15f06e7d42c0064af18cf`. The PR is open and the head was unchanged at final refresh. Environment: Linux x86_64, Python 3.11.2, Git 2.39.5. I did not configure, build, or run C++ tests locally. ```sh git diff --check 93dbd0f82aea684e95f15f06e7d42c0064af18cf...5b9869d185c7523bef3b4dd048b2b30c01ff381e python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14912 --output-dir /tmp/review-14912-precheck python3 tools/pr_abi_audit.py --base 93dbd0f82aea684e95f15f06e7d42c0064af18cf --head 5b9869d185c7523bef3b4dd048b2b30c01ff381e --json ``` ## Results | Check | Result | Note | |---|---|---| | Patch and conventions | passed | No whitespace errors; convention check passed. | | Export/declaration audit | passed | 93 symbols, no lexical findings. | | Dependency / merge preview | passed | Precheck stack check passed. | | Source and test review | failed | Three blocking issues remain. | | Local C++ tests | not run | Exact-head binaries require a build. | | Hosted checks | mixed | Windows passed; Linux and specialized jobs skipped. | <details><summary>Precheck summary and test evidence</summary> The precheck reported `diff_check: passed`, `conventions_and_pr_template: passed`, and `live_dependency_and_mergeability_check: passed`. Its ABI and test-quality helper invocations could not execute because those scripts are absent from the isolated PR snapshot. The standalone ABI audit passed with 93 symbols and no findings. The test-quality heuristic did not establish registration; manual CMake inspection confirms `GuestNpUniversalDataSystemRecords.cpp` is registered as `guest_np_uds_records`. GitHub checks at this head: `eligibility`, `conventions`, `library-portability`, `intake`, `labels`, `report`, and `windows` succeeded; `relinker`, `relinker-asan`, `register-context`, `write-watch`, and `linux` were skipped. The PR description reports a Linux GCC 14 Release build and focused CTest pass; I did not independently reproduce that result. </details> ## Negative control Not run: no C++ binary was built, so I could not remove any new behavior and demonstrate that the corresponding test fails. The new tests also do not exercise the nested-child mutation, lifecycle-contention, or destruction-race cases described below. ## Findings ### Blocking 1. **Returned nested values cannot be used as records.** The setters clone nested objects/arrays and return `child.get()` through `valuePtr` (for example, `Record.cpp:331-356`). But `FindObject` and `FindArray` accept only pointers registered as roots in `g_objects`/`g_arrays` (`:30-37`); these children are owned only by the parent property and are never registered. Passing a successful `valuePtr` to a subsequent object/array setter therefore returns `kNullObject`/`kNullArray`. The tests only assert that the pointers are non-null (`GuestNpUniversalDataSystemRecords.cpp:91-94, 116-120`). Make returned children usable for their documented lifetime, define invalidation when an owner is destroyed, and test mutation through each returned type plus clone independence. 2. **Lifecycle and record operations can race into invalid memory.** `IntInitialize` performs a separate atomic `load()` and `store(true)` (`Record.cpp:48-54`), so concurrent initializers can both pass the already-initialized check. More seriously, setters call `Owned::Contains`, which releases its mutex before returning a raw pointer (`NpUniversalDataSystem.hpp:39-50`); `DestroyRecord*`, `DeleteAllRecord`, or `Terminate` can then free that object while the setter uses it. Concurrent setters also mutate the same event-property vector/map without synchronization. Serialize initialization and make record ownership/lifetime cover each operation through its final access, or otherwise establish and enforce a documented single-thread contract. Add contention and operation-versus-destruction tests. 3. **Successful record behavior is explicitly unverified.** The PR's debt entry says the host ignores the supplied memory pool, reports all memory statistics as zero, models Int records with event property types, and uses event MessagePack size for `IntRecordDataEstimateSize`, while also stating that console record storage, serialization, and estimate behavior are not measured (`docs/dev/debt/libSceNpUniversalDataSystem.md:16`). The tests assert these chosen host semantics, but do not establish that they match the console contract. Provide implementation-source or hardware evidence for the successful representation, memory statistics, and size results; keep the affected success paths unimplemented until those results are supported. ### Non-blocking None identified. ## Sources - [Nested record lookup and ownership at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5b9869d185c7523bef3b4dd048b2b30c01ff381e/core/libs/prx/libSceNpUniversalDataSystem/src/Record.cpp#L26-L38) - [Nested setters returning child pointers at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5b9869d185c7523bef3b4dd048b2b30c01ff381e/core/libs/prx/libSceNpUniversalDataSystem/src/Record.cpp#L331-L356) - [Owned registry locking at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5b9869d185c7523bef3b4dd048b2b30c01ff381e/core/libs/prx/libSceNpUniversalDataSystem/src/NpUniversalDataSystem.hpp#L29-L60) - [Nested tests currently checking only non-null pointers](https://github.com/boykopovar/AnyPS5/blob/5b9869d185c7523bef3b4dd048b2b30c01ff381e/core/libs/tests/GuestNpUniversalDataSystemRecords.cpp#L88-L120) - [Unmeasured successful record model and outputs at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/5b9869d185c7523bef3b4dd048b2b30c01ff381e/docs/dev/debt/libSceNpUniversalDataSystem.md#L14-L18) ## Not verified - The local C++ build and focused test binary. - Runtime behavior on PS5 and the successful record/serialization/statistics contract. - Thread-safety expectations from the native library; the current host implementation itself is not safe if these exported operations overlap. ## To get this to a good state Make returned nested children usable and lifetime-safe, serialize lifecycle and record access or demonstrate/enforce a single-thread contract, and provide evidence for the successful data/stat/size semantics or leave those paths unimplemented. Add regressions for each addressed case. On the new head I will repeat the no-build checks and inspect the updated tests; build-dependent results should be confirmed by CI or a focused build.
XairRrR commented 2026-11-03 09:40:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:40:31Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The Int record builders build, guest_np_uds_records passes, and a targeted negative control fails as it should. One debt entry is now stale: docs/dev/debt/libSceNpUniversalDataSystem.md still says IntInitialize and IntTerminate are parameterless stubs in Export.cpp that throw. They aren't anymore, and the project rules require that entry to be cut.

What I ran

Head 2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3, merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree 5d19f1d3cada7a43b52102701c610d6efcb16f8e). Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R '^(guest_np_uds_records|guest_np_uds_queries|np_uds_events|guest_np_trophy_.*)$'
# negative control 1: restore production sources from main (Record.cpp kept), then rebuild
ninja -C build -j32 -l32 guest_np_uds_records_tests
# negative control 2: merged tree, with FindObject/FindArray limited to root records (the lookup before the fix)
ninja -C build -j32 -l32 guest_np_uds_records_tests libSceNpUniversalDataSystem
ctest --test-dir build --output-on-failure -R '^guest_np_uds_records$'
# restore merged Record.cpp, rebuild, rerun, git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py exit 0, 0 errors, 1 warning (debt-length, 1386 characters, line 34)
Build of the merged tree (script) ok
Script test run no new failures, no timeouts; the known failures (guest_interfaces, guest_socket_options_multicast, unwrap_self_…, vector_constant_factor_tininess) and the guest_net_ctl skip also happen on main and are not caused by this PR
guest_np_uds_records passed (0.04 s)
guest_np_uds_queries, np_uds_events, guest_np_trophy_* (6 tests) passed
Negative control (roots-only lookup) guest_np_uds_records aborts at set on array child
Worktree after restore git status --porcelain empty; test passes again
check_conventions.py
docs/dev/debt/libSceNpUniversalDataSystem.md:34: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1386 characters
1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all
exit=0

Negative control

  • All production sources restored from main, Record.cpp kept: the build fails as expected (Owned has no ForEach, and NpUniversalDataSystemIntInitParam is unknown). The new test uses the new Api.hpp signatures, so a full revert can't produce a test binary. This control shows only that the test depends on the change.
  • Targeted mutation on the merged tree: I made FindObject/FindArray accept only registered roots (root == object, with no nested search), which is how the code behaved before the first review was answered. The test aborts with NpUniversalDataSystem records: set on array child. So it does cover the fix for returned nested children.
  • I restored the merged Record.cpp and rebuilt. The test passes and the worktree is clean.

I did not mutate the locking. The race tests are probabilistic, so a negative control for them would not be conclusive either way.

Findings

On the first review's three blocking points, at this head:

  1. Nested children: fixed; the mutation above confirms the test covers it.
  2. Locking: every export takes g_recordsMutex, and IntInitialize uses a compare-exchange. Confirmed by reading the code.
  3. Unmeasured success values: IntGetMemoryStat and IntRecordDataEstimateSize now throw after their argument checks (NotImplemented_nid_no_patch is [[noreturn]], so there is no missing-return problem).

Blocking

  1. The debt entry for IntInitialize/IntTerminate is still there. docs/dev/debt/libSceNpUniversalDataSystem.md:30 still lists sceNpUniversalDataSystemIntInitialize and sceNpUniversalDataSystemIntTerminate as linked to Export.cpp, "declared without parameters" and throwing "until its signature is verified".
    • The PR removes both from Export.cpp, gives IntInitialize a {size, memory} parameter in src/Record.cpp, and implements both.
    • CONTRIBUTING.md says a pull request that closes a gap removes its entry or cuts it to what is still open.
    • Fix: drop the two names from that entry, leaving IntDestroyContext, IntDestroyHandle and IntNetSyncTitles. The new Record builders entry already covers the rest.

Non-blocking

  1. Two MessagePackSize overloads are never called. src/UdsEvent.cpp:278-286 and their declarations in include/UdsEvent.hpp:68-69 were added for the size estimate. Since IntRecordDataEstimateSize now throws, nothing in core/ calls them. Suggest removing them until a measured size contract needs them.
  2. Some error codes are not on the confirmed list, and the debt entry doesn't say so.
    • src/Record.cpp:21-23 returns 0x80553116 (null record), 0x80553117 (not initialized) and 0x80553118 (already initialized).
    • The description and the debt entry list only 0x80553101/02/0D/12/14/15/19/1A as confirmed by the 11.00 wrappers.
    • If these three also come from the wrappers, say so in the entry. Otherwise, record them as unverified.
    • The same goes for check order (for example, IntInitialize checks already-initialized before validating its parameter), which I could not check against the disassembly.
  3. The Record builders debt entry is too long. docs/dev/debt/libSceNpUniversalDataSystem.md:34 is 1386 characters and triggers the debt-length warning. Most of it describes implemented behaviour: the lock, the compare-exchange, the cloning. Cutting it to the gaps would fit the rule:
    • the ignored memory pool;
    • the throwing stat and estimate;
    • the unverified record model;
    • the unverified codes.
  4. IntDestroyRecordData and IntDestroyRecordObject are interchangeable. At src/Record.cpp:212, IntDestroyRecordData just forwards to IntDestroyRecordObject. Each one therefore frees records created by the other's Create function. Whether the console separates them is unknown; this could be one more line among the unverified points in the debt entry.

Not verified

  • Behaviour on a PS5, and the 11.00 wrapper disassembly behind the signatures and error codes. I had no module to inspect.
  • The Windows build: I didn't run it. Another commenter reports a pass at an earlier head (7cf5a1a7ec).
  • A mutation-based negative control for the locking. The contention tests are probabilistic.
  • The Khronos validation comparison was skipped by the script: the change touches no AGC driver, shader recompiler or VideoOut file, so it doesn't apply.

To get this to a good state

Remove sceNpUniversalDataSystemIntInitialize and sceNpUniversalDataSystemIntTerminate from the Export.cpp debt entry at line 30. Preferably also drop the unused MessagePackSize overloads and cut the Record builders entry to the open gaps.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749902430 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14912#pullrequestreview-5749902430). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T09:40:31Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The Int record builders build, `guest_np_uds_records` passes, and a targeted negative control fails as it should. One debt entry is now stale: `docs/dev/debt/libSceNpUniversalDataSystem.md` still says `IntInitialize` and `IntTerminate` are parameterless stubs in `Export.cpp` that throw. They aren't anymore, and the project rules require that entry to be cut. ## What I ran Head `2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3`, merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `5d19f1d3cada7a43b52102701c610d6efcb16f8e`). Debian 13 VM, GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R '^(guest_np_uds_records|guest_np_uds_queries|np_uds_events|guest_np_trophy_.*)$' # negative control 1: restore production sources from main (Record.cpp kept), then rebuild ninja -C build -j32 -l32 guest_np_uds_records_tests # negative control 2: merged tree, with FindObject/FindArray limited to root records (the lookup before the fix) ninja -C build -j32 -l32 guest_np_uds_records_tests libSceNpUniversalDataSystem ctest --test-dir build --output-on-failure -R '^guest_np_uds_records$' # restore merged Record.cpp, rebuild, rerun, git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | exit 0, 0 errors, 1 warning (`debt-length`, 1386 characters, line 34) | | Build of the merged tree (script) | ok | | Script test run | no new failures, no timeouts; the known failures (`guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_…`, `vector_constant_factor_tininess`) and the `guest_net_ctl` skip also happen on `main` and are not caused by this PR | | `guest_np_uds_records` | passed (0.04 s) | | `guest_np_uds_queries`, `np_uds_events`, `guest_np_trophy_*` (6 tests) | passed | | Negative control (roots-only lookup) | `guest_np_uds_records` aborts at `set on array child` | | Worktree after restore | `git status --porcelain` empty; test passes again | <details><summary>check_conventions.py</summary> ``` docs/dev/debt/libSceNpUniversalDataSystem.md:34: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1386 characters 1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all exit=0 ``` </details> ## Negative control - **All production sources restored from `main`, `Record.cpp` kept:** the build fails as expected (`Owned` has no `ForEach`, and `NpUniversalDataSystemIntInitParam` is unknown). The new test uses the new `Api.hpp` signatures, so a full revert can't produce a test binary. This control shows only that the test depends on the change. - **Targeted mutation on the merged tree:** I made `FindObject`/`FindArray` accept only registered roots (`root == object`, with no nested search), which is how the code behaved before the first review was answered. The test aborts with `NpUniversalDataSystem records: set on array child`. So it does cover the fix for returned nested children. - I restored the merged `Record.cpp` and rebuilt. The test passes and the worktree is clean. I did not mutate the locking. The race tests are probabilistic, so a negative control for them would not be conclusive either way. ## Findings On the first review's three blocking points, at this head: 1. **Nested children:** fixed; the mutation above confirms the test covers it. 2. **Locking:** every export takes `g_recordsMutex`, and `IntInitialize` uses a compare-exchange. Confirmed by reading the code. 3. **Unmeasured success values:** `IntGetMemoryStat` and `IntRecordDataEstimateSize` now throw after their argument checks (`NotImplemented_nid_no_patch` is `[[noreturn]]`, so there is no missing-return problem). ### Blocking 1. **The debt entry for `IntInitialize`/`IntTerminate` is still there.** [`docs/dev/debt/libSceNpUniversalDataSystem.md:30`](https://github.com/boykopovar/AnyPS5/blob/2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3/docs/dev/debt/libSceNpUniversalDataSystem.md#L30-L30) still lists `sceNpUniversalDataSystemIntInitialize` and `sceNpUniversalDataSystemIntTerminate` as linked to `Export.cpp`, "declared without parameters" and throwing "until its signature is verified". - The PR removes both from `Export.cpp`, gives `IntInitialize` a `{size, memory}` parameter in `src/Record.cpp`, and implements both. - CONTRIBUTING.md says a pull request that closes a gap removes its entry or cuts it to what is still open. - **Fix:** drop the two names from that entry, leaving `IntDestroyContext`, `IntDestroyHandle` and `IntNetSyncTitles`. The new Record builders entry already covers the rest. ### Non-blocking 1. **Two `MessagePackSize` overloads are never called.** [`src/UdsEvent.cpp:278-286`](https://github.com/boykopovar/AnyPS5/blob/2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3/core/libs/prx/libSceNpUniversalDataSystem/src/UdsEvent.cpp#L278-L286) and their declarations in `include/UdsEvent.hpp:68-69` were added for the size estimate. Since `IntRecordDataEstimateSize` now throws, nothing in `core/` calls them. Suggest removing them until a measured size contract needs them. 2. **Some error codes are not on the confirmed list, and the debt entry doesn't say so.** - `src/Record.cpp:21-23` returns `0x80553116` (null record), `0x80553117` (not initialized) and `0x80553118` (already initialized). - The description and the debt entry list only `0x80553101/02/0D/12/14/15/19/1A` as confirmed by the 11.00 wrappers. - If these three also come from the wrappers, say so in the entry. Otherwise, record them as unverified. - The same goes for check order (for example, `IntInitialize` checks already-initialized before validating its parameter), which I could not check against the disassembly. 3. **The Record builders debt entry is too long.** [`docs/dev/debt/libSceNpUniversalDataSystem.md:34`](https://github.com/boykopovar/AnyPS5/blob/2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3/docs/dev/debt/libSceNpUniversalDataSystem.md#L34-L34) is 1386 characters and triggers the `debt-length` warning. Most of it describes implemented behaviour: the lock, the compare-exchange, the cloning. Cutting it to the gaps would fit the rule: - the ignored memory pool; - the throwing stat and estimate; - the unverified record model; - the unverified codes. 4. **`IntDestroyRecordData` and `IntDestroyRecordObject` are interchangeable.** At `src/Record.cpp:212`, `IntDestroyRecordData` just forwards to `IntDestroyRecordObject`. Each one therefore frees records created by the other's Create function. Whether the console separates them is unknown; this could be one more line among the unverified points in the debt entry. ## Not verified - Behaviour on a PS5, and the 11.00 wrapper disassembly behind the signatures and error codes. I had no module to inspect. - The Windows build: I didn't run it. Another commenter reports a pass at an earlier head (`7cf5a1a7ec`). - A mutation-based negative control for the locking. The contention tests are probabilistic. - The Khronos validation comparison was skipped by the script: the change touches no AGC driver, shader recompiler or VideoOut file, so it doesn't apply. ## To get this to a good state Remove `sceNpUniversalDataSystemIntInitialize` and `sceNpUniversalDataSystemIntTerminate` from the Export.cpp debt entry at line 30. Preferably also drop the unused `MessagePackSize` overloads and cut the Record builders entry to the open gaps. <!-- anyps5-bots job=2196 head=2382ec90b4f3fa31816d15d1cdb4cda5f76cc3f3 -->
XairRrR commented 2026-11-03 11:05:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:05:33Z.

Review: APPROVED


Re-checked — approved

The only new commit, c8d28e6 (docs only), resolves the one blocking finding. It removes IntInitialize/IntTerminate from the stale Export.cpp debt entry and cuts the Record builders entry down to its open gaps, which also covers two of my non-blocking points.

What changed since my last review

  • One new commit, c8d28e6722667cb0290e02ad268a0eb51769e272. It changes only docs/dev/debt/libSceNpUniversalDataSystem.md. Commits 1–3 are unchanged (range-diff shows =).
    • Line 30 now lists only IntDestroyContext, IntDestroyHandle and IntNetSyncTitles.
    • The Record builders entry (line 34) has been rewritten so that it states the gaps:
      • the memory pool is ignored;
      • the stat and the estimate throw;
      • the record model, the codes 0x80553116/0x80553117/0x80553118 and the check order are unverified;
      • IntDestroyRecordData forwards to IntDestroyRecordObject.
  • The author's comment of 2026-11-03T10:20:34Z describes this change and reports 8/8 focused tests passing. I re-ran those tests myself (below).
  • No code or test changes, so the negative control from my previous review still applies.

What I ran

Head c8d28e6722667cb0290e02ad268a0eb51769e272, merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree f6648dc0cc9b2127e57575dd9e3add7fd4320d1c). Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git show c8d28e6722667cb0290e02ad268a0eb51769e272
git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c8d28e6722667cb0290e02ad268a0eb51769e272
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R '^(guest_np_uds_records|guest_np_uds_queries|np_uds_events|guest_np_trophy_.*)$'
git status --porcelain
Check Result
git diff --check clean
check_conventions.py All conventions checks passed., exit 0. The debt-length warning from last time is gone.
Build of the merged tree (script) ok
Script test run no new failures, no timeouts. The known failures (guest_interfaces, guest_socket_options_multicast, unwrap_self_…, vector_constant_factor_tininess) and the guest_net_ctl skip also happen on main and are not caused by this PR.
Focused tests (8: guest_np_uds_records, guest_np_uds_queries, np_uds_events, 5× guest_np_trophy_*) 8/8 passed
Worktree git status --porcelain empty

Previous findings

  • Blocking 1 — stale IntInitialize/IntTerminate debt entry: Resolved. docs/dev/debt/libSceNpUniversalDataSystem.md:30 now lists only IntDestroyContext, IntDestroyHandle and IntNetSyncTitles. A grep finds neither IntInitialize nor IntTerminate in Export.cpp or PendingExports.cpp.
  • Non-blocking 1 — unused MessagePackSize overloads: Still open. The object and array overloads at src/UdsEvent.cpp:278-286 and their declarations at include/UdsEvent.hpp:68-69 have no callers. Only the event overload is used, at core/libs/prx/libSceNpUniversalDataSystem/src/Event.cpp:89. This doesn't block the merge; removing them would be a small cleanup.
  • Non-blocking 2 — unconfirmed error codes and check order: Resolved. The debt entry now marks 0x80553116, 0x80553117, 0x80553118 and the check order as unverified.
  • Non-blocking 3 — Record builders entry too long: Resolved. The entry now describes the gaps, and check_conventions.py no longer warns.
  • Non-blocking 4 — IntDestroyRecordData/IntDestroyRecordObject interchangeable: Resolved as a documentation item. The entry now records that either one frees records created by the other.

New findings

Blocking

None.

Non-blocking

None.

Not verified

  • Behaviour on a PS5, and the 11.00 wrapper disassembly behind the signatures and error codes. I had no module to inspect.
  • The Windows build. Another commenter reports a pass at the earlier head 7cf5a1a7ec. The new commit changes only documentation.
  • A mutation-based negative control for the locking. The contention tests are probabilistic.
  • The Khronos validation comparison: the script skipped it because the change touches no AGC driver, shader recompiler or VideoOut file.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751058773 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14912#pullrequestreview-5751058773). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:05:33Z. **Review:** APPROVED --- # Re-checked — approved The only new commit, `c8d28e6` (docs only), resolves the one blocking finding. It removes `IntInitialize`/`IntTerminate` from the stale `Export.cpp` debt entry and cuts the Record builders entry down to its open gaps, which also covers two of my non-blocking points. ## What changed since my last review - One new commit, `c8d28e6722667cb0290e02ad268a0eb51769e272`. It changes only `docs/dev/debt/libSceNpUniversalDataSystem.md`. Commits 1–3 are unchanged (`range-diff` shows `=`). - Line 30 now lists only `IntDestroyContext`, `IntDestroyHandle` and `IntNetSyncTitles`. - The Record builders entry (line 34) has been rewritten so that it states the gaps: - the memory pool is ignored; - the stat and the estimate throw; - the record model, the codes `0x80553116`/`0x80553117`/`0x80553118` and the check order are unverified; - `IntDestroyRecordData` forwards to `IntDestroyRecordObject`. - The author's comment of 2026-11-03T10:20:34Z describes this change and reports 8/8 focused tests passing. I re-ran those tests myself (below). - No code or test changes, so the negative control from my previous review still applies. ## What I ran Head `c8d28e6722667cb0290e02ad268a0eb51769e272`, merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `f6648dc0cc9b2127e57575dd9e3add7fd4320d1c`). Debian 13 VM, GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ``` git show c8d28e6722667cb0290e02ad268a0eb51769e272 git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c8d28e6722667cb0290e02ad268a0eb51769e272 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R '^(guest_np_uds_records|guest_np_uds_queries|np_uds_events|guest_np_trophy_.*)$' git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | `All conventions checks passed.`, exit 0. The `debt-length` warning from last time is gone. | | Build of the merged tree (script) | ok | | Script test run | no new failures, no timeouts. The known failures (`guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_…`, `vector_constant_factor_tininess`) and the `guest_net_ctl` skip also happen on `main` and are not caused by this PR. | | Focused tests (8: `guest_np_uds_records`, `guest_np_uds_queries`, `np_uds_events`, 5× `guest_np_trophy_*`) | 8/8 passed | | Worktree | `git status --porcelain` empty | ## Previous findings - **Blocking 1 — stale `IntInitialize`/`IntTerminate` debt entry:** Resolved. [`docs/dev/debt/libSceNpUniversalDataSystem.md:30`](https://github.com/boykopovar/AnyPS5/blob/c8d28e6722667cb0290e02ad268a0eb51769e272/docs/dev/debt/libSceNpUniversalDataSystem.md#L30-L30) now lists only `IntDestroyContext`, `IntDestroyHandle` and `IntNetSyncTitles`. A grep finds neither `IntInitialize` nor `IntTerminate` in `Export.cpp` or `PendingExports.cpp`. - **Non-blocking 1 — unused `MessagePackSize` overloads:** Still open. The object and array overloads at [`src/UdsEvent.cpp:278-286`](https://github.com/boykopovar/AnyPS5/blob/c8d28e6722667cb0290e02ad268a0eb51769e272/core/libs/prx/libSceNpUniversalDataSystem/src/UdsEvent.cpp#L278-L286) and their declarations at `include/UdsEvent.hpp:68-69` have no callers. Only the event overload is used, at `core/libs/prx/libSceNpUniversalDataSystem/src/Event.cpp:89`. This doesn't block the merge; removing them would be a small cleanup. - **Non-blocking 2 — unconfirmed error codes and check order:** Resolved. The debt entry now marks `0x80553116`, `0x80553117`, `0x80553118` and the check order as unverified. - **Non-blocking 3 — Record builders entry too long:** Resolved. The entry now describes the gaps, and `check_conventions.py` no longer warns. - **Non-blocking 4 — `IntDestroyRecordData`/`IntDestroyRecordObject` interchangeable:** Resolved as a documentation item. The entry now records that either one frees records created by the other. ## New findings ### Blocking None. ### Non-blocking None. ## Not verified - Behaviour on a PS5, and the 11.00 wrapper disassembly behind the signatures and error codes. I had no module to inspect. - The Windows build. Another commenter reports a pass at the earlier head `7cf5a1a7ec`. The new commit changes only documentation. - A mutation-based negative control for the locking. The contention tests are probabilistic. - The Khronos validation comparison: the script skipped it because the change touches no AGC driver, shader recompiler or VideoOut file. <!-- anyps5-bots job=3280 head=c8d28e6722667cb0290e02ad268a0eb51769e272 -->
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!14912
No description provided.