feat(libSceIcu): implement u_strToTitle over the ICU break data #18210

Open
rocklouis055 wants to merge 23 commits from upstream-pr/18210 into main
rocklouis055 commented 2026-11-10 21:20:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rocklouis055 on 2026-11-10T21:20:46Z.


What

Implements u_strToTitle by forwarding it to ICU 78.1. This PR is stacked on #16971; the branch merges #16971's current head (ec69fdad70), and the PR's own changes are 934c673cd6 and 9ae27ad4b5. The slice was claimed in discussion #11150.

  • No iterator: ICU opens a word break iterator for the locale from #16971's built-in break data and titlecases the first cased letter of each word.
  • Guest iterator: a UBreakIterator from this library's ubrk_open is used as is, so the guest's boundaries apply (for example character or sentence breaks). As in ICU, the call replaces the iterator's text.
  • Locale-specific rules come from the locale string: Dutch IJ, Turkish dotted İ, and the title forms of ß and dž.
  • Null (default) locale: throws NotImplemented_nid_no_patch when the call would otherwise proceed, the same as #13578's u_strToLower/u_strToUpper. A failing status or invalid arguments still return ICU's result without throwing.
  • Fallback warning: with #16971's trimmed locale data, locales other than root return U_USING_DEFAULT_WARNING (-127) from the root break rules. The test pins this so it shows up if the data filter changes.
  • Housekeeping: the stub is removed from RecoveredInventory.cpp/.hpp, the recovered-inventory debt entry now counts 48 stubs left in that file, and a titlecasing debt entry is added.

Tested

Linux (GCC, Release):

  • The new guest_icu_titlecase test passes. It covers:
    • word titlecasing in root/en/nl/tr, an apostrophe inside a word, and dž → Dž, ß → Ss;
    • character and sentence break iterators from ubrk_open, including a reused iterator and UAX #29 SB8 (no break before a lowercase sentence start);
    • preflight, exact-fit and counted-length results, and null source, null destination and negative capacity;
    • a failing input status, the default-locale throw, the default locale combined with invalid arguments, and a null UErrorCode.
  • All 37 guest_icu_* tests pass.
  • Windows: -fsyntax-only with zig x86_64-windows-gnu for both new files.
  • Mutation check: ignoring the guest iterator, dropping the locale, always throwing for a null locale, and skipping the argument check all make the test fail. One mutant survives: treating a null locale as root. It is equivalent, because a valid call throws first and ICU never reads the locale on a failing call.

