Repository navigation
feat(libSceNpWebApi): implement handle aborts, request options and timeouts - #13455
Conversation
…meouts Give sceNpWebApiAbortHandle, sceNpWebApiAddHttpRequestHeader, sceNpWebApiCheckTimeout, sceNpWebApiCreateMultipartRequest, sceNpWebApiSendRequest2, sceNpWebApiSetHandleTimeout, sceNpWebApiSetMultipartContentType and sceNpWebApiSetRequestTimeout their prototypes and the offline behaviour of the existing model. Requests keep a multipart flag and a timeout whose timer starts on the first send; CheckTimeout aborts expired requests at most once per millisecond. The timeout unit is unverified: shadPS4 logs it as milliseconds but adds it to microsecond process time, which is what is done here. Handles created from SDK 3.00 get a timer slot. Headers and multipart content types are validated and dropped, since nothing is sent. Multipart parts and UtilityParseNpId still throw.
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, The tree also carried the open PR #11843, merged cleanly, so the run is a joint one. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The implementation matches the pinned reference's validation flow; its unresolved timeout-unit question is explicitly documented as unverified.
What I ran
Reviewed head 7a0fe8bde19313284be687c02dc2afb3873dc16e against PR base 9f748f4d8e36ce3714f3b95f3386316e110a9b22. A read-only merge preview onto current main 9304896d89f070f65b8f38bd3a8024d5c19f8fe1 was clean (tree af356ec4171c8e9787df6ab912873e572507681b). Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0.
git diff --check 9f748f4d8e36ce3714f3b95f3386316e110a9b22...7a0fe8bde19313284be687c02dc2afb3873dc16e
python3 tools/check_conventions.py --base 9f748f4d8e36ce3714f3b95f3386316e110a9b22 --head 7a0fe8bde19313284be687c02dc2afb3873dc16e
python3 tools/pr_abi_audit.py --base 9f748f4d8e36ce3714f3b95f3386316e110a9b22 --head 7a0fe8bde19313284be687c02dc2afb3873dc16e --json
python3 tools/pr_test_quality.py --root . core/libs/tests/GuestNpWebApi.cpp
git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/review/pr-13455Results
| Check | Result |
|---|---|
| Diff check and conventions | Passed |
| ABI audit | Passed: 50 symbols, no findings |
| Test-quality heuristic | Warned that it could not find the test path literally; verified registration in the PR's CMake file |
| Current-main merge preview | Clean |
| Aggregate no-build precheck | Its isolated copy lacked local-only, untracked audit scripts; the direct relevant checks above passed |
Unedited output from direct checks
All conventions checks passed.
status: passed
symbols: 50
findings: []
core/libs/tests/GuestNpWebApi.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.
git diff --check produced no output.
af356ec4171c8e9787df6ab912873e572507681b
Negative control
Not run locally because the regression test requires a built C++ target. The PR author reports a negative control in the description; I did not independently reproduce it.
Findings
Non-blocking
The timeout unit is unresolved: the pinned source labels it milliseconds but adds the raw value to a microsecond process-time counter. The PR follows that arithmetic and records the uncertainty; I did not verify timeout timing on a PS5.
Sources
- shadPS4 timeout and request behavior, pinned to commit 1d8004a22f
- PS5 process-time implementation referenced by the PR, pinned to AnyPS5 commit 50c39f09b5
Not verified
No local build or C++ test was run. The hosted Windows build was queued at final refresh; Linux build/test jobs were skipped. The PR author reports a Linux codespace test and negative control, which I did not independently reproduce.
Progress report (9f748f4 → 7a0fe8b)📈 System libraries: 27.3% (+0.04%, +8 implemented functions) ✅ 8 implemented
Changed libraries (implemented exports)
|
|
Checked the eight exports against the cited shadPS4 checks and order and the Orbital prototypes, the shared send path (multipart part check before the abort check), the timer and timeout scan, and the new |
Source of the behaviour
Not measured on a device: NP is out of reach offline, so this follows the same two PS4 references the tree's NpWebApi model already uses, and the debt entry says so.
db_types.json(sceNpWebApiCheckTimeoutreturnsvoid;SendRequest2takes a response information pointer; timeouts areuint32_t).The timeout unit is unverified, and the one source disagrees with itself. shadPS4 logs the value of
SetHandleTimeoutandSetRequestTimeoutasms, but starts the request timer and the handle timer by adding the raw value tosceKernelGetProcessTime(), which counts microseconds (in tree). This branch follows the arithmetic (microseconds of process time), and the debt entry now opens with that gap.AbortHandle(libCtxId, handleId)0AddHttpRequestHeader(requestId, name, value)INVALID_ARGUMENT; library, user context, request0, header unusedCreateMultipartRequest(user, group, path, method, id)INVALID_ARGUMENT; library, user context0, id written when the pointer is not nullSendRequest2(requestId, data, size, info)SendRequest; a multipart request has no part 0:INVALID_ARGUMENTNOT_SIGNED_IN, orABORTED;infountouchedSetHandleTimeout(libCtxId, handleId, timeout)0, elseHANDLE_NOT_FOUNDSetMultipartContentType(requestId, type, boundary)0SetRequestTimeout(requestId, timeout)0, timeout keptCheckTimeout()NOT_SIGNED_INIn-tree lines that change (at
50c39f09b5): the placeholders and their declarations,Request,sceNpWebApiCreateHandle,sceNpWebApiCreateRequest,sceNpWebApiDeleteHandle,sceNpWebApiSendRequestand the inventory table.What
Eight NpWebApi exports get their PS4 prototypes and the offline behaviour of the model the library already follows (#9797), and no longer throw:
sceNpWebApiAbortHandle,sceNpWebApiAddHttpRequestHeader,sceNpWebApiCheckTimeout,sceNpWebApiCreateMultipartRequest,sceNpWebApiSendRequest2,sceNpWebApiSetHandleTimeout,sceNpWebApiSetMultipartContentTypeandsceNpWebApiSetRequestTimeout.sceKernelGetProcessTime.sceNpWebApiSendRequestandsceNpWebApiSendRequest2share one path, soSendRequestnow also rejects a multipart request and starts the timer.SetHandleTimeoutneeds it. Handle timeouts and aborts have no further effect, since no NP request runs on a handle.sceNpWebApiAddMultipartPart,sceNpWebApiSendMultipartRequest2andsceNpWebApiUtilityParseNpIdstill throw: the part layout has a single source, and the tree's NpId layout differs from the one shadPS4 parses into.The debt entry opens with the unverified timeout unit (shadPS4 logs it as milliseconds but counts it in microseconds, as done here), then records that none of this is measured, which source gives what and the timed-out send result.
Tested
mainat50c39f09b5with this branch applied:guest_np_web_apipasses. New cases: every not-found error of each call, null-argument order, the SDK 2.50 method check and the SDK 3.00 handle timer (decided when the handle is created),SendRequest2leaving the response information alone, multipart requests refused by both send calls even when aborted, and a timeout scan over four requests (short timeout sent, short timeout never sent, no timeout,0xfffffffftimeout) where only the sent short one stops reportingABORTED.Export.cppfrommain(its throwing stubs given the new signatures so the test builds),guest_np_web_apiaborts onsceNpWebApiAbortHandle not implemented.python3 tools/check_conventions.py --base origin/mainpasses.tools/progress.pyagainstmain: +8 implemented functions (libSceNpWebApi 18/50 to 26/50).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)