fix(libSceNpUniversalDataSystem): distinguish literal keys from troph… #14427

Merged
mkrieger95 merged 1 commit from upstream-pr/14427 into main 2026-11-14 11:38:00 +00:00
mkrieger95 commented 2026-11-01 12:30:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mkrieger95 on 2026-11-01T12:30:26Z.


What

UDS trophy statistics flatten nested object keys into dotted paths. A literal key named player.steps was therefore indistinguishable from steps inside a player object. It could satisfy $.player.steps by itself, or override a genuine nested value depending on insertion order. In the synthetic integration fixture, that incorrectly unlocked the progressive trophy and its platinum.

Skip literal dotted and empty key segments when deriving the statistic-property paths. They cannot be addressed by the currently supported $.name rule syntax. Keep the original event and its descriptions intact. A missing genuine path continues through the existing missing-property diagnostic rather than updating a counter.

Add direct conversion checks for literal leaf and object keys, nested dotted keys, an empty internal key, both insertion orders, and unchanged source events. Add public-API integration checks that a literal dotted key cannot unlock a trophy or replace genuine progress; the existing checks still require the real nested value to unlock the trophy and platinum at the target. This is a consistency fix for AnyPS5's current rule interpreter, not a newly reverse-engineered PS5 export.

Tested

Linux x86-64, GCC 14.2, Release, BUILD_TESTING=ON; rebased onto upstream ba627802e2210187d417deb64c8f2fed8e33011f on 2026-11-01 UTC.

  • Built the production library and all focused test targets listed below.
  • 6/6 focused CTests pass: np_uds_events, guest_np_trophy_stats, guest_np_trophy_unlocks, guest_np_trophy_data, guest_np_uds_queries, np_trophy2_package.
  • python3 core/libs/tests/test_public_headers.py --audit-only: 399 libraries, 26,227 exports pass.
  • python3 tools/check_conventions.py --base origin/main and git diff --check: pass.
  • Original regression control (before this rebase): both modified tests fail against the unchanged production code. np_uds_events reports literal property names were converted into nested stat paths; guest_np_trophy_stats logs the erroneous trophy 5 and platinum 0 unlocks, then aborts at a literal dotted key updated a nested statistic or unlocked its trophy. Both pass with the production fix.
  • The rebased commit has the same patch as the original commit.

No Windows, macOS, console or game execution; no full-project build or PS5 parity test. The regression is synthetic; no title unblock is claimed.