Merge notes:

  • Removing the stub touches the lines next to stubs #16605 removes from RecoveredInventory.cpp/.hpp, so that needs a one-line resolution.
  • #17265 rewrites RecoveredInventory and the same count sentence, so whichever merges second recounts.
  • Nothing else conflicts with an open PR, including #18203 and #18208.

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: #16971
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5249112815 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210). Originally posted by [rocklouis055](https://github.com/rocklouis055) on 2026-11-10T21:20:46Z. --- ### What Implements `u_strToTitle` by forwarding it to ICU 78.1. This PR is stacked on #16971; the branch merges #16971's current head (ec69fdad70), and the PR's own changes are 934c673cd6 and 9ae27ad4b5. The slice was claimed in [discussion #11150](https://github.com/boykopovar/AnyPS5/discussions/11150#discussioncomment-19528546). - **No iterator:** ICU opens a word break iterator for the locale from #16971's built-in break data and titlecases the first cased letter of each word. - **Guest iterator:** a `UBreakIterator` from this library's `ubrk_open` is used as is, so the guest's boundaries apply (for example character or sentence breaks). As in ICU, the call replaces the iterator's text. - Locale-specific rules come from the locale string: Dutch `IJ`, Turkish dotted `İ`, and the title forms of `ß` and `dž`. - **Null (default) locale:** throws `NotImplemented_nid_no_patch` when the call would otherwise proceed, the same as #13578's `u_strToLower`/`u_strToUpper`. A failing status or invalid arguments still return ICU's result without throwing. - **Fallback warning:** with #16971's trimmed locale data, locales other than root return `U_USING_DEFAULT_WARNING` (-127) from the root break rules. The test pins this so it shows up if the data filter changes. - **Housekeeping:** the stub is removed from `RecoveredInventory.cpp`/`.hpp`, the recovered-inventory debt entry now counts 48 stubs left in that file, and a titlecasing debt entry is added. ### Tested Linux (GCC, Release): - The new `guest_icu_titlecase` test passes. It covers: - word titlecasing in root/`en`/`nl`/`tr`, an apostrophe inside a word, and `dž` → `Dž`, `ß` → `Ss`; - character and sentence break iterators from `ubrk_open`, including a reused iterator and UAX #29 SB8 (no break before a lowercase sentence start); - preflight, exact-fit and counted-length results, and null source, null destination and negative capacity; - a failing input status, the default-locale throw, the default locale combined with invalid arguments, and a null `UErrorCode`. - All 37 `guest_icu_*` tests pass. - Windows: `-fsyntax-only` with zig `x86_64-windows-gnu` for both new files. - Mutation check: ignoring the guest iterator, dropping the locale, always throwing for a null locale, and skipping the argument check all make the test fail. One mutant survives: treating a null locale as root. It is equivalent, because a valid call throws first and ICU never reads the locale on a failing call. Merge notes: - Removing the stub touches the lines next to stubs #16605 removes from `RecoveredInventory.cpp`/`.hpp`, so that needs a one-line resolution. - #17265 rewrites `RecoveredInventory` and the same count sentence, so whichever merges second recounts. - Nothing else conflicts with an open PR, including #18203 and #18208. ### 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: #16971 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-10 21:29:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-10T21:29:04Z.

Review: DISMISSED


Reviewed — changes requested

The nested ICU host project requires a newer CMake than the root project promises, and two new tests do not exercise all behavior their checks claim to cover.

What I ran

Reviewed head 934c673cd6f52a798d4ab8794b413540ff746260 against base 41b9e25ddc2b29c1b2fffb4df7aaf495a8867fe0; GitHub reports the PR is open and conflicting with main. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0, CMake 3.25.1.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 18210 --output-dir /tmp/anyps5-pr-precheck-18210

The precheck ran git diff --check, conventions, the lexical ABI audit, dependency/mergeability check, and test-quality heuristics. I also read all changed files in three review slices. I did not build or run CTest.

Results

Check Result Output / note
Diff check Passed git diff --check exited 0 with no output.
Conventions and PR template Passed All conventions checks passed.
ABI audit Passed with warnings The warnings name local test callbacks/helpers; manual inspection confirmed they are not exported ABI symbols.
Test-quality heuristic Passed with warnings It flagged test registration paths; each was confirmed in the ICU CMake test registration.
Dependency/mergeability Failed The current stack is #13578 → #16971 → #18210; #13578's current head is absent from #16971, and #16971/#18210 conflict with main.
Hosted checks 3 passed Conventions, intake, and labels passed. No build job was run.
Build and CTest Not run The initial no-build pass does not compile; the ICU submodule is not initialized in this checkout.

Negative control

Assertion Code change Did the new test fail?
Allocator callback coverage and Unicode direction coverage No mutation was run; exact-head test binaries were not built. Not exercised.

Findings

Blocking

  • The advertised CMake minimum is inconsistent. The root project accepts CMake 3.20, but the new nested ICU host project requires 3.21 and is invoked with the same ${CMAKE_COMMAND}. A build using CMake 3.20 can pass the root version check and then fail while configuring the host project. Align the minimum versions, or remove any 3.21-only requirement from the nested project.
  • The allocator test can miss a large reallocation. Reallocate updates largest only when called with a null pointer; the non-null path calls std::realloc without recording size. The later “does not allocate a copy” assertion therefore does not detect a large allocation through that path. Track non-null reallocation sizes and assert the intended behavior.
  • The Unicode test does not check bidi defaults for unlisted code points. It checks u_charDirection only when UnicodeData.txt provides a direction, while its success message claims matching properties for all code points. Include DerivedBidiClass.txt defaults (or equivalent range coverage), or narrow the claim and report direction coverage accurately.

Non-blocking

  • The dependency report also says #16971 does not contain the current #13578 head. Please verify the intended stack order and update the stack so the dependent heads include their current prerequisites; #18210 itself is based on #16971's reported head.

Sources

Not verified

  • Compilation, CTest, platform-specific behavior, and console behavior were not run.
  • The ICU submodule contents at the pinned gitlink were not inspected because it is not initialized in this checkout.

To get this to a good state

Align the CMake requirements, make the two test claims match what the tests actually exercise, and update the stacked dependency heads. I will rerun the same precheck and review the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5849729622 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210#pullrequestreview-5849729622). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-10T21:29:04Z. **Review:** DISMISSED --- # Reviewed — changes requested The nested ICU host project requires a newer CMake than the root project promises, and two new tests do not exercise all behavior their checks claim to cover. ## What I ran Reviewed head `934c673cd6f52a798d4ab8794b413540ff746260` against base `41b9e25ddc2b29c1b2fffb4df7aaf495a8867fe0`; GitHub reports the PR is open and conflicting with `main`. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0, CMake 3.25.1. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 18210 --output-dir /tmp/anyps5-pr-precheck-18210 ``` The precheck ran `git diff --check`, conventions, the lexical ABI audit, dependency/mergeability check, and test-quality heuristics. I also read all changed files in three review slices. I did not build or run CTest. ## Results | Check | Result | Output / note | |---|---|---| | Diff check | Passed | `git diff --check` exited 0 with no output. | | Conventions and PR template | Passed | `All conventions checks passed.` | | ABI audit | Passed with warnings | The warnings name local test callbacks/helpers; manual inspection confirmed they are not exported ABI symbols. | | Test-quality heuristic | Passed with warnings | It flagged test registration paths; each was confirmed in the ICU CMake test registration. | | Dependency/mergeability | Failed | The current stack is `#13578 → #16971 → #18210`; #13578's current head is absent from #16971, and #16971/#18210 conflict with `main`. | | Hosted checks | 3 passed | Conventions, intake, and labels passed. No build job was run. | | Build and CTest | Not run | The initial no-build pass does not compile; the ICU submodule is not initialized in this checkout. | ## Negative control | Assertion | Code change | Did the new test fail? | |---|---|---| | Allocator callback coverage and Unicode direction coverage | No mutation was run; exact-head test binaries were not built. | Not exercised. | ## Findings ### Blocking - **The advertised CMake minimum is inconsistent.** The root project accepts CMake 3.20, but the new nested ICU host project requires 3.21 and is invoked with the same `${CMAKE_COMMAND}`. A build using CMake 3.20 can pass the root version check and then fail while configuring the host project. Align the minimum versions, or remove any 3.21-only requirement from the nested project. - **The allocator test can miss a large reallocation.** `Reallocate` updates `largest` only when called with a null pointer; the non-null path calls `std::realloc` without recording `size`. The later “does not allocate a copy” assertion therefore does not detect a large allocation through that path. Track non-null reallocation sizes and assert the intended behavior. - **The Unicode test does not check bidi defaults for unlisted code points.** It checks `u_charDirection` only when `UnicodeData.txt` provides a direction, while its success message claims matching properties for all code points. Include `DerivedBidiClass.txt` defaults (or equivalent range coverage), or narrow the claim and report direction coverage accurately. ### Non-blocking - The dependency report also says #16971 does not contain the current #13578 head. Please verify the intended stack order and update the stack so the dependent heads include their current prerequisites; #18210 itself is based on #16971's reported head. ## Sources - [Root CMake minimum and nested host CMake minimum](https://github.com/boykopovar/AnyPS5/blob/934c673cd6f52a798d4ab8794b413540ff746260/CMakeLists.txt#L1), [nested ICU host project](https://github.com/boykopovar/AnyPS5/blob/934c673cd6f52a798d4ab8794b413540ff746260/cmake/icu-host/CMakeLists.txt#L1) - [ICU allocator test](https://github.com/boykopovar/AnyPS5/blob/934c673cd6f52a798d4ab8794b413540ff746260/core/libs/prx/libSceIcu/tests/Data.cpp#L17-L87) - [Unicode data test](https://github.com/boykopovar/AnyPS5/blob/934c673cd6f52a798d4ab8794b413540ff746260/core/libs/prx/libSceIcu/tests/UnicodeData.cpp#L15-L189) ## Not verified - Compilation, CTest, platform-specific behavior, and console behavior were not run. - The ICU submodule contents at the pinned gitlink were not inspected because it is not initialized in this checkout. ## To get this to a good state Align the CMake requirements, make the two test claims match what the tests actually exercise, and update the stacked dependency heads. I will rerun the same precheck and review the new head.
PrivacyOnion commented 2026-11-11 17:16:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T17:16:38Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 934c673cd6:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_icu_break_iterator_tests, guest_icu_case_mapping_tests, guest_icu_data_tests, guest_icu_properties_tests, guest_icu_titlecase_tests, guest_icu_unicode_data_tests built cleanly.
  • CTest (guest_icu_properties, guest_icu_case_mapping, guest_icu_unicode_data, guest_icu_break_iterator, guest_icu_break_unicode_0, guest_icu_break_unicode_1, guest_icu_break_unicode_2, guest_icu_break_unicode_3, guest_icu_titlecase, guest_icu_data_registration, guest_icu_break_allocator):
    1/11 Test #3096: guest_icu_case_mapping ...........   Passed    0.03 sec
    2/11 Test #3095: guest_icu_properties .............   Passed    0.04 sec
    3/11 Test #3098: guest_icu_break_iterator .........   Passed    0.05 sec
    4/11 Test #3099: guest_icu_break_unicode_0 ........   Passed    0.05 sec
    5/11 Test #3100: guest_icu_break_unicode_1 ........   Passed    0.05 sec
    6/11 Test #3101: guest_icu_break_unicode_2 ........   Passed    0.23 sec
    7/11 Test #3102: guest_icu_break_unicode_3 ........   Passed    0.05 sec
    8/11 Test #3103: guest_icu_titlecase ..............   Passed    0.03 sec
    9/11 Test #3097: guest_icu_unicode_data ...........   Passed    0.52 sec
    10/11 Test #3105: guest_icu_break_allocator ........   Passed    0.02 sec
    11/11 Test #3104: guest_icu_data_registration ......   Passed    0.21 sec
    100% tests passed, 0 tests failed out of 11
    
  • Negative control: with core/libs/prx/libSceIcu/CaseMapping.cpp, core/libs/prx/libSceIcu/CaseMapping.hpp, core/libs/prx/libSceIcu/Configuration.cpp, core/libs/prx/libSceIcu/Export.cpp, core/libs/prx/libSceIcu/Identified.hpp, core/libs/prx/libSceIcu/Properties.cpp, core/libs/prx/libSceIcu/Properties.hpp, core/libs/prx/libSceIcu/RecoveredInventory.cpp, core/libs/prx/libSceIcu/RecoveredInventory.hpp, core/libs/prx/libSceIcu/include/InventoryExports.hpp, core/libs/prx/libSceIcu/libSceIcu.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceIcu/Titlecase.cpp for argument validation via InvalidMapping, null error checks throwing APS5_INVALID_ARG_EX, preflighting handling (nullptr destination with 0 capacity), and default locale handling throwing NotImplemented_nid_no_patch.
    • Verified core/libs/prx/libSceIcu/BreakIterator.cpp:24-91 for iterator handle validation, error pointer null checks, type casting to UBreakIteratorType, and boundary iteration APIs (ubrk_first, ubrk_last, ubrk_next, ubrk_previous, ubrk_current, ubrk_following, ubrk_preceding, ubrk_isBoundary, and ubrk_getRuleStatus).
    • Verified core/libs/prx/libSceIcu/Configuration.cpp:19-72 for mutex locking across MemoryLock and NativeLock, allocator snapshotting in Allocate/Reallocate/Release, and cleanup sequencing in u_cleanup_nid_postfix.
    • Verified core/libs/prx/libSceIcu/Data.cpp:9-17 for udata_setCommonData null error checks, UErrorCode conversion, and packaged data registration tests in tests/Data.cpp.
    • Verified cmake/Icu.cmake, cmake/IcuData.cmake, cmake/IcuDataFilter.json, and cmake/icu-host/CMakeLists.txt for build rules, filter syntax, host tool compilation, and .gitignore whitelisting.
    • Verified AGENTS.md compliance across all modified files, confirming zero illegal inline comments and clean removal of replaced stubs from RecoveredInventory.cpp, RecoveredInventory.hpp, and Export.cpp.
  • Concerns:
    • core/libs/prx/libSceIcu/BreakIterator.cpp:95-102: ubrk_getAvailable throws APS5_INVALID_ARG_EX (std::invalid_argument) when index < 0 or index == count instead of returning nullptr. Under the ICU C API contract, out-of-bounds indices must return nullptr. Standard caller loops that iterate available locales until ubrk_getAvailable(i) returns nullptr will abort with an unhandled C++ exception when reaching count. Furthermore, throwing for index == count while returning nullptr for index > count is an arbitrary and buggy special case, and core/libs/prx/libSceIcu/tests/BreakIterator.cpp:241-248 asserts this defective behavior.
    • core/libs/prx/libSceIcu/Data.cpp:19-21: udata_setFileAccess leaves its second parameter std::int32_t* unnamed and completely discards it by passing nullptr to udata_setFileAccess_78. If the caller passes an invalid access enum, ICU cannot return U_ILLEGAL_ARGUMENT_ERROR. Additionally, if the caller passes an existing error status (U_FAILURE(*error)), ICU cannot detect it to prevent mutating global file access state.
    • core/libs/prx/libSceIcu/Titlecase.cpp:20: auto& status = reinterpret_cast<UErrorCode>(error); violates C++ strict aliasing rules ([basic.lval]). An enumeration type is not aliasing-compatible with int32_t. Accessing and passing &status to u_strToTitle invokes undefined behavior; it should use static_cast to a local UErrorCode and write back *error = status, as done in BreakIterator.cpp and Data.cpp.
    • core/libs/prx/libSceIcu/CMakeLists.txt:354: target_sources(libSceIcu PRIVATE BreakIterator.cpp Data.cpp Configuration.cpp) adds Configuration.cpp to libSceIcu a second time, as it was already included in the add_library call on line 1.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5862641752 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210#pullrequestreview-5862641752). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-11T17:16:38Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `934c673cd6`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_icu_break_iterator_tests`, `guest_icu_case_mapping_tests`, `guest_icu_data_tests`, `guest_icu_properties_tests`, `guest_icu_titlecase_tests`, `guest_icu_unicode_data_tests` built cleanly. - **CTest** (`guest_icu_properties`, `guest_icu_case_mapping`, `guest_icu_unicode_data`, `guest_icu_break_iterator`, `guest_icu_break_unicode_0`, `guest_icu_break_unicode_1`, `guest_icu_break_unicode_2`, `guest_icu_break_unicode_3`, `guest_icu_titlecase`, `guest_icu_data_registration`, `guest_icu_break_allocator`): ``` 1/11 Test #3096: guest_icu_case_mapping ........... Passed 0.03 sec 2/11 Test #3095: guest_icu_properties ............. Passed 0.04 sec 3/11 Test #3098: guest_icu_break_iterator ......... Passed 0.05 sec 4/11 Test #3099: guest_icu_break_unicode_0 ........ Passed 0.05 sec 5/11 Test #3100: guest_icu_break_unicode_1 ........ Passed 0.05 sec 6/11 Test #3101: guest_icu_break_unicode_2 ........ Passed 0.23 sec 7/11 Test #3102: guest_icu_break_unicode_3 ........ Passed 0.05 sec 8/11 Test #3103: guest_icu_titlecase .............. Passed 0.03 sec 9/11 Test #3097: guest_icu_unicode_data ........... Passed 0.52 sec 10/11 Test #3105: guest_icu_break_allocator ........ Passed 0.02 sec 11/11 Test #3104: guest_icu_data_registration ...... Passed 0.21 sec 100% tests passed, 0 tests failed out of 11 ``` - **Negative control**: with `core/libs/prx/libSceIcu/CaseMapping.cpp`, `core/libs/prx/libSceIcu/CaseMapping.hpp`, `core/libs/prx/libSceIcu/Configuration.cpp`, `core/libs/prx/libSceIcu/Export.cpp`, `core/libs/prx/libSceIcu/Identified.hpp`, `core/libs/prx/libSceIcu/Properties.cpp`, `core/libs/prx/libSceIcu/Properties.hpp`, `core/libs/prx/libSceIcu/RecoveredInventory.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.hpp`, `core/libs/prx/libSceIcu/include/InventoryExports.hpp`, `core/libs/prx/libSceIcu/libSceIcu.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceIcu/Titlecase.cpp for argument validation via InvalidMapping, null error checks throwing APS5_INVALID_ARG_EX, preflighting handling (nullptr destination with 0 capacity), and default locale handling throwing NotImplemented_nid_no_patch. - Verified core/libs/prx/libSceIcu/BreakIterator.cpp:24-91 for iterator handle validation, error pointer null checks, type casting to UBreakIteratorType, and boundary iteration APIs (ubrk_first, ubrk_last, ubrk_next, ubrk_previous, ubrk_current, ubrk_following, ubrk_preceding, ubrk_isBoundary, and ubrk_getRuleStatus). - Verified core/libs/prx/libSceIcu/Configuration.cpp:19-72 for mutex locking across MemoryLock and NativeLock, allocator snapshotting in Allocate/Reallocate/Release, and cleanup sequencing in u_cleanup_nid_postfix. - Verified core/libs/prx/libSceIcu/Data.cpp:9-17 for udata_setCommonData null error checks, UErrorCode conversion, and packaged data registration tests in tests/Data.cpp. - Verified cmake/Icu.cmake, cmake/IcuData.cmake, cmake/IcuDataFilter.json, and cmake/icu-host/CMakeLists.txt for build rules, filter syntax, host tool compilation, and .gitignore whitelisting. - Verified AGENTS.md compliance across all modified files, confirming zero illegal inline comments and clean removal of replaced stubs from RecoveredInventory.cpp, RecoveredInventory.hpp, and Export.cpp. - **Concerns**: - core/libs/prx/libSceIcu/BreakIterator.cpp:95-102: ubrk_getAvailable throws APS5_INVALID_ARG_EX (std::invalid_argument) when index < 0 or index == count instead of returning nullptr. Under the ICU C API contract, out-of-bounds indices must return nullptr. Standard caller loops that iterate available locales until ubrk_getAvailable(i) returns nullptr will abort with an unhandled C++ exception when reaching count. Furthermore, throwing for index == count while returning nullptr for index > count is an arbitrary and buggy special case, and core/libs/prx/libSceIcu/tests/BreakIterator.cpp:241-248 asserts this defective behavior. - core/libs/prx/libSceIcu/Data.cpp:19-21: udata_setFileAccess leaves its second parameter std::int32_t* unnamed and completely discards it by passing nullptr to udata_setFileAccess_78. If the caller passes an invalid access enum, ICU cannot return U_ILLEGAL_ARGUMENT_ERROR. Additionally, if the caller passes an existing error status (U_FAILURE(*error)), ICU cannot detect it to prevent mutating global file access state. - core/libs/prx/libSceIcu/Titlecase.cpp:20: auto& status = *reinterpret_cast<UErrorCode*>(error); violates C++ strict aliasing rules ([basic.lval]). An enumeration type is not aliasing-compatible with int32_t. Accessing and passing &status to u_strToTitle invokes undefined behavior; it should use static_cast to a local UErrorCode and write back *error = status, as done in BreakIterator.cpp and Data.cpp. - core/libs/prx/libSceIcu/CMakeLists.txt:354: target_sources(libSceIcu PRIVATE BreakIterator.cpp Data.cpp Configuration.cpp) adds Configuration.cpp to libSceIcu a second time, as it was already included in the add_library call on line 1. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
MarcZX10 commented 2026-11-14 05:10:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T05:10:15Z.

Review: COMMENTED


Reviewed — comments

The titlecase wrapper and tests are present, but the review is incomplete because the dependency build changes and other reviewed files were not fully inspected.

What I ran

Read the prepared diff and repository files at head 5e92316dd36f1f37fc890140bee1b3a729b70c81 using repo_read.py tools; no build or tests were run.

Results

Check Result Note
Diff and metadata passed Prepared review inputs read
Targeted code inspection passed Titlecase, iterator, configuration, and CMake paths read
Build and tests not run Author-reported results were not independently checked

Findings

Blocking

None.

Non-blocking

None.

Not verified

The review did not read every file listed as reviewed in the manifest. In particular, the full contents of the new build files, tests, and debt documentation were not all inspected. Build graph correctness, test behavior, platform-specific behavior, and the author's reported test results are therefore not verified. The prepared diff excluded files listed in files.json, which was unavailable through the reader; exclusions were not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5901820352 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210#pullrequestreview-5901820352). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T05:10:15Z. **Review:** COMMENTED --- # Reviewed — comments The titlecase wrapper and tests are present, but the review is incomplete because the dependency build changes and other reviewed files were not fully inspected. ## What I ran Read the prepared diff and repository files at head `5e92316dd36f1f37fc890140bee1b3a729b70c81` using `repo_read.py` tools; no build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and metadata | passed | Prepared review inputs read | | Targeted code inspection | passed | Titlecase, iterator, configuration, and CMake paths read | | Build and tests | not run | Author-reported results were not independently checked | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The review did not read every file listed as reviewed in the manifest. In particular, the full contents of the new build files, tests, and debt documentation were not all inspected. Build graph correctness, test behavior, platform-specific behavior, and the author's reported test results are therefore not verified. The prepared diff excluded files listed in `files.json`, which was unavailable through the reader; exclusions were not verified. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-15 20:59:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:59:56Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 5e92316dd3:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_icu_break_iterator_tests, guest_icu_data_tests, guest_icu_titlecase_tests built cleanly.
  • CTest (guest_icu_break_iterator, guest_icu_break_unicode_0, guest_icu_break_unicode_1, guest_icu_break_unicode_2, guest_icu_break_unicode_3, guest_icu_titlecase, guest_icu_data_registration, guest_icu_break_allocator):
    1/8 Test #3260: guest_icu_break_iterator .........   Passed    0.05 sec
    2/8 Test #3261: guest_icu_break_unicode_0 ........   Passed    0.06 sec
    3/8 Test #3262: guest_icu_break_unicode_1 ........   Passed    0.06 sec
    4/8 Test #3264: guest_icu_break_unicode_3 ........   Passed    0.03 sec
    5/8 Test #3265: guest_icu_titlecase ..............   Passed    0.02 sec
    6/8 Test #3266: guest_icu_data_registration ......   Passed    0.12 sec
    7/8 Test #3267: guest_icu_break_allocator ........   Passed    0.03 sec
    8/8 Test #3263: guest_icu_break_unicode_2 ........   Passed    0.37 sec
    100% tests passed, 0 tests failed out of 8
    
  • Negative control: with core/libs/prx/libSceIcu/Configuration.cpp, core/libs/prx/libSceIcu/Export.cpp, core/libs/prx/libSceIcu/RecoveredInventory.cpp, core/libs/prx/libSceIcu/RecoveredInventory.hpp, core/libs/prx/libSceIcu/include/InventoryExports.hpp, core/libs/prx/libSceIcu/libSceIcu.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceIcu/Titlecase.cpp: verified u_strToTitle_nid_postfix validates error pointer with APS5_INVALID_ARG_EX, preserves pre-existing input failure codes, and checks arguments through InvalidMapping before throwing NotImplemented_nid_no_patch on null default locale.
    • core/libs/prx/libSceIcu/Titlecase.cpp: verified the local UErrorCode variable pattern avoids strict aliasing violations and safely writes back status codes to the guest *error pointer.
    • core/libs/prx/libSceIcu/BreakIterator.cpp: verified all ubrk_* wrappers check for null iterator handles and null error pointers, safely guard out-of-bounds indices in ubrk_getAvailable, and properly convert between int32_t and UErrorCode.
    • core/libs/prx/libSceIcu/Configuration.cpp: verified u_setMemoryFunctions_nid_postfix and u_cleanup_nid_postfix maintain a strictly ordered locking hierarchy between NativeLock and MemoryLock, avoiding deadlocks during ICU cache cleanup.
    • core/libs/prx/libSceIcu/Data.cpp: verified udata_setCommonData and udata_setFileAccess correctly forward to ICU 78 C APIs and safely handle null status pointers.
    • cmake/IcuData.cmake and cmake/icu-host/CMakeLists.txt: verified ExternalProject host tool generation and custom databuilder commands produce icudt78l_dat.c and link into icu_common without external packages or unmanaged binaries.
    • core/libs/prx/libSceIcu/tests/Titlecase.cpp: verified test suite exhaustively exercises root/en/nl/tr locales, custom character and sentence break iterators, preflight/exact buffer sizes, and AGENTS.md compliance with zero comments in code.
    • Verified docs/dev/debt/libSceIcu.md accurately documents u_strToTitle behavior and known gaps: delegation to ICU 78.1, word break iterator fallback from built-in break data, guest UBreakIterator* text replacement behavior, NotImplemented_nid_no_patch throw on null (default) locale, and APS5_INVALID_ARG_EX (std::invalid_argument) on null UErrorCode.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912908592 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210#pullrequestreview-5912908592). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T20:59:56Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `5e92316dd3`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_icu_break_iterator_tests`, `guest_icu_data_tests`, `guest_icu_titlecase_tests` built cleanly. - **CTest** (`guest_icu_break_iterator`, `guest_icu_break_unicode_0`, `guest_icu_break_unicode_1`, `guest_icu_break_unicode_2`, `guest_icu_break_unicode_3`, `guest_icu_titlecase`, `guest_icu_data_registration`, `guest_icu_break_allocator`): ``` 1/8 Test #3260: guest_icu_break_iterator ......... Passed 0.05 sec 2/8 Test #3261: guest_icu_break_unicode_0 ........ Passed 0.06 sec 3/8 Test #3262: guest_icu_break_unicode_1 ........ Passed 0.06 sec 4/8 Test #3264: guest_icu_break_unicode_3 ........ Passed 0.03 sec 5/8 Test #3265: guest_icu_titlecase .............. Passed 0.02 sec 6/8 Test #3266: guest_icu_data_registration ...... Passed 0.12 sec 7/8 Test #3267: guest_icu_break_allocator ........ Passed 0.03 sec 8/8 Test #3263: guest_icu_break_unicode_2 ........ Passed 0.37 sec 100% tests passed, 0 tests failed out of 8 ``` - **Negative control**: with `core/libs/prx/libSceIcu/Configuration.cpp`, `core/libs/prx/libSceIcu/Export.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.cpp`, `core/libs/prx/libSceIcu/RecoveredInventory.hpp`, `core/libs/prx/libSceIcu/include/InventoryExports.hpp`, `core/libs/prx/libSceIcu/libSceIcu.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceIcu/Titlecase.cpp: verified u_strToTitle_nid_postfix validates error pointer with APS5_INVALID_ARG_EX, preserves pre-existing input failure codes, and checks arguments through InvalidMapping before throwing NotImplemented_nid_no_patch on null default locale. - core/libs/prx/libSceIcu/Titlecase.cpp: verified the local UErrorCode variable pattern avoids strict aliasing violations and safely writes back status codes to the guest *error pointer. - core/libs/prx/libSceIcu/BreakIterator.cpp: verified all ubrk_* wrappers check for null iterator handles and null error pointers, safely guard out-of-bounds indices in ubrk_getAvailable, and properly convert between int32_t and UErrorCode. - core/libs/prx/libSceIcu/Configuration.cpp: verified u_setMemoryFunctions_nid_postfix and u_cleanup_nid_postfix maintain a strictly ordered locking hierarchy between NativeLock and MemoryLock, avoiding deadlocks during ICU cache cleanup. - core/libs/prx/libSceIcu/Data.cpp: verified udata_setCommonData and udata_setFileAccess correctly forward to ICU 78 C APIs and safely handle null status pointers. - cmake/IcuData.cmake and cmake/icu-host/CMakeLists.txt: verified ExternalProject host tool generation and custom databuilder commands produce icudt78l_dat.c and link into icu_common without external packages or unmanaged binaries. - core/libs/prx/libSceIcu/tests/Titlecase.cpp: verified test suite exhaustively exercises root/en/nl/tr locales, custom character and sentence break iterators, preflight/exact buffer sizes, and AGENTS.md compliance with zero comments in code. - Verified docs/dev/debt/libSceIcu.md accurately documents u_strToTitle behavior and known gaps: delegation to ICU 78.1, word break iterator fallback from built-in break data, guest UBreakIterator* text replacement behavior, NotImplemented_nid_no_patch throw on null (default) locale, and APS5_INVALID_ARG_EX (std::invalid_argument) on null UErrorCode. Looks Good To Me
ligmaSec commented 2026-12-03 20:26:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:26:29Z.

Review: COMMENTED


u_strToTitle still refuses a null locale, although current main now has the guest default-locale getter that ResourceCount.cpp already uses. Could the rebased wrapper resolve that guest default and add a case that sets the default to Turkish, then passes a null locale with a source that distinguishes Turkish casing? The pinned ICU implementation uses the locale for case mapping even when the caller provides a break iterator. ICU title-case implementation

Source review at 5e92316dd3. The trial merge conflicts in the ICU build and export files.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6177877900 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18210#pullrequestreview-6177877900). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T20:26:29Z. **Review:** COMMENTED --- `u_strToTitle` still refuses a null locale, although current main now has the guest default-locale getter that `ResourceCount.cpp` already uses. Could the rebased wrapper resolve that guest default and add a case that sets the default to Turkish, then passes a null locale with a source that distinguishes Turkish casing? The pinned ICU implementation uses the locale for case mapping even when the caller provides a break iterator. [ICU title-case implementation](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ustr_titlecase_brkiter.cpp#L175-L196) Source review at `5e92316dd3`. The trial merge conflicts in the ICU build and export files. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/18210:upstream-pr/18210'
git switch 'upstream-pr/18210'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/18210'
git switch 'upstream-pr/18210'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/18210'
git switch 'upstream-pr/18210'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/18210'
git switch 'main'
git merge --squash 'upstream-pr/18210'
git switch 'main'
git merge --ff-only 'upstream-pr/18210'
git switch 'main'
git merge 'upstream-pr/18210'
git push origin 'main'
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!18210
No description provided.