feat(libSceJson2): implement sce::Json::Array::pop_front #9628

Merged
JJenkx merged 1 commit from upstream-pr/9628 into main 2026-10-23 02:38:17 +00:00
JJenkx commented 2026-10-22 05:02:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T05:02:59Z.


What

This PR implements sce::Json::Array::pop_front() (_ZN3sce4Json5Array9pop_frontEv, NID pPs3qZTZQvQ) in libSceJson2.

Why: Graven (PPSA09614) imports it from one call site in its executable. No built library exports it, so tools/import_audit.py lists it as absent, and the loader stops before the title starts.

Behaviour:

  • It removes the first element and destroys it, as clear does for every element.
  • On an empty array it throws std::out_of_range, as front and back do here.
  • The console's result for an empty array is unverified, and the libSceJson2 debt file lists it.

Tested

  • Platform: Windows 11 (10.0.22621), WinLibs GCC 15.2.0 UCRT r7, Release.
  • Unit tests: guest_json now pops both elements of a two-element copy, checks the remaining element and the empty array, and expects the throw on a third pop. It passes, as do guest_json_copy_failure, param_json_parser and param_json_utf8.
  • Import audit of Graven:
    • I unwrapped eboot.bin and sce_module/*.prx and converted them with relinker --windows --registry.
    • On main the audit reports absent 1 (pPs3qZTZQvQ) and exits 1. With this PR it reports absent 0 and exits 0.
    • 41 imports are still stubs that throw when called, so the title may stop later.
  • Conventions: tools/check_conventions.py passes.
  • Not tested: Graven itself has not been run.

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: PPSA09614 #9708 (Graven), past the loader
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4962379898 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T05:02:59Z. --- ### What This PR implements `sce::Json::Array::pop_front()` (`_ZN3sce4Json5Array9pop_frontEv`, NID `pPs3qZTZQvQ`) in libSceJson2. **Why:** Graven (PPSA09614) imports it from one call site in its executable. No built library exports it, so `tools/import_audit.py` lists it as **absent**, and the loader stops before the title starts. **Behaviour:** - It removes the first element and destroys it, as `clear` does for every element. - On an empty array it throws `std::out_of_range`, as `front` and `back` do here. - The console's result for an empty array is unverified, and the libSceJson2 debt file lists it. ### Tested - **Platform:** Windows 11 (10.0.22621), WinLibs GCC 15.2.0 UCRT r7, Release. - **Unit tests:** `guest_json` now pops both elements of a two-element copy, checks the remaining element and the empty array, and expects the throw on a third pop. It passes, as do `guest_json_copy_failure`, `param_json_parser` and `param_json_utf8`. - **Import audit of Graven:** - I unwrapped `eboot.bin` and `sce_module/*.prx` and converted them with `relinker --windows --registry`. - On `main` the audit reports `absent 1` (`pPs3qZTZQvQ`) and exits 1. With this PR it reports `absent 0` and exits 0. - 41 imports are still stubs that throw when called, so the title may stop later. - **Conventions:** `tools/check_conventions.py` passes. - **Not tested:** Graven itself has not been run. ### 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: PPSA09614 #9708 (Graven), past the loader - [x] GPUs tested: n/a - [x] AI-assisted: yes
harisibrar1 commented 2026-10-22 06:01:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T06:01:40Z.

Review: APPROVED


Checked against main 4a17c7175 and the NID calculator:

  • The NID for _ZN3sce4Json5Array9pop_frontEv computes to pPs3qZTZQvQ, as the description says.
  • Destroy on the front Value followed by std::list::pop_front frees the node and anything nested in it, the same way clear does. Because the storage is a std::list, iterators to the other elements, including the stored end, stay valid.
  • The empty-array throw is consistent with front and back and is recorded in the debt file. The tests cover both pops and the empty case.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609875003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#pullrequestreview-5609875003). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-22T06:01:40Z. **Review:** APPROVED --- Checked against main 4a17c7175 and the NID calculator: - The NID for `_ZN3sce4Json5Array9pop_frontEv` computes to `pPs3qZTZQvQ`, as the description says. - `Destroy` on the front `Value` followed by `std::list::pop_front` frees the node and anything nested in it, the same way `clear` does. Because the storage is a `std::list`, iterators to the other elements, including the stored `end`, stay valid. - The empty-array throw is consistent with `front` and `back` and is recorded in the debt file. The tests cover both pops and the empty case. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-10-22 09:23:32 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


The implementation removes and destroys the front list value, matching clear’s ownership behavior; the NID/name and signature have independent review confirmation. The test covers both pops, remaining contents and the empty-array throw. The PR reports a useful current-main title-specific import audit: Graven (PPSA09614) has one absent import on main and none on this PR, though the title itself has not yet been run. Current-head conventions/eligibility/intake/labels/report checks pass; product test jobs were skipped. I ran current-main conventions and git diff --check; both pass. I did not rerun the Windows runtime test.

I could not find an existing Game bring-up discussion for PPSA09614/Graven in the repository’s first 100 discussions. CONTRIBUTING requires title fixes to link the title’s Game bring-up discussion and keep its open-PR list current. Please create or locate the appropriate discussion, add this PR and the remaining 41 throwing imports as needed, then link it in the Unblocks checklist. This is the outstanding repository-rule item before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5612000192 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#pullrequestreview-5612000192). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T09:23:32Z. **Review:** CHANGES_REQUESTED --- The implementation removes and destroys the front list value, matching `clear`’s ownership behavior; the NID/name and signature have independent review confirmation. The test covers both pops, remaining contents and the empty-array throw. The PR reports a useful current-main title-specific import audit: Graven (PPSA09614) has one absent import on main and none on this PR, though the title itself has not yet been run. Current-head conventions/eligibility/intake/labels/report checks pass; product test jobs were skipped. I ran current-main conventions and `git diff --check`; both pass. I did not rerun the Windows runtime test. I could not find an existing Game bring-up discussion for PPSA09614/Graven in the repository’s first 100 discussions. CONTRIBUTING requires title fixes to link the title’s Game bring-up discussion and keep its open-PR list current. Please create or locate the appropriate discussion, add this PR and the remaining 41 throwing imports as needed, then link it in the `Unblocks` checklist. This is the outstanding repository-rule item before merge.
JJenkx commented 2026-10-22 09:30:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T09:30:15Z.


Thanks @MarcZX10. I created the Game bring-up discussion, #9708, and linked it on the Unblocks line (PPSA09614 #9708). It lists this PR as the one open PR the title needs. It also lists the 28 functions behind the audit's 41 throwing import entries, grouped by library, with #9059 noted for __tls_get_addr. It says plainly that Graven hasn't been launched yet: everything in it comes from the import audit, so whether the title reaches any of the throwing imports is unknown until a run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337476601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#issuecomment-6337476601). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T09:30:15Z. --- Thanks @MarcZX10. I created the Game bring-up discussion, #9708, and linked it on the `Unblocks` line (`PPSA09614 #9708`). It lists this PR as the one open PR the title needs. It also lists the 28 functions behind the audit's 41 throwing import entries, grouped by library, with #9059 noted for `__tls_get_addr`. It says plainly that Graven hasn't been launched yet: everything in it comes from the import audit, so whether the title reaches any of the throwing imports is unknown until a run.
JJenkx commented 2026-10-22 10:03:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T10:03:30Z.


Rebased onto current main cc0078595d (it was 63 commits behind); the new head is bf2eb26bec, with no conflicts. On Windows (WinLibs GCC 15.2.0 r7, Release), the JSON tests (guest_json and the three others matching json) pass three times out of three on the rebased head. Graven's (PPSA09614) import audit with these libraries still reports absent 0. On main it reports 1, pPs3qZTZQvQ.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6338089014 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#issuecomment-6338089014). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T10:03:30Z. --- Rebased onto current `main` cc0078595d (it was 63 commits behind); the new head is bf2eb26bec, with no conflicts. On Windows (WinLibs GCC 15.2.0 r7, Release), the JSON tests (`guest_json` and the three others matching `json`) pass three times out of three on the rebased head. Graven's (PPSA09614) import audit with these libraries still reports `absent 0`. On `main` it reports 1, `pPs3qZTZQvQ`.
JJenkx commented 2026-10-22 12:14:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T12:14:34Z.


Rebased onto main 8b3a6ba88d. The only conflict was the neighbouring docs/dev/debt/libSceJson2.md entry for real-number conversion, and both entries are kept. guest_json, guest_json_numeric_locale, guest_json_copy_failure, param_json_parser and param_json_utf8 pass, as does tools/check_conventions.py (Windows, UCRT GCC 15.2, Release).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340473931 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#issuecomment-6340473931). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T12:14:34Z. --- Rebased onto `main` 8b3a6ba88d. The only conflict was the neighbouring `docs/dev/debt/libSceJson2.md` entry for real-number conversion, and both entries are kept. `guest_json`, `guest_json_numeric_locale`, `guest_json_copy_failure`, `param_json_parser` and `param_json_utf8` pass, as does `tools/check_conventions.py` (Windows, UCRT GCC 15.2, Release).
MarcZX10 commented 2026-10-22 12:59:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:59:47Z.

Review: APPROVED


The requested title-tracking item is resolved: #9708 is a Game bring-up discussion for PPSA09614, links this PR as the absent-import fix, records that the title has not been launched, and lists the remaining throwing imports without asserting they are runtime stops. The PR is based on current main and its checklist links Unblocks: PPSA09614 #9708.

I independently compiled the exact PR Export.cpp and GuestJson.cpp together on Linux (with a small NotImplemented_nid_no_patch stub for unreachable unrelated exports); the complete guest_json executable passed. Exact-head diff-check, conventions against current main, and test registration (171 scripts) also pass. The PR reports Windows focused JSON tests passing three times and the Graven import audit changing from one absent symbol on main to zero on this PR. Hosted product jobs are skipped by path filters, and I did not run Graven itself.

I also ran the direct-source test under ASan/UBSan. LeakSanitizer reports 48 bytes from three iterator allocations in the existing GuestJson test; compiling and running the unchanged current-main Export.cpp and GuestJson.cpp produces the same three allocations and byte count. No new sanitizer finding appeared in the pop-front path. The PR’s implementation and empty-array limitation are documented, and I found no remaining blocker. Approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5614554932 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9628#pullrequestreview-5614554932). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T12:59:47Z. **Review:** APPROVED --- The requested title-tracking item is resolved: #9708 is a Game bring-up discussion for PPSA09614, links this PR as the absent-import fix, records that the title has not been launched, and lists the remaining throwing imports without asserting they are runtime stops. The PR is based on current `main` and its checklist links `Unblocks: PPSA09614 #9708`. I independently compiled the exact PR `Export.cpp` and `GuestJson.cpp` together on Linux (with a small `NotImplemented_nid_no_patch` stub for unreachable unrelated exports); the complete `guest_json` executable passed. Exact-head diff-check, conventions against current `main`, and test registration (171 scripts) also pass. The PR reports Windows focused JSON tests passing three times and the Graven import audit changing from one absent symbol on main to zero on this PR. Hosted product jobs are skipped by path filters, and I did not run Graven itself. I also ran the direct-source test under ASan/UBSan. LeakSanitizer reports 48 bytes from three iterator allocations in the existing `GuestJson` test; compiling and running the unchanged current-main `Export.cpp` and `GuestJson.cpp` produces the same three allocations and byte count. No new sanitizer finding appeared in the pop-front path. The PR’s implementation and empty-array limitation are documented, and I found no remaining blocker. Approved.
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!9628
No description provided.