feat(libharfbuzz): implement hb_ot_tag_to_script #15365

Merged
zzokm merged 2 commits from upstream-pr/15365 into main 2026-11-07 05:28:17 +00:00
zzokm commented 2026-11-03 03:12:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zzokm on 2026-11-03T03:12:19Z.


What

Align hb_ot_tag_to_script in libharfbuzz with the reference HarfBuzz implementation and PS5 firmware 13.42 disassembly (libSceVshHarfBuzz.sprx):

  • Special-case only DFLT returning 0 (HB_SCRIPT_INVALID); dflt follows the general path returning Dflt.
  • Map math to Zmth (0x5a6d7468).
  • Fold final 3 tags to 2 before looking up the 10 Indic script tags (e.g. dev3 -> Deva).
  • Implement generic space padding (third-character space repeats second character, fourth-character space repeats third character).
  • General fallback path clears bit 5 of the first byte only without altering the remaining bytes or validating letters.
  • Move test registration inside if(BUILD_TESTING) in core/libs/CMakeLists.txt.

Tested

Windows 11 x86_64, built and tested with Clang 17 (x86_64-w64-windows-gnu) against test suite covering all cases (DFLT, dflt, math, LATN, 1234, 10 Indic v2 tags, v3 folded tags, generic space padding rules, unknown tags).

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5131281535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15365). Originally posted by [zzokm](https://github.com/zzokm) on 2026-11-03T03:12:19Z. --- ### What Align `hb_ot_tag_to_script` in `libharfbuzz` with the reference HarfBuzz implementation and PS5 firmware 13.42 disassembly (`libSceVshHarfBuzz.sprx`): - Special-case only `DFLT` returning 0 (`HB_SCRIPT_INVALID`); `dflt` follows the general path returning `Dflt`. - Map `math` to `Zmth` (`0x5a6d7468`). - Fold final `3` tags to `2` before looking up the 10 Indic script tags (e.g. `dev3` -> `Deva`). - Implement generic space padding (third-character space repeats second character, fourth-character space repeats third character). - General fallback path clears bit 5 of the first byte only without altering the remaining bytes or validating letters. - Move test registration inside `if(BUILD_TESTING)` in `core/libs/CMakeLists.txt`. ### Tested Windows 11 x86_64, built and tested with Clang 17 (`x86_64-w64-windows-gnu`) against test suite covering all cases (DFLT, dflt, math, LATN, 1234, 10 Indic v2 tags, v3 folded tags, generic space padding rules, unknown tags). ### 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: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
BunnyFl commented 2026-11-03 03:19:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T03:19:24Z.

Review: CHANGES_REQUESTED


I compared this against firmware 13.42's system_ex/common_ex/lib/libSceVshHarfBuzz.sprx (sha256 48cbea0616729b66473528b1b234595b4117781b76910ef0511bd4f9465e9717), which exports this NID (uKjh3hI1npw) at 0x4a850. This is disassembly only, not measured on a console. I read every path to its return, including the helper at 0x4a8d0. The table of ten Indic version-2 tags matches yours exactly. The rules around it don't:

 4a850: 89 f8              mov    %edi,%eax
 4a852: 25 fe 00 00 00     and    $0xfe,%eax
 4a857: 83 f8 32           cmp    $0x32,%eax          # last byte '2' or '3'
 4a85a: 74 2d              je     0x4a889             # -> and $0xffffff32 (3 -> 2), helper 0x4a8d0
 4a85c: 81 ff 54 4c 46 44  cmp    $0x44464c54,%edi    # 'DFLT' only
 4a862: 74 30              je     0x4a894             # -> 0
 4a864: 81 ff 68 74 61 6d  cmp    $0x6d617468,%edi    # 'math'
 4a86a: 74 2b              je     0x4a897             # -> 0x5a6d7468 'Zmth'
 4a86c: 89 f8              mov    %edi,%eax
 4a86e: 25 00 ff 00 00     and    $0xff00,%eax
 4a873: 3d 00 20 00 00     cmp    $0x2000,%eax        # third char space: repeat second
 4a878: 74 23              je     0x4a89d
 4a87a: 40 80 ff 20        cmp    $0x20,%dil          # last char space: repeat third
 4a87e: 74 2f              je     0x4a8af
 4a880: 81 e7 ff ff ff df  and    $0xdfffffff,%edi    # clear bit 5 of the first byte only
 4a886: 89 f8              mov    %edi,%eax
 4a888: c3                 ret

Differences from this PR (core/libs/prx/libharfbuzz/Export.cpp on ca9a494d98):

  1. 'dflt': the module special-cases only 'DFLT'. 'dflt' takes the general path and returns 0x44666c74 ('Dflt'), not 0.
  2. 'math': returns 'Zmth'. The PR returns 'Math'.
  3. The general case only clears bit 5 of the first byte. It doesn't lowercase the other three bytes and doesn't validate letters. So 'LATN' returns 'LATN' (the PR gives 'Latn'), and a non-letter tag such as '1234' returns 0x11323334 (the PR gives 'Zzzz').
  4. '3' tags: a final '3' is folded to '2' before the table (at 0x4a889, and $0xffffff32), so 'dev3' returns 'Deva'. The PR falls through to its letter check and returns 'Zzzz'.
  5. Space padding is generic. Any 'xy ' repeats y twice and any 'xyz ' repeats z (0x4a89d-0x4a8c1), so 'abc ' gives 'Abcc'. The PR special-cases only four tags and returns 'Zzzz' for the rest.

These rules look like upstream HarfBuzz's hb_ot_tag_to_script in hb-ot-tag.cc, but I haven't compared the source line by line; the disassembly above is the reference. Could you cover cases 1-5 in GuestHarfBuzz.cpp, with main as the negative control?

Separately: the body isn't the template that AGENTS.md asks for, and it opens with a shadPS4 GPL-2.0-or-later SPDX header. Is any of this code derived from shadPS4? If so, that needs saying.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5746847630 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15365#pullrequestreview-5746847630). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T03:19:24Z. **Review:** CHANGES_REQUESTED --- I compared this against firmware 13.42's `system_ex/common_ex/lib/libSceVshHarfBuzz.sprx` (sha256 `48cbea0616729b66473528b1b234595b4117781b76910ef0511bd4f9465e9717`), which exports this NID (`uKjh3hI1npw`) at `0x4a850`. This is disassembly only, not measured on a console. I read every path to its return, including the helper at `0x4a8d0`. The table of ten Indic version-2 tags matches yours exactly. The rules around it don't: ``` 4a850: 89 f8 mov %edi,%eax 4a852: 25 fe 00 00 00 and $0xfe,%eax 4a857: 83 f8 32 cmp $0x32,%eax # last byte '2' or '3' 4a85a: 74 2d je 0x4a889 # -> and $0xffffff32 (3 -> 2), helper 0x4a8d0 4a85c: 81 ff 54 4c 46 44 cmp $0x44464c54,%edi # 'DFLT' only 4a862: 74 30 je 0x4a894 # -> 0 4a864: 81 ff 68 74 61 6d cmp $0x6d617468,%edi # 'math' 4a86a: 74 2b je 0x4a897 # -> 0x5a6d7468 'Zmth' 4a86c: 89 f8 mov %edi,%eax 4a86e: 25 00 ff 00 00 and $0xff00,%eax 4a873: 3d 00 20 00 00 cmp $0x2000,%eax # third char space: repeat second 4a878: 74 23 je 0x4a89d 4a87a: 40 80 ff 20 cmp $0x20,%dil # last char space: repeat third 4a87e: 74 2f je 0x4a8af 4a880: 81 e7 ff ff ff df and $0xdfffffff,%edi # clear bit 5 of the first byte only 4a886: 89 f8 mov %edi,%eax 4a888: c3 ret ``` Differences from this PR (`core/libs/prx/libharfbuzz/Export.cpp` on `ca9a494d98`): 1. **`'dflt'`:** the module special-cases only `'DFLT'`. `'dflt'` takes the general path and returns `0x44666c74` (`'Dflt'`), not 0. 2. **`'math'`:** returns `'Zmth'`. The PR returns `'Math'`. 3. **The general case** only clears bit 5 of the first byte. It doesn't lowercase the other three bytes and doesn't validate letters. So `'LATN'` returns `'LATN'` (the PR gives `'Latn'`), and a non-letter tag such as `'1234'` returns `0x11323334` (the PR gives `'Zzzz'`). 4. **`'3'` tags:** a final `'3'` is folded to `'2'` before the table (at `0x4a889`, `and $0xffffff32`), so `'dev3'` returns `'Deva'`. The PR falls through to its letter check and returns `'Zzzz'`. 5. **Space padding** is generic. Any `'xy '` repeats `y` twice and any `'xyz '` repeats `z` (`0x4a89d`-`0x4a8c1`), so `'abc '` gives `'Abcc'`. The PR special-cases only four tags and returns `'Zzzz'` for the rest. These rules look like upstream HarfBuzz's `hb_ot_tag_to_script` in `hb-ot-tag.cc`, but I haven't compared the source line by line; the disassembly above is the reference. Could you cover cases 1-5 in `GuestHarfBuzz.cpp`, with `main` as the negative control? Separately: the body isn't [the template](https://github.com/boykopovar/AnyPS5/blob/main/.github/pull_request_template.md) that `AGENTS.md` asks for, and it opens with a shadPS4 `GPL-2.0-or-later` SPDX header. Is any of this code derived from shadPS4? If so, that needs saying.
MarcZX10 commented 2026-11-03 03:24:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T03:24:04Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The implementation differs from HarfBuzz’s tag-conversion rules on several inputs, registers its test outside BUILD_TESTING, and fails the repository’s PR-template check.

What I ran

Reviewed head ca9a494d983593a6293a039e01fccbb8f5784882 against base f6232fcfda70644495273f6b8dd88cf0603463d6; the stack check reported a clean merge preview. Environment: Debian GNU/Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0. No product build or C++ tests were run.

Commands and inspected sources:

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15365
git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...ca9a494d983593a6293a039e01fccbb8f5784882
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --json
# Source inspection: Export.cpp, GuestHarfBuzz.cpp, core/libs/CMakeLists.txt,
# root CMakeLists.txt, PR template, and pinned HarfBuzz implementation.

The author reports running ctest -R guest_harfbuzz -V on Windows 11 x86_64 with Clang 17; I did not independently run that command.

Results

Check Result Note
Source behavior review failed Several mappings differ from the reference implementation
Test registration failed New target is outside BUILD_TESTING
Patch whitespace failed Extra blank line at document EOF
PR template failed Required template headings are absent
Export/NID audit passed 35 symbols; no lexical findings
Merge preview passed Clean against the stated base
Local C++ tests not run Would require building the PR
Hosted conventions failed Same missing template headings
Hosted Windows not run Still pending at review time
Other hosted jobs not applicable Linux and specialized jobs were skipped; intake, labels, portability, eligibility and report passed
Commands and unedited check output

git diff --check ...:

docs/dev/debt/libharfbuzz.md:47: new blank line at EOF.

PR precheck summary (full report: /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/report.md):

# PR precheck report — checks failed

PR: https://github.com/boykopovar/AnyPS5/pull/15365
Head: `ca9a494d983593a6293a039e01fccbb8f5784882`
Base: `f6232fcfda70644495273f6b8dd88cf0603463d6`
Head unchanged at completion: **True**
Base unchanged at completion: **True**

| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` |
| diff_check | failed | `git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...ca9a494d983593a6293a039e01fccbb8f5784882` |
| conventions_and_pr_template | failed | `/usr/bin/python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --title feat(libharfbuzz): implement hb_ot_tag_to_script --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/pr-body.md` |
| changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --json` |
| python_syntax | not_applicable | `No changed Python implementation files.` |
| related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` |
| python_test_registration | not_applicable | `No changed test_*.py files.` |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15365 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/stack` |
| build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` |
| test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8 --json core/libs/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzz.cpp docs/dev/debt/libharfbuzz.md` |
| negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` |

Unedited conventions output:

(pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template
(pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template
(pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template
3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all

Unedited isolated-snapshot helper errors:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_test_quality.py': [Errno 2] No such file or directory

The ABI audit was rerun from the workspace against the same base/head and passed with 35 symbols and no findings. The precheck’s failed isolated helper launches are not evidence of an ABI or test-quality defect.

Negative control

Not run: the C++ test requires an exact-head build. The existing test does not currently assert the mismatching cases listed below, so there is no applicable no-build negative control.

Findings

Blocking

  1. Tag conversion does not match the reference behavior. The implementation special-cases lowercase dflt as invalid, title-cases all tags, rejects non-letters, and handles only four padded tags. HarfBuzz’s implementation special-cases uppercase DFLT and math, otherwise applies its first-byte mask and generic padding rules; it also folds final 2/3 tags before looking up the Indic table. Concrete differences include dflt → Dflt, math → Zmth, LATN → LATN, 1234 → 0x11323334, dev3 → Deva, and abc → Abcc. Update the mapping and tests to match the intended firmware/API behavior. The current tests assert the opposite for dflt, LATN, and numeric tags.
  2. CTest target escapes the test-build guard. guest_harfbuzz_tests is added after the closing endif() for if(BUILD_TESTING), although BUILD_TESTING defaults to OFF. Move the target and its test registration inside the guard so ordinary builds do not add this test executable.
  3. Required PR template is not filled in. The description does not use the current ### What, ### Tested, and ### Checklist headings, and hosted conventions fails on these missing headings. Reformat the description using the current repository template and fill its checklist.

Non-blocking

  • Remove the extra blank line at the end of docs/dev/debt/libharfbuzz.md to clear git diff --check.

Sources

Not verified

  • No local build, C++ test execution, console run, or negative-control run.
  • The author-reported Windows test was not independently verified; the hosted Windows job was pending at the last check.
  • Linux and specialized hosted jobs were skipped. The existing external firmware disassembly cited by another reviewer was not independently inspected; the behavior findings above are based on the pinned HarfBuzz implementation.
  • The lexical ABI audit does not prove binary ABI correctness or runtime behavior.

To get this to a good state

Match the conversion semantics to the intended reference and add assertions for the discrepant cases; place the CTest target inside if(BUILD_TESTING); restore the required PR template headings; and remove the trailing blank line. On the updated head I will rerun the precheck, whitespace check, ABI audit, source review, and inspect the updated hosted checks; a build remains outside this initial no-build review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5746872972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15365#pullrequestreview-5746872972). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T03:24:04Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The implementation differs from HarfBuzz’s tag-conversion rules on several inputs, registers its test outside `BUILD_TESTING`, and fails the repository’s PR-template check. ## What I ran Reviewed head `ca9a494d983593a6293a039e01fccbb8f5784882` against base `f6232fcfda70644495273f6b8dd88cf0603463d6`; the stack check reported a clean merge preview. Environment: Debian GNU/Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0. No product build or C++ tests were run. Commands and inspected sources: ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15365 git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...ca9a494d983593a6293a039e01fccbb8f5784882 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --json # Source inspection: Export.cpp, GuestHarfBuzz.cpp, core/libs/CMakeLists.txt, # root CMakeLists.txt, PR template, and pinned HarfBuzz implementation. ``` The author reports running `ctest -R guest_harfbuzz -V` on Windows 11 x86_64 with Clang 17; I did not independently run that command. ## Results | Check | Result | Note | |---|---|---| | Source behavior review | failed | Several mappings differ from the reference implementation | | Test registration | failed | New target is outside `BUILD_TESTING` | | Patch whitespace | failed | Extra blank line at document EOF | | PR template | failed | Required template headings are absent | | Export/NID audit | passed | 35 symbols; no lexical findings | | Merge preview | passed | Clean against the stated base | | Local C++ tests | not run | Would require building the PR | | Hosted conventions | failed | Same missing template headings | | Hosted Windows | not run | Still pending at review time | | Other hosted jobs | not applicable | Linux and specialized jobs were skipped; intake, labels, portability, eligibility and report passed | <details> <summary>Commands and unedited check output</summary> `git diff --check ...`: ```text docs/dev/debt/libharfbuzz.md:47: new blank line at EOF. ``` PR precheck summary (full report: `/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/report.md`): ```text # PR precheck report — checks failed PR: https://github.com/boykopovar/AnyPS5/pull/15365 Head: `ca9a494d983593a6293a039e01fccbb8f5784882` Base: `f6232fcfda70644495273f6b8dd88cf0603463d6` Head unchanged at completion: **True** Base unchanged at completion: **True** | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | failed | `git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...ca9a494d983593a6293a039e01fccbb8f5784882` | | conventions_and_pr_template | failed | `/usr/bin/python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --title feat(libharfbuzz): implement hb_ot_tag_to_script --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head ca9a494d983593a6293a039e01fccbb8f5784882 --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15365 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8 --json core/libs/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzz.cpp docs/dev/debt/libharfbuzz.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ``` Unedited conventions output: ```text (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template 3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` Unedited isolated-snapshot helper errors: ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/head-ca9a494d9835-135b4fc8/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` The ABI audit was rerun from the workspace against the same base/head and passed with 35 symbols and no findings. The precheck’s failed isolated helper launches are not evidence of an ABI or test-quality defect. </details> ## Negative control Not run: the C++ test requires an exact-head build. The existing test does not currently assert the mismatching cases listed below, so there is no applicable no-build negative control. ## Findings ### Blocking 1. **Tag conversion does not match the reference behavior.** The implementation special-cases lowercase `dflt` as invalid, title-cases all tags, rejects non-letters, and handles only four padded tags. HarfBuzz’s implementation special-cases uppercase `DFLT` and `math`, otherwise applies its first-byte mask and generic padding rules; it also folds final `2`/`3` tags before looking up the Indic table. Concrete differences include `dflt` → `Dflt`, `math` → `Zmth`, `LATN` → `LATN`, `1234` → `0x11323334`, `dev3` → `Deva`, and `abc ` → `Abcc`. Update the mapping and tests to match the intended firmware/API behavior. The current tests assert the opposite for `dflt`, `LATN`, and numeric tags. 2. **CTest target escapes the test-build guard.** `guest_harfbuzz_tests` is added after the closing `endif()` for `if(BUILD_TESTING)`, although `BUILD_TESTING` defaults to `OFF`. Move the target and its test registration inside the guard so ordinary builds do not add this test executable. 3. **Required PR template is not filled in.** The description does not use the current `### What`, `### Tested`, and `### Checklist` headings, and hosted conventions fails on these missing headings. Reformat the description using the current repository template and fill its checklist. ### Non-blocking - Remove the extra blank line at the end of `docs/dev/debt/libharfbuzz.md` to clear `git diff --check`. ## Sources - [Changed implementation and tests at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/core/libs/prx/libharfbuzz/Export.cpp#L139-L194) - [Changed test assertions at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/core/libs/tests/GuestHarfBuzz.cpp#L24-L45) - [CMake test guard and new target at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/core/libs/CMakeLists.txt#L308-L314) and [target placement after the guard](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/core/libs/CMakeLists.txt#L1324-L1340) - [BUILD_TESTING default and test helper](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/CMakeLists.txt#L10-L17) and [default option](https://github.com/boykopovar/AnyPS5/blob/ca9a494d983593a6293a039e01fccbb8f5784882/CMakeLists.txt#L32-L35) - [HarfBuzz tag conversion rules, pinned to commit `df9e6d15140d6bc5e983dcb5508ad254e76c8a0e`](https://github.com/harfbuzz/harfbuzz/blob/df9e6d15140d6bc5e983dcb5508ad254e76c8a0e/src/hb-ot-tag.cc#L64-L120) and [final `2`/`3` handling](https://github.com/harfbuzz/harfbuzz/blob/df9e6d15140d6bc5e983dcb5508ad254e76c8a0e/src/hb-ot-tag.cc#L192-L200) - [Current PR template at reviewed base](https://github.com/boykopovar/AnyPS5/blob/f6232fcfda70644495273f6b8dd88cf0603463d6/.github/pull_request_template.md) ## Not verified - No local build, C++ test execution, console run, or negative-control run. - The author-reported Windows test was not independently verified; the hosted Windows job was pending at the last check. - Linux and specialized hosted jobs were skipped. The existing external firmware disassembly cited by another reviewer was not independently inspected; the behavior findings above are based on the pinned HarfBuzz implementation. - The lexical ABI audit does not prove binary ABI correctness or runtime behavior. ## To get this to a good state Match the conversion semantics to the intended reference and add assertions for the discrepant cases; place the CTest target inside `if(BUILD_TESTING)`; restore the required PR template headings; and remove the trailing blank line. On the updated head I will rerun the precheck, whitespace check, ABI audit, source review, and inspect the updated hosted checks; a build remains outside this initial no-build review.
MarcZX10 commented 2026-11-03 03:45:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T03:45:06Z.

Review: COMMENTED


Re-checked — new head, no blocking findings

The new head resolves the earlier behavior, test-registration, and PR-template findings; approval is withheld only while the hosted Windows job is pending.

What I ran

Re-read all five changed files at head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af, against base f6232fcfda70644495273f6b8dd88cf0603463d6. The stack preview is clean against that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run CTest.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15365
git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...9873d490ae2745d586bd0b2a8d2de810ffb5c9af
python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --title 'feat(libharfbuzz): implement hb_ot_tag_to_script' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/pr-body.md
python3 tools/check_test_registration.py --scripts
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --json
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestHarfBuzz.cpp

I also compared the implementation with the pinned upstream HarfBuzz conversion source and manually verified the test target is inside if(BUILD_TESTING).

Results

Check Result Note
Source review passed Previous conversion mismatches are corrected
Patch and conventions passed Required PR template passes
Merge preview passed Clean against stated base
Export declaration audit passed 35 symbols, no findings
Test registration passed guest_harfbuzz is under BUILD_TESTING
Test-quality heuristic failed False positive; CMake registration is present
Local C++ build and CTest not run Not built in this review
Hosted Windows job not run Pending on exact head
Other applicable hosted checks passed Conventions, portability, labels, intake, report, eligibility
Commands and unedited output

git diff --check ... exited 0 with no output.

Conventions output:

All conventions checks passed.

Test registration output:

232 test script(s), each run by an add_test or a workflow

ABI audit summary output:

{"status":"passed","symbols":35,"findings":[]}

Test-quality heuristic output:

{
  "findings": [
    {
      "path": "core/libs/tests/GuestHarfBuzz.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    }
  ],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

The heuristic is a false positive: core/libs/CMakeLists.txt registers guest_harfbuzz_tests from tests/GuestHarfBuzz.cpp and guest_harfbuzz inside the BUILD_TESTING block.

Precheck table copied from report.md:

| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` |
| diff_check | passed | `git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...9873d490ae2745d586bd0b2a8d2de810ffb5c9af` |
| conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --title feat(libharfbuzz): implement hb_ot_tag_to_script --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/pr-body.md` |
| changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --json` |
| python_syntax | not_applicable | `No changed Python implementation files.` |
| related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` |
| python_test_registration | not_applicable | `No changed test_*.py files.` |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15365 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/stack` |
| build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` |
| test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/head-9873d490ae27-0e061acc/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/head-9873d490ae27-0e061acc --json core/libs/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzz.cpp docs/dev/debt/libharfbuzz.md` |
| negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` |

The precheck's ABI and test-quality helper launches failed because those optional helper files are not in its isolated PR snapshot. The workspace ABI audit above ran successfully on the exact base/head.

Hosted checks at final refresh:

conventions pass
labels pass
eligibility pass
report pass
library-portability pass
windows pending
linux skipping
edge-watch skipping
register-context skipping
relinker skipping
relinker-asan skipping
write-watch skipping

Negative control

I did not run a negative control. The updated test covers DFLT/dflt, math, upper/lower-case general tags, numeric tags, all ten version-2 Indic mappings, folded version-3 tags, generic space padding, and unknown digit tags; it has not been executed locally because that requires a build.

Findings

Blocking

None found in the source-level review.

Non-blocking

No additional non-blocking code findings. The workspace test-quality heuristic warning is resolved by the manual CMake registration check described above.

Sources

Not verified

I did not build AnyPS5 or execute guest_harfbuzz; the Windows hosted job is pending. The precheck’s isolated helper invocations were unavailable, although the workspace ABI audit succeeded and the registration warning was checked against CMake.

To get this to a good state

No code change is requested from this review. Let the Windows job finish. If the head changes, I will rerun the precheck, re-read the complete diff, and repeat the ABI and registration checks on the new SHA; after required CI passes, I can reconsider approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5747018867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15365#pullrequestreview-5747018867). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T03:45:06Z. **Review:** COMMENTED --- # Re-checked — new head, no blocking findings The new head resolves the earlier behavior, test-registration, and PR-template findings; approval is withheld only while the hosted Windows job is pending. ## What I ran Re-read all five changed files at head `9873d490ae2745d586bd0b2a8d2de810ffb5c9af`, against base `f6232fcfda70644495273f6b8dd88cf0603463d6`. The stack preview is clean against that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run CTest. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15365 git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...9873d490ae2745d586bd0b2a8d2de810ffb5c9af python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --title 'feat(libharfbuzz): implement hb_ot_tag_to_script' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/pr-body.md python3 tools/check_test_registration.py --scripts python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --json python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestHarfBuzz.cpp ``` I also compared the implementation with the pinned upstream HarfBuzz conversion source and manually verified the test target is inside `if(BUILD_TESTING)`. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Previous conversion mismatches are corrected | | Patch and conventions | passed | Required PR template passes | | Merge preview | passed | Clean against stated base | | Export declaration audit | passed | 35 symbols, no findings | | Test registration | passed | `guest_harfbuzz` is under `BUILD_TESTING` | | Test-quality heuristic | failed | False positive; CMake registration is present | | Local C++ build and CTest | not run | Not built in this review | | Hosted Windows job | not run | Pending on exact head | | Other applicable hosted checks | passed | Conventions, portability, labels, intake, report, eligibility | <details><summary>Commands and unedited output</summary> `git diff --check ...` exited 0 with no output. Conventions output: ```text All conventions checks passed. ``` Test registration output: ```text 232 test script(s), each run by an add_test or a workflow ``` ABI audit summary output: ```json {"status":"passed","symbols":35,"findings":[]} ``` Test-quality heuristic output: ```json { "findings": [ { "path": "core/libs/tests/GuestHarfBuzz.cpp", "line": 1, "kind": "possible-unregistered-cpp-test", "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage." } ], "negative_control_candidates": [], "limits": [ "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.", "A test that passes against base is not by itself proof that the PR test is inadequate.", "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error." ] } ``` The heuristic is a false positive: `core/libs/CMakeLists.txt` registers `guest_harfbuzz_tests` from `tests/GuestHarfBuzz.cpp` and `guest_harfbuzz` inside the `BUILD_TESTING` block. Precheck table copied from `report.md`: ```text | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check f6232fcfda70644495273f6b8dd88cf0603463d6...9873d490ae2745d586bd0b2a8d2de810ffb5c9af` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --title feat(libharfbuzz): implement hb_ot_tag_to_script --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f6232fcfda70644495273f6b8dd88cf0603463d6 --head 9873d490ae2745d586bd0b2a8d2de810ffb5c9af --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15365 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/head-9873d490ae27-0e061acc/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-9873d490ae27/head-9873d490ae27-0e061acc --json core/libs/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzz.cpp docs/dev/debt/libharfbuzz.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ``` The precheck's ABI and test-quality helper launches failed because those optional helper files are not in its isolated PR snapshot. The workspace ABI audit above ran successfully on the exact base/head. Hosted checks at final refresh: ```text conventions pass labels pass eligibility pass report pass library-portability pass windows pending linux skipping edge-watch skipping register-context skipping relinker skipping relinker-asan skipping write-watch skipping ``` </details> ## Negative control I did not run a negative control. The updated test covers DFLT/dflt, math, upper/lower-case general tags, numeric tags, all ten version-2 Indic mappings, folded version-3 tags, generic space padding, and unknown digit tags; it has not been executed locally because that requires a build. ## Findings ### Blocking None found in the source-level review. ### Non-blocking No additional non-blocking code findings. The workspace test-quality heuristic warning is resolved by the manual CMake registration check described above. ## Sources - [Updated conversion implementation at this head](https://github.com/boykopovar/AnyPS5/blob/9873d490ae2745d586bd0b2a8d2de810ffb5c9af/core/libs/prx/libharfbuzz/Export.cpp#L139-L183) - [Updated cases and Indic/padding coverage](https://github.com/boykopovar/AnyPS5/blob/9873d490ae2745d586bd0b2a8d2de810ffb5c9af/core/libs/tests/GuestHarfBuzz.cpp#L24-L60) - [Test registration inside the testing guard](https://github.com/boykopovar/AnyPS5/blob/9873d490ae2745d586bd0b2a8d2de810ffb5c9af/core/libs/CMakeLists.txt#L1329-L1340) - [Pinned upstream HarfBuzz tag conversion](https://github.com/harfbuzz/harfbuzz/blob/df9e6d15140d6bc5e983dcb5508ad254e76c8a0e/src/hb-ot-tag.cc#L1803-L1832) - [Pinned upstream version-2 and version-3 tag mappings](https://github.com/harfbuzz/harfbuzz/blob/df9e6d15140d6bc5e983dcb5508ad254e76c8a0e/src/hb-ot-tag.cc#L1833-L2032) ## Not verified I did not build AnyPS5 or execute `guest_harfbuzz`; the Windows hosted job is pending. The precheck’s isolated helper invocations were unavailable, although the workspace ABI audit succeeded and the registration warning was checked against CMake. ## To get this to a good state No code change is requested from this review. Let the Windows job finish. If the head changes, I will rerun the precheck, re-read the complete diff, and repeat the ABI and registration checks on the new SHA; after required CI passes, I can reconsider approval.
BunnyFl commented 2026-11-03 03:57:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T03:57:55Z.

Review: APPROVED


Re-review of 9873d490ae: all five points from my review are addressed. hb_ot_tag_to_script in core/libs/prx/libharfbuzz/Export.cpp now follows the firmware 13.42 body at 0x4a850 path for path: the '2'/'3' check with & 0xFFFFFF32 folding before the ten-entry table (else 'Zzzz'), 'DFLT' only, 'math' to 'Zmth', generic space padding, and tag & ~0x20000000.

The padding masks are 0xFF00/0xFF where the module uses 0xdf00/0xdf (0x4a8a2, 0x4a8b4). The result is identical: the target byte is a space (0x20) in both cases, and (c & 0xdf) | 0x20 == c | 0x20.

Windows 11, WinLibs GCC, merged onto current main: guest_harfbuzz passes. It covers 'dflt'→'Dflt', 'math'→'Zmth', 'LATN' unchanged, '1234'→0x11323334, 'dev3'→'Deva', 'abc '→'Abcc' and unknown '2'/'3' tags→'Zzzz'. With main's Export.cpp and InventoryExports.hpp restored the test doesn't build (it calls the new signature), so there's no runtime negative control.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5747089740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15365#pullrequestreview-5747089740). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T03:57:55Z. **Review:** APPROVED --- Re-review of `9873d490ae`: all five points from my review are addressed. `hb_ot_tag_to_script` in `core/libs/prx/libharfbuzz/Export.cpp` now follows the firmware 13.42 body at `0x4a850` path for path: the `'2'`/`'3'` check with `& 0xFFFFFF32` folding before the ten-entry table (else `'Zzzz'`), `'DFLT'` only, `'math'` to `'Zmth'`, generic space padding, and `tag & ~0x20000000`. The padding masks are `0xFF00`/`0xFF` where the module uses `0xdf00`/`0xdf` (`0x4a8a2`, `0x4a8b4`). The result is identical: the target byte is a space (`0x20`) in both cases, and `(c & 0xdf) | 0x20 == c | 0x20`. Windows 11, WinLibs GCC, merged onto current `main`: `guest_harfbuzz` passes. It covers `'dflt'`→`'Dflt'`, `'math'`→`'Zmth'`, `'LATN'` unchanged, `'1234'`→`0x11323334`, `'dev3'`→`'Deva'`, `'abc '`→`'Abcc'` and unknown `'2'`/`'3'` tags→`'Zzzz'`. With main's `Export.cpp` and `InventoryExports.hpp` restored the test doesn't build (it calls the new signature), so there's no runtime negative control.
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!15365
No description provided.