feat(libSceNpCppWebApi): implement audited response accessors, iterators and String-vector copyFrom #14136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14136"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-31T20:25:56Z.
What
Ports 26 further
libSceNpCppWebApiexports verified against the copy of the module bundled with PPSA13197 (sce_module), resolving each symbol through the SCE export table and disassembling its body before porting:BasicProfile::getOnlineId(0x14-byte copy at +0x10/+0x20),getPersonalDetail(pointer member at +0x28),getIsOfficiallyVerified(byte at +0xa9);BasicPresence::accountIdIsSet(byte at +0x18);PersonalDetail::getDisplayName(member at +0x88).PlayerSession::getMember(pointer member at +0x30),PlayerSessionForReadgetLeader(0xf8) /getCustomData1/getCustomData2(strings at 0x1c8/0x1e8) /customData2IsSet(byte at 0x200) /getExclusiveLeaderPrivileges(pointer member at 0x188),ResponsePlayerSessionPlayergetPlatform(member at 0x18) /getAccountId(word at 0x10).GetFriendsResponse::getFriends,GetBlockingUsersResponse::getBlocks(member pointers at +0x30),GetBasicPresencesResponse::getBasicPresences(pointer member at +0x30),GetPlayerSessionsResponseBody::getPlayerSessions(0x30),ResponsePlayerSessionMemberPlayer::getPlayers(0x10),FilterProfanityResponse::getMessage(member at +0x38). Pointer-member getters copy the {object, deleter, LibContext} triple and bump the audited reference-count offset (0x00 forIntrusivePtr, 0x30 forVector, 0x38 forVector<String>).Vector<IntrusivePtr<BasicProfile>>::begin,Iterator<IntrusivePtr<BasicProfile>>::operator!=,Iterator<IntrusivePtr<Sku>>::operator++,Vector<String>::copyFrom(releases old elements, adopts the source context when unset, deep-copies eachString, returns 0x80553504 on allocation failure — matching the bundled body's assign helper), and theTransactionBaseoperator=for theCommunicationRestrictionStatusresponse (a plain 16-byte copy).ResponseHeaderBase::getHeaderValuereturns 0x80553512 when the header-store pointer at +0x08 is null (matching the bundled module) and throws past that gate — the real lookup needs response internals no offline call produces.DataApi::getMultiDataStatusesByUserreturnsSCE_NP_WEBAPI_ERROR_NOT_SIGNED_IN, the code signed-out consoles return from request entry points.Tested
ctest -R np_cpp_web_api— 9/9 pass on Windows 11 (MinGW).GuestNpCppWebApiIntrusivePtrnow round-tripsBasicProfile/BasicPresenceobjects through the new getters, exercises theIntrusivePtrmember-copy offsets (0x10/0x28/0x30/0xf8/0x188) with refcount and deleter bookkeeping, iterates a populatedVector<IntrusivePtr<…>>throughbegin/end/!=/++, checks thegetHeaderValue0x80553512 gate and thegetMultiDataStatusesByUseroffline code.GuestNpCppWebApiStringaddsVector<String>::copyFromcoverage: deep-copied buffers, zeroed element reference counts, repeated-copy cleanup.tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T20:39:57Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new
copyFromhelpers erase their contents on self-copy, and the required PR checklist still fails conventions.What I ran
Reviewed head
5922865c7a6a4b65e1c9a798b51579e2001ed940against base0836dfdf4fecb1e0326100c490476e15d3a74da5; the dependency and current-base merge preview was clean. Environment: Debian Linux, GCC 12.2.0.Results
Fixes: noneandGPUs tested: n/aboxes.DestroyVectorBodyhelper, which is intentionallystatic.guest_np_cpp_web_api_intrusive_ptrandguest_np_cpp_web_api_string; the workflow reports 2,533 passed, 0 failed. Linux and specialized jobs were skipped.Conventions check output
ABI audit summary output
Test-quality output
Hosted Windows test output
Findings
Blocking
HostVectorCopyFromandHostVectorCopyFromStringsdestroy or release the destination elements and setbody->size = 0before readingsourceBody->size. Ifsourceis the same vector, or a second intrusive-pointer wrapper to the same body, the source size becomes zero too; the function returns success after silently emptying the vector. Please handlebody == sourceBodybefore mutating it and add a self-copy regression test for each helper.HostVectorCopyFromStringsreturnsParameterAllocationFailedif a string-buffer allocation fails, but it setsbody->sizeonly after the whole loop. If a later allocation fails after earlier elements were copied, those buffers are not counted andDestroyVectorBodywill not free them. Track the number of successfully initialized elements or clean them up on this error path; add allocation-failure coverage if the test harness can inject it safely.Fixes: noneandGPUs tested: n/aboxes. The hosted conventions check fails on those two fields.Non-blocking
Sources
HostVectorCopyFromandHostVectorCopyFromStringsNot verified
I did not build or run the tests locally. Windows CI passed the exact-head tests; Linux, console behavior, and an allocation-failure control were not verified.
To get this to a good state
Handle same-body copies before clearing elements, make partial string-copy failure cleanup leak-free, add regression coverage, and check the two required template boxes. I’ll rerun the same no-build checks and inspect the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T22:35:32Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
The new head fixes the self-copy mutation and string-allocation cleanup, but the generic intrusive-pointer
copyFrompath still lacks the requested self-copy regression test.What I ran
Reviewed head
0d4888bb7684075667dfbfdfad3f1acf33667b4fagainst PR base0836dfdf4fecb1e0326100c490476e15d3a74da5; the exact head has a clean merge preview against currentmain1bc97b9527eaf6b56681cd3465bca67b75329161. Environment: Debian Linux, GCC 12.2.0. The hosted Windows workflow built this exact head.Results
git diff --checkpassed and conventions/template exited successfully (three debt-length warnings only).main. The stack helper also reports a dependency-cycle error because it parses stale prose in #11644; that PR's actual checklist saysDepends on: none, while #12447 depends on #11644 and this PR depends on #14122/#12447.Vector<String>; the intrusive-pointer test file contains nocopyFromcall.Raw check output
Negative control
Vector<IntrusivePtr<T>>bodyVector<String>.Findings
Blocking
HostVectorCopyFromnow returns early when the source and destination share a body, but no test invokes this generic helper'scopyFromexport. The prior bug released every element before reading the source count, so this path needs regression coverage as well as the string-specialized path. Please add a populated intrusive-pointer vector self-copy case, preferably also covering two handles sharing one body, and assert the size, element pointers, and reference counts remain intact.Non-blocking
none. Individual exact-head merge previews are clean.Sources
HostVectorCopyFromNot verified
No local build or CTest was run. Linux CI and console behavior were not tested. Allocation-failure injection was not run. The no-build precheck's ABI and test-quality helpers were unavailable in its isolated checkout.
To get this to a good state
Add the generic intrusive-pointer self-copy regression and verify it preserves contents and reference counts. I will rerun the same no-build checks and inspect the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T07:49:28Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
The only change since my CHANGES_REQUESTED review at
0d4888bbis a new populated intrusive-pointer self-copy test for the genericcopyFrompath, which covers the case I asked for, and I found no blocking defect in it; no local build or CTest was run.What I ran
5b95f25e3d6da79df5c37738a57c399551d2e1f8, the PR head at the start and end of this review. Base: PR base0836dfdf4fecb1e0326100c490476e15d3a74da5. Currentmainused for the merge preview:eb5b2c13df0dd0ffed8f89643507f7a769c79a24; the exact head merges cleanly.0d4888bb7684075667dfbfdfad3f1acf33667b4f...5b95f25e3d6da79df5c37738a57c399551d2e1f8changes onlycore/libs/tests/GuestNpCppWebApiIntrusivePtr.cpp(+65/-0).The precheck's ABI and test-quality steps could not run in its isolated checkout because the helper scripts are absent there, so I ran both helpers by hand from
/marc/AnyPS5/tools.Results
git diff --check(precheck)debt-lengthwarnings and no errors.main. The stack helper's "dependency cycle" error comes from a misparse of #11644's prose; its checklist saysDepends on: none.passed_with_warnings: 1225 symbols. One lexical note for the static helperDestroyVectorBody, which is intentionally private.core/libs/CMakeLists.txt:1020, and the String test has its ownadd_test_executableincore/libs/prx/libSceNpCppWebApi/CMakeLists.txt:24. Both flags are false positives.success. The log shows both changed test binaries passing and100% tests passed, 0 tests failed out of 2568.Precheck conventions output (unedited)
ABI audit output (JSON summary fields; the symbol list of 1225 entries is omitted)
Test-quality output (unedited JSON)
Hosted Windows log lines for this head (unedited)
Negative control
Vector<IntrusivePtr<ResponsePlayerSessionPlayer>>keeps size 2, the same element array, and element refcounts of 2 after a self-copy and after an aliased-handle copy.Export.cppline 1691 would release both elements (2 to 1), setsizeto 0, and read the source count as 0, soRequire(size == 2)would abort.Findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceNpCppWebApi.md(lines 23 to 25, 1183, 1798 and 1106 characters) trigger thedebt-lengthwarning. The base file had one entry over 1000 characters (line 9, 1167). Conventions reports warnings only, so this does not block. Trimming them to the gap and the behaviour it needs would clear the warnings.Sources
HostVectorCopyFrom, early return on a shared bodymainNot verified
HostVectorCopyFromwere not exercised.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T11:00:18Z.
Review: APPROVED
Re-checked — same head, approved
The review request remains active; the previously reviewed head has now completed its hosted checks successfully, and the full review found no blocking issues.
What I ran
Confirmed open PR #14136 is still at head
5b95f25e3d6da79df5c37738a57c399551d2e1f8, based on0836dfdf4fecb1e0326100c490476e15d3a74da5. The full source and test review is in my same-head review. This follow-up checked current hosted status; no local build or test was run.Results
Hosted check output (unedited)
Findings
No blocking findings in the full review of this exact head.
Not verified
I did not run a local build or CTest. Linux, relinker, ASan, register-context, and write-watch jobs were skipped by CI; console behavior was not verified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T18:21:56Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new head fixes the earlier
copyFromissues, but the BasicPresence constructor still performs a misaligneduint32_tstore.What I ran
Reviewed all six changed files at head
94aa48ed2439a2d1d207b326955e2ca49be157ea, against PR baseb28bb772177768f99874ca38f6252cd0139acf2a. The stack report also previewed this head against currentmaina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8; that merge preview was clean. The PR declares dependencies on #11221, #12447 and #14122; the live heads of #12447 and #14122 are not included, so keep the declared landing order in view.Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not configure or build AnyPS5.
Results
main; dependencies remain outstanding.Command output excerpts
Negative control
uint32_tthroughobject + 0x1f; the test does not include an alignment-sanitizer run.Findings
Blocking
The BasicPresence constructor dereferences a
uint32_t*atobject + 0x1f, which cannot meetuint32_talignment when the object itself has its required alignment. This is undefined behavior in C++20 and can be miscompiled or flagged by an alignment sanitizer. Clear the intended bytes withstd::memsetor byte stores instead. The new test should also declare its byte-array object withalignas(8)so the other typed accesses use valid object alignment.Non-blocking
Sources
Not verified
To get this to a good state
Replace the misaligned store and align the test backing storage. On the new head, rerun
python3 tools/check_conventions.py --base origin/mainandctest --test-dir build -R np_cpp_web_api -V; I will re-check the updated diff and the same focused tests.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T19:27:40Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
The new head removes the misaligned store identified in my previous review; I found no blocking issue in the update, but I am withholding approval while the hosted labels check is pending.
What I ran
Reviewed the previous full diff and the two-file update at head
c6a7245b94593c20c372365ad6217c98119a1056, against basea4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. The PR head merges cleanly into the current base. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build locally.Results
Check output
The helper failure is due to those reviewer scripts being absent from the isolated PR snapshot; it is not a source or convention failure.
Negative control
I did not run a local negative control because the C++ tests require a build. The author reports that all four WebApi suites passed on this head; the Windows workflow independently built them and passed the full test run.
Findings
Blocking
None in the reviewed update.
Non-blocking
The PR retains its declared dependency order (
#11221,#12447, and#14122). The live stack report shows #12447 conflicts with currentmainand some dependency heads are not yet included; preserve the declared landing order and recheck integration as those dependencies advance.Sources
Not verified
I did not run a local build, CTest, Linux tests, console behavior, or a negative control. The labels workflow check is still queued. The reported local tests are author-reported; the Windows workflow result is independently visible on the exact head.
To get this to a good state
No code change is requested for this update. Let the queued labels check finish and keep the declared dependency order; I will recheck the exact head and hosted status before considering approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T19:32:38Z.
Review: APPROVED
Re-checked — same head, approved
The reviewed head replaces the misaligned 32-bit store with byte-wise clearing, and all applicable hosted checks have now completed successfully.
What I ran
Confirmed open PR #14136 at head
c6a7245b94593c20c372365ad6217c98119a1056, based ona4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. My earlier full review covers the six-file change; this follow-up checked the constructor fix, its test storage, and current hosted results. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No local build or CTest was run.Results
Hosted check output
Negative control
No code mutation or negative control was run in this follow-up. The changed line is covered by the exact-head Windows build and test workflow.
Findings
Blocking
None found in the full review of head
c6a7245b94593c20c372365ad6217c98119a1056.Non-blocking
The PR retains its declared dependencies on #14122, #11221 and #12447. Preserve that landing order when integrating the overlapping changes.
Sources
Not verified
I did not run a local build, Linux tests, console behavior or a negative control. The Linux and specialized hosted jobs were skipped.
To get this to a good state
No code change is requested for this head. Keep the declared dependency order; I will recheck if the head or dependency state changes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T05:54:57Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
I reviewed the current six-file change at head
606cb246ebeb568152002c526edbbffb441db563and found no blocking issue in the inspected source; required hosted checks are still queued, so this is a comment rather than an approval.What I ran
Confirmed the PR is open on base
d1ae628bc2f62459cce1e9872ba5632c938c71f2. The stack checker reports that this head merges cleanly into the current base. The PR declares dependencies on #14122, #11221 and #12447; #14122 is included, while #12447's current head is not included and conflicts with currentmain, so preserve the declared landing order and revisit integration when that dependency advances. Environment: Debian Linux x86_64, Python 3.11.2, Git 2.39.5. No local build or CTest was run.Results
Raw check output
The precheck's optional helper commands reported these exact errors:
Negative control
No negative control was run; the changed C++ tests require a build to execute.
Findings
Blocking
None found in the reviewed diff.
Non-blocking
The declared dependency order includes #12447, whose current head is not contained in this PR and whose own merge preview conflicts with current
main. This is not a request to rebase the dependent PR early; keep the stack order and reassess after the dependency advances.Sources
Not verified
The hosted checks have not completed. I did not run a local build, CTest, Linux runtime tests, console behavior or a negative control. The ABI and test-quality heuristics were unavailable in the isolated head snapshot.
To get this to a good state
No code change is requested from this review. Let the four hosted checks finish; I will re-check this exact head and update the review if any check fails or when all required checks pass.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T06:48:29Z.
Review: APPROVED
Re-checked — same head, approved
The previously reviewed head
606cb246ebeb568152002c526edbbffb441db563now has all applicable hosted checks complete and successful, and the earlier source review found no blocking issue.What I ran
Re-checked head
606cb246ebeb568152002c526edbbffb441db563against based1ae628bc2f62459cce1e9872ba5632c938c71f2; no new source diff since my review on this head. Environment: Debian Linux x86_64, Python 3.11.2, Git 2.39.5. No local build or CTest was run.Results
Hosted check API output
Negative control
Not applicable to this checks-only re-check; the PR's test code was reviewed previously, and no local build was run.
Findings
Blocking
None found in the previously reviewed source change.
Non-blocking
The PR lists #14122 and #12447 as dependencies, and both remain open. This approval covers the reviewed head; final integration remains subject to that dependency order.
Sources
Not verified
No local C++ build or CTest, Linux run, or console behavior was verified. Linux and specialized hosted jobs were skipped.
To get this to a good state
No change is required for this reviewed head. If the head changes, I will review the new diff and rerun the applicable checks.