feat(libSceNpWebApi): return the measured errors from ReadData and the header getters #11371

Merged
Terminev merged 1 commit from upstream-pr/11371 into main 2026-11-01 21:50:10 +00:00
Terminev commented 2026-10-26 09:27:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Terminev on 2026-10-26T09:27:25Z.


What

Follow-up to #9797, using the PS4 Pro measurements @ntamas94 posted there. Implements three libSceNpWebApi (PS4) exports that still threw:

  • sceNpWebApiReadData(requestId, data, size): INVALID_ARGUMENT without a buffer or for zero bytes, then the usual lookup (LIB_CONTEXT_NOT_FOUND, USER_CONTEXT_NOT_FOUND, REQUEST_NOT_FOUND), ABORTED for an aborted request, otherwise libSceHttp INVALID_ID (0x80431100).
  • sceNpWebApiGetHttpResponseHeaderValue(requestId, fieldName, value, valueSize) and sceNpWebApiGetHttpResponseHeaderValueLength(requestId, fieldName, valueLength): INVALID_ARGUMENT for a missing argument, the same lookup, otherwise libSceHttp PARSE_HTTP_INVALID_RESPONSE (0x80432060).

No request is ever sent offline (sceNpWebApiSendRequest returns NOT_SIGNED_IN), so every request that exists is unsent, and the console returned exactly these two codes for an unsent request, and 0x80552904 for request -1. shadPS4 returns 0 bytes from sceNpWebApiReadData in that case; this follows the console. The argument checks before the lookup, ABORTED for an aborted request and leaving the outputs unwritten follow shadPS4 and are recorded as unverified in docs/dev/debt/libSceNpWebApi.md.

The two header getter placeholders in include/Api.hpp are replaced with these signatures; sceNpWebApiReadData already has the matching declaration #10698 added.

Not in this PR: sceNpWebApiGetHttpStatusCode was not measured, and sceNpWebApiUtilityParseNpId rejected every input the probe tried, so the accepted form is unknown; both still throw.

Overlap: #10698, now merged, declared sceNpWebApiReadData and sceNpWebApiGetHttpStatusCode with the same arguments. This PR implements the first, keeps #10698's declaration of the second, and cuts #10698's debt entry down to sceNpWebApiGetHttpStatusCode.

Tested