Submission check at 6a175479707aedcce08eeddc5bc9f2e2ad4c318c: the repository's tools/pr_overlap.py comparison functions checked this branch against 1,664 open upstream PRs on 2026-11-01 UTC, using one shared fetch of main ba627802e2210187d417deb64c8f2fed8e33011f. No duplicate exports, new files, conflicting lines or unverified shared-file comparisons were reported. Merge previews between every pair of the four trophy drafts are also clean. These remain separate, independent fixes.

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:5107345888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14427). Originally posted by [mkrieger95](https://github.com/mkrieger95) on 2026-11-01T12:30:26Z. --- ### What UDS trophy statistics flatten nested object keys into dotted paths. A literal key named `player.steps` was therefore indistinguishable from `steps` inside a `player` object. It could satisfy `$.player.steps` by itself, or override a genuine nested value depending on insertion order. In the synthetic integration fixture, that incorrectly unlocked the progressive trophy and its platinum. Skip literal dotted and empty key segments when deriving the statistic-property paths. They cannot be addressed by the currently supported `$.name` rule syntax. Keep the original event and its descriptions intact. A missing genuine path continues through the existing missing-property diagnostic rather than updating a counter. Add direct conversion checks for literal leaf and object keys, nested dotted keys, an empty internal key, both insertion orders, and unchanged source events. Add public-API integration checks that a literal dotted key cannot unlock a trophy or replace genuine progress; the existing checks still require the real nested value to unlock the trophy and platinum at the target. This is a consistency fix for AnyPS5's current rule interpreter, not a newly reverse-engineered PS5 export. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux x86-64, GCC 14.2, Release, `BUILD_TESTING=ON`; rebased onto upstream `ba627802e2210187d417deb64c8f2fed8e33011f` on 2026-11-01 UTC. - Built the production library and all focused test targets listed below. - 6/6 focused CTests pass: `np_uds_events`, `guest_np_trophy_stats`, `guest_np_trophy_unlocks`, `guest_np_trophy_data`, `guest_np_uds_queries`, `np_trophy2_package`. - `python3 core/libs/tests/test_public_headers.py --audit-only`: 399 libraries, 26,227 exports pass. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check`: pass. - Original regression control (before this rebase): both modified tests fail against the unchanged production code. `np_uds_events` reports `literal property names were converted into nested stat paths`; `guest_np_trophy_stats` logs the erroneous trophy 5 and platinum 0 unlocks, then aborts at `a literal dotted key updated a nested statistic or unlocked its trophy`. Both pass with the production fix. - The rebased commit has the same patch as the original commit. No Windows, macOS, console or game execution; no full-project build or PS5 parity test. The regression is synthetic; no title unblock is claimed. Submission check at `6a175479707aedcce08eeddc5bc9f2e2ad4c318c`: the repository's `tools/pr_overlap.py` comparison functions checked this branch against 1,664 open upstream PRs on 2026-11-01 UTC, using one shared fetch of main `ba627802e2210187d417deb64c8f2fed8e33011f`. No duplicate exports, new files, conflicting lines or unverified shared-file comparisons were reported. Merge previews between every pair of the four trophy drafts are also clean. These remain separate, independent fixes. ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-11-01 13:44:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T13:44:11Z.

Review: COMMENTED


Reviewed — no blocking findings

Dropping literal dotted and empty keys when deriving statistic paths is correct: the rule parser accepts only word segments joined by ., so such a key can never be addressed, and skipping it keeps a literal key from overriding a genuine nested value.

What I ran

  • Exact head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c, base 4768f0aeca680477597b2e42cba60ae49e48802c.
  • Environment: Linux, /usr/bin/python3 3.11.2, no build.
  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14427 --output-dir /dev/shm/reviewer-run/precheck/14427
  • ABI audit by hand: python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --json (exit 0, 0 findings)
  • Test-quality helper by hand on core/libs/tests/GuestNpTrophyStats.cpp and core/libs/prx/libSceNpUniversalDataSystem/tests/Events.cpp from head extracts. Each produced one literal-path registration heuristic; the registration is in core/libs/prx/libSceNpUniversalDataSystem/CMakeLists.txt (line 21 for tests/Events.cpp, line 59 for GuestNpTrophyStats.cpp).
  • Rule parser read at head: propertyPath in TrophyPackage.cpp.

Results

Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14427/report.md):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check 4768f0aeca680477597b2e42cba60ae49e48802c...6a175479707aedcce08eeddc5bc9f2e2ad4c318c
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --title fix(libSceNpUniversalDataSystem): distinguish literal keys from troph… --body /dev/shm/reviewer-run/precheck/14427/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14427 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14427/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /dev/shm/reviewer-run/precheck/14427/head-6a175479707a-10f35e12/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14427/head-6a175479707a-10f35e12 --json core/libs/prx/libSceNpUniversalDataSystem/src/UdsEvent.cpp core/libs/prx/libSceNpUniversalDataSystem/tests/Events.cpp core/libs/tests/GuestNpTrophyStats.cpp
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Negative control

Not run. The new cases in testStatPropertyPaths and UnlockThroughStats would fail on base, where a literal player.steps key is flattened into the nested path, per the PR; that is from reading the code, not a run.

Findings

Blocking: none.

Non-blocking: none.

Sources

