feat(libSceIcu): implement ucol_countAvailable and ucol_getAvailable #24180

Merged
kessler-drift merged 1 commit from upstream-pr/24180 into main 2026-11-20 23:08:26 +00:00
kessler-drift commented 2026-11-20 09:19:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kessler-drift on 2026-11-20T09:19:28Z.


What

Implements ucol_countAvailable and ucol_getAvailable in libSceIcu. Both read the collation locales present in the loaded ICU data, as ICU's ucol_countAvailable and ucol_getAvailable do, and drop the stubs from RecoveredInventory.

ucol_getAvailable throws for a negative index, so tools/progress.py still counts it as not implemented; only ucol_countAvailable is counted. Known gaps are in docs/dev/debt/changes/feat-libsceicu-ucol-available.md.

Tested

Ubuntu 26.04 x86-64 container under Rosetta 2 on Apple silicon (Colima VM, kernel 7.0), GCC 15.2; not tested on Windows or on native x86-64. libSceIcu, its tests and libs build; the libSceIcu tests and the public_headers, test registration and progress tests pass.

python3 tools/check_conventions.py --base upstream/main passes. python3 tools/pr_overlap.py --branch reports no open pull request with the same exports or new files. It reports line conflicts with #23850, which removes neighbouring stubs of other exports from RecoveredInventory.cpp and RecoveredInventory.hpp; its diff leaves ucol_countAvailable and ucol_getAvailable unchanged, and whichever lands second needs a rebase of those two lists. It could not compare 17 open pull requests that conflict with main and share CMakeLists.txt, libSceIcu.hpp or the inventory files (#14123, #14144, #14340, #14443, #16250, #16971, #18208, #18210, #19951, #19985, #19998, #21959, #21964, #23063, #23196, #23900 and #23917); none of their diffs adds or removes a line naming these two exports.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5410879331 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24180). Originally posted by [kessler-drift](https://github.com/kessler-drift) on 2026-11-20T09:19:28Z. --- ### What Implements `ucol_countAvailable` and `ucol_getAvailable` in libSceIcu. Both read the collation locales present in the loaded ICU data, as ICU's `ucol_countAvailable` and `ucol_getAvailable` do, and drop the stubs from `RecoveredInventory`. `ucol_getAvailable` throws for a negative index, so `tools/progress.py` still counts it as not implemented; only `ucol_countAvailable` is counted. Known gaps are in `docs/dev/debt/changes/feat-libsceicu-ucol-available.md`. ### Tested Ubuntu 26.04 x86-64 container under Rosetta 2 on Apple silicon (Colima VM, kernel 7.0), GCC 15.2; not tested on Windows or on native x86-64. libSceIcu, its tests and `libs` build; the libSceIcu tests and the `public_headers`, test registration and progress tests pass. `python3 tools/check_conventions.py --base upstream/main` passes. `python3 tools/pr_overlap.py --branch` reports no open pull request with the same exports or new files. It reports line conflicts with #23850, which removes neighbouring stubs of other exports from `RecoveredInventory.cpp` and `RecoveredInventory.hpp`; its diff leaves `ucol_countAvailable` and `ucol_getAvailable` unchanged, and whichever lands second needs a rebase of those two lists. It could not compare 17 open pull requests that conflict with `main` and share `CMakeLists.txt`, `libSceIcu.hpp` or the inventory files (#14123, #14144, #14340, #14443, #16250, #16971, #18208, #18210, #19951, #19985, #19998, #21959, #21964, #23063, #23196, #23900 and #23917); none of their diffs adds or removes a line naming these two exports. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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)
PrivacyOnion commented 2026-11-20 09:25:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T09:25:57Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 403d1da0fc:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_icu_collator_availability_tests built cleanly.
  • CTest (guest_icu_collator_availability_empty, guest_icu_collator_availability_data):
    1/2 Test #4025: guest_icu_collator_availability_empty ...   Passed    0.01 sec
    2/2 Test #4026: guest_icu_collator_availability_data ....   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libSceIcu/RecoveredInventory.cpp, core/libs/prx/libSceIcu/RecoveredInventory.hpp, core/libs/prx/libSceIcu/libSceIcu.hpp, core/libs/prx/libSceIcu/CollatorAvailability.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • CollatorAvailability.cpp: Verified ucol_countAvailable_nid_postfix correctly returns 0 when no data is loaded or count of installed locales when ICU coll index is present.
    • CollatorAvailability.cpp: Verified ucol_getAvailable_nid_postfix handles localeIndex bounds correctly (localeIndex >= available.Count and !available.List return nullptr, negative localeIndex calls NotImplemented_nid_no_patch matching documented debt).
    • CollatorAvailability.cpp: Checked thread-safety of Available() magic static initialization and read-only immutable access across threads.
    • RecoveredInventory.cpp / RecoveredInventory.hpp: Verified clean removal of ucol_countAvailable and ucol_getAvailable from recovered inventory.
    • Debt and CMake: Verified docs/dev/debt/changes fragment format and CMake test setup with clean build/CTest isolation.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990369605 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24180#pullrequestreview-5990369605). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T09:25:57Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `403d1da0fc`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_icu_collator_availability_tests` built cleanly. - **CTest** (`guest_icu_collator_availability_empty`, `guest_icu_collator_availability_data`): ``` 1/2 Test #4025: guest_icu_collator_availability_empty ... Passed 0.01 sec 2/2 Test #4026: guest_icu_collator_availability_data .... Passed 0.01 sec 100% tests passed, 0 tests failed out of 2 ``` - **Negative control**: with `core/libs/prx/libSceIcu/RecoveredInventory.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.hpp`, `core/libs/prx/libSceIcu/libSceIcu.hpp`, `core/libs/prx/libSceIcu/CollatorAvailability.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - CollatorAvailability.cpp: Verified ucol_countAvailable_nid_postfix correctly returns 0 when no data is loaded or count of installed locales when ICU coll index is present. - CollatorAvailability.cpp: Verified ucol_getAvailable_nid_postfix handles localeIndex bounds correctly (localeIndex >= available.Count and !available.List return nullptr, negative localeIndex calls NotImplemented_nid_no_patch matching documented debt). - CollatorAvailability.cpp: Checked thread-safety of Available() magic static initialization and read-only immutable access across threads. - RecoveredInventory.cpp / RecoveredInventory.hpp: Verified clean removal of ucol_countAvailable and ucol_getAvailable from recovered inventory. - Debt and CMake: Verified docs/dev/debt/changes fragment format and CMake test setup with clean build/CTest isolation. Looks Good To Me