Linux x86-64 (Intel Xeon @ 2.10GHz with AVX2, FMA, F16C, BMI1, BMI2, LZCNT and MOVBE), GCC 13.3, Release, on a7b51a0b8 based on main at 801d5b9bc: ctest -R '^guest_np_web_api$' and ctest -R public_headers (65/65) pass. The new test function covers every path of the three exports, including the measured rows, and checks that a failed call leaves the outputs alone. Breaking each path on purpose (a read that succeeds, an ignored abort, a zero size accepted, a missing length output accepted, a header query without the lookup) makes the test fail. SDL was configured with its XRandR and audio checks disabled locally, since that machine lacks those headers; this library and its test do not use SDL. python3 tools/check_conventions.py --base origin/main and git diff --check pass. Not built on Windows. No title tested.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01RoucYS7mQpV23WDUEwXLuU

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5015079523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11371). Originally posted by [Terminev](https://github.com/Terminev) on 2026-10-26T09:27:25Z. --- ### What Follow-up to #9797, using the PS4 Pro measurements @ntamas94 posted there. Implements three libSceNpWebApi (PS4) exports that still threw: - `sceNpWebApiReadData(requestId, data, size)`: `INVALID_ARGUMENT` without a buffer or for zero bytes, then the usual lookup (`LIB_CONTEXT_NOT_FOUND`, `USER_CONTEXT_NOT_FOUND`, `REQUEST_NOT_FOUND`), `ABORTED` for an aborted request, otherwise libSceHttp `INVALID_ID` (`0x80431100`). - `sceNpWebApiGetHttpResponseHeaderValue(requestId, fieldName, value, valueSize)` and `sceNpWebApiGetHttpResponseHeaderValueLength(requestId, fieldName, valueLength)`: `INVALID_ARGUMENT` for a missing argument, the same lookup, otherwise libSceHttp `PARSE_HTTP_INVALID_RESPONSE` (`0x80432060`). No request is ever sent offline (`sceNpWebApiSendRequest` returns `NOT_SIGNED_IN`), so every request that exists is unsent, and the console returned exactly these two codes for an unsent request, and `0x80552904` for request -1. shadPS4 returns 0 bytes from `sceNpWebApiReadData` in that case; this follows the console. The argument checks before the lookup, `ABORTED` for an aborted request and leaving the outputs unwritten follow shadPS4 and are recorded as unverified in `docs/dev/debt/libSceNpWebApi.md`. The two header getter placeholders in `include/Api.hpp` are replaced with these signatures; `sceNpWebApiReadData` already has the matching declaration #10698 added. Not in this PR: `sceNpWebApiGetHttpStatusCode` was not measured, and `sceNpWebApiUtilityParseNpId` rejected every input the probe tried, so the accepted form is unknown; both still throw. Overlap: #10698, now merged, declared `sceNpWebApiReadData` and `sceNpWebApiGetHttpStatusCode` with the same arguments. This PR implements the first, keeps #10698's declaration of the second, and cuts #10698's debt entry down to `sceNpWebApiGetHttpStatusCode`. ### Tested Linux x86-64 (Intel Xeon @ 2.10GHz with AVX2, FMA, F16C, BMI1, BMI2, LZCNT and MOVBE), GCC 13.3, Release, on a7b51a0b8 based on main at 801d5b9bc: `ctest -R '^guest_np_web_api$'` and `ctest -R public_headers` (65/65) pass. The new test function covers every path of the three exports, including the measured rows, and checks that a failed call leaves the outputs alone. Breaking each path on purpose (a read that succeeds, an ignored abort, a zero size accepted, a missing length output accepted, a header query without the lookup) makes the test fail. SDL was configured with its XRandR and audio checks disabled locally, since that machine lacks those headers; this library and its test do not use SDL. `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. Not built on Windows. No title tested. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RoucYS7mQpV23WDUEwXLuU
MarcZX10 commented 2026-10-26 09:32:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T09:32:15Z.

Review: COMMENTED


I reviewed exact head 91772d8a556c623eec2c3a194020a4668ad62ee8 against current main 4e43321bd6ceccdc1ae28568bbbc35d9a6446464. The implementation and tests are consistent with the stated offline-request behavior, and the argument/lookup uncertainties are recorded in docs/dev/debt/libSceNpWebApi.md. python3 -I tools/check_conventions.py --base upstream/main --head upstream/pr/11371 and git diff --check upstream/main...upstream/pr/11371 pass. I could not run guest_np_web_api: local configuration stops because the SDL2 submodule is uninitialized, and the host has no system SDL2 package. Hosted product jobs are skipped by path policy.

One integration note: an exact pairwise merge preview with open #10698 conflicts in core/libs/prx/libSceNpWebApi/Export.cpp, where that PR also changes sceNpWebApiReadData from the old stub. This PR merges current main cleanly and does not depend on #10698, but the two branches need reconciliation so the remaining signature declarations in #10698 are preserved if this implementation lands first.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5649904863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11371#pullrequestreview-5649904863). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T09:32:15Z. **Review:** COMMENTED --- I reviewed exact head `91772d8a556c623eec2c3a194020a4668ad62ee8` against current `main` `4e43321bd6ceccdc1ae28568bbbc35d9a6446464`. The implementation and tests are consistent with the stated offline-request behavior, and the argument/lookup uncertainties are recorded in `docs/dev/debt/libSceNpWebApi.md`. `python3 -I tools/check_conventions.py --base upstream/main --head upstream/pr/11371` and `git diff --check upstream/main...upstream/pr/11371` pass. I could not run `guest_np_web_api`: local configuration stops because the SDL2 submodule is uninitialized, and the host has no system SDL2 package. Hosted product jobs are skipped by path policy. One integration note: an exact pairwise merge preview with open #10698 conflicts in `core/libs/prx/libSceNpWebApi/Export.cpp`, where that PR also changes `sceNpWebApiReadData` from the old stub. This PR merges current `main` cleanly and does not depend on #10698, but the two branches need reconciliation so the remaining signature declarations in #10698 are preserved if this implementation lands first.
MarcZX10 commented 2026-10-26 10:49:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T10:49:47Z.

Review: APPROVED


Reviewed exact head 91772d8a556c623eec2c3a194020a4668ad62ee8. The request lookup/error ordering, measured unsent-response codes, aborted-read behavior, and unchanged output buffers are covered by the implementation and regression cases. The PR reports guest_np_web_api and public_headers passing at this head; hosted eligibility, conventions, intake, and labels also pass, while product jobs are skipped by path policy. I attempted a local CTest rerun, but the retained build directory has zero registered tests, so I am relying on the PR's focused run report rather than claiming an independent test pass. No correctness issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5650850212 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11371#pullrequestreview-5650850212). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T10:49:47Z. **Review:** APPROVED --- Reviewed exact head 91772d8a556c623eec2c3a194020a4668ad62ee8. The request lookup/error ordering, measured unsent-response codes, aborted-read behavior, and unchanged output buffers are covered by the implementation and regression cases. The PR reports guest_np_web_api and public_headers passing at this head; hosted eligibility, conventions, intake, and labels also pass, while product jobs are skipped by path policy. I attempted a local CTest rerun, but the retained build directory has zero registered tests, so I am relying on the PR's focused run report rather than claiming an independent test pass. No correctness issue found.
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!11371
No description provided.