Not verified

  • The C++ tests were not built or run.
  • Hosted: conventions, report, labels, eligibility and library-portability were queued at review time.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728346250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14427#pullrequestreview-5728346250). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T13:44:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Dropping literal dotted and empty keys when deriving statistic paths is correct: the rule parser accepts only word segments joined by `.`, so such a key can never be addressed, and skipping it keeps a literal key from overriding a genuine nested value. ## What I ran - Exact head `6a175479707aedcce08eeddc5bc9f2e2ad4c318c`, base `4768f0aeca680477597b2e42cba60ae49e48802c`. - Environment: Linux, `/usr/bin/python3` 3.11.2, no build. - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14427 --output-dir /dev/shm/reviewer-run/precheck/14427` - ABI audit by hand: `python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --json` (exit 0, 0 findings) - Test-quality helper by hand on `core/libs/tests/GuestNpTrophyStats.cpp` and `core/libs/prx/libSceNpUniversalDataSystem/tests/Events.cpp` from head extracts. Each produced one literal-path registration heuristic; the registration is in `core/libs/prx/libSceNpUniversalDataSystem/CMakeLists.txt` (line 21 for `tests/Events.cpp`, line 59 for `GuestNpTrophyStats.cpp`). - Rule parser read at head: `propertyPath` in `TrophyPackage.cpp`. ## Results Precheck report, checks table, unedited (`/dev/shm/reviewer-run/precheck/14427/report.md`): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check 4768f0aeca680477597b2e42cba60ae49e48802c...6a175479707aedcce08eeddc5bc9f2e2ad4c318c` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --title fix(libSceNpUniversalDataSystem): distinguish literal keys from troph… --body /dev/shm/reviewer-run/precheck/14427/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base 4768f0aeca680477597b2e42cba60ae49e48802c --head 6a175479707aedcce08eeddc5bc9f2e2ad4c318c --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14427 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14427/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /dev/shm/reviewer-run/precheck/14427/head-6a175479707a-10f35e12/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14427/head-6a175479707a-10f35e12 --json core/libs/prx/libSceNpUniversalDataSystem/src/UdsEvent.cpp core/libs/prx/libSceNpUniversalDataSystem/tests/Events.cpp core/libs/tests/GuestNpTrophyStats.cpp` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ## Negative control Not run. The new cases in `testStatPropertyPaths` and `UnlockThroughStats` would fail on base, where a literal `player.steps` key is flattened into the nested path, per the PR; that is from reading the code, not a run. ## Findings **Blocking:** none. **Non-blocking:** none. ## Sources - Rule parser (word segments joined by `.`) at head: https://github.com/boykopovar/AnyPS5/blob/6a175479707aedcce08eeddc5bc9f2e2ad4c318c/core/libs/prx/libSceNpTrophy2/src/TrophyPackage.cpp#L339-L354 - Flatten change at head: https://github.com/boykopovar/AnyPS5/blob/6a175479707aedcce08eeddc5bc9f2e2ad4c318c/core/libs/prx/libSceNpUniversalDataSystem/src/UdsEvent.cpp#L228-L232 ## Not verified - The C++ tests were not built or run. - Hosted: conventions, report, labels, eligibility and library-portability were queued at review time.
MarcZX10 commented 2026-11-14 04:57:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T04:57:00Z.

Review: APPROVED


Reviewed — looks good

The reviewed change at bc5a3e9fec490198a894154cb97fdda911b171a4 consistently excludes empty or dotted key segments from trophy statistic paths, with direct conversion and public API regressions covering nested values and insertion order. Nothing blocks this; the points below are optional.

What I ran

No commands or tests were run; the review bundle reports the author’s test results separately. I read all three changed files listed as reviewed in the manifest: UdsEvent.cpp, Events.cpp, and GuestNpTrophyStats.cpp.

Results

Check Result Note
Source review passed All reviewed files read
Automated checks not run Author reports focused tests passed
Console behavior not run Synthetic tests only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No excluded changed files are listed in the manifest. I did not run the tests or independently verify the author-reported build, CI checks, console behavior, or PS5 parity.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5901766104 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14427#pullrequestreview-5901766104). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T04:57:00Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change at `bc5a3e9fec490198a894154cb97fdda911b171a4` consistently excludes empty or dotted key segments from trophy statistic paths, with direct conversion and public API regressions covering nested values and insertion order. Nothing blocks this; the points below are optional. ## What I ran No commands or tests were run; the review bundle reports the author’s test results separately. I read all three changed files listed as reviewed in the manifest: `UdsEvent.cpp`, `Events.cpp`, and `GuestNpTrophyStats.cpp`. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | All reviewed files read | | Automated checks | not run | Author reports focused tests passed | | Console behavior | not run | Synthetic tests only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No excluded changed files are listed in the manifest. I did not run the tests or independently verify the author-reported build, CI checks, console behavior, or PS5 parity. ## To get this to a good state Nothing is required.
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!14427
No description provided.