MarcZX10 commented 2026-11-20 09:41:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:41:56Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 403d1da0fc72c314aba0e038b6267c446447c802. I inspected the prepared diff and the changed source and test files through repo_read.py; no build or tests were run as part of this review.

Results

Check Result Note
Diff and source inspection passed Seven changed files read
Build and tests not run Author reports these passed
Runtime on console not run Console ICU behavior is unmeasured

Findings

Blocking

None.

Non-blocking

  • ucol_getAvailable caches its first resource lookup for the process lifetime (CollatorAvailability.cpp:55-56). The tests exercise separate empty-data and data modes, but do not cover setting common data after the first call or resetting data with u_cleanup. Please confirm the intended lifecycle matches the console behavior; the debt note already records that the list remains cached across cleanup.

Not verified

  • No build or tests were run. The build, test, and convention results in the PR description are author-reported.
  • Native x86-64, Windows, and physical-console behavior were not verified.
  • Read: core/libs/prx/libSceIcu/CMakeLists.txt, core/libs/prx/libSceIcu/CollatorAvailability.cpp, core/libs/prx/libSceIcu/RecoveredInventory.cpp, core/libs/prx/libSceIcu/RecoveredInventory.hpp, core/libs/prx/libSceIcu/include/CollatorAvailability.hpp, core/libs/prx/libSceIcu/libSceIcu.hpp, core/libs/prx/libSceIcu/tests/CollatorAvailability.cpp, and docs/dev/debt/changes/feat-libsceicu-ucol-available.md.
  • All seven changed files listed in the manifest were read. No files were excluded by the manifest.

To get this to a good state

Nothing is required. The lifecycle confirmation above is optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990600037 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24180#pullrequestreview-5990600037). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:41:56Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this; the points below are optional. ## What I ran Reviewed head `403d1da0fc72c314aba0e038b6267c446447c802`. I inspected the prepared diff and the changed source and test files through `repo_read.py`; no build or tests were run as part of this review. ## Results | Check | Result | Note | |---|---|---| | Diff and source inspection | passed | Seven changed files read | | Build and tests | not run | Author reports these passed | | Runtime on console | not run | Console ICU behavior is unmeasured | ## Findings ### Blocking None. ### Non-blocking - `ucol_getAvailable` caches its first resource lookup for the process lifetime (`CollatorAvailability.cpp:55-56`). The tests exercise separate empty-data and data modes, but do not cover setting common data after the first call or resetting data with `u_cleanup`. Please confirm the intended lifecycle matches the console behavior; the debt note already records that the list remains cached across cleanup. ## Not verified - No build or tests were run. The build, test, and convention results in the PR description are author-reported. - Native x86-64, Windows, and physical-console behavior were not verified. - Read: `core/libs/prx/libSceIcu/CMakeLists.txt`, `core/libs/prx/libSceIcu/CollatorAvailability.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.hpp`, `core/libs/prx/libSceIcu/include/CollatorAvailability.hpp`, `core/libs/prx/libSceIcu/libSceIcu.hpp`, `core/libs/prx/libSceIcu/tests/CollatorAvailability.cpp`, and `docs/dev/debt/changes/feat-libsceicu-ucol-available.md`. - All seven changed files listed in the manifest were read. No files were excluded by the manifest. ## To get this to a good state Nothing is required. The lifecycle confirmation above is optional.
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!24180
No description provided.