Progress counts host-safety fault throws as unimplemented: add a separate fault helper #23391

Closed
opened 2026-11-18 23:57:38 +00:00 by RiverWhy · 0 comments
RiverWhy commented 2026-11-18 23:57:38 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by RiverWhy on 2026-11-18T23:57:38Z.


Problem

tools/progress.py counts an export as implemented once it no longer calls NotImplemented_nid_no_patch. Many exports still call it only on inputs where the console module would crash, or where upstream has undefined behaviour, for example a null pointer or an unreadable guest buffer. On such inputs there is no behaviour left to implement: the host must throw instead of crashing the emulator. But because the throw goes through NotImplemented_nid_no_patch, these exports show as unfinished forever.

The same situation is counted both ways today, depending only on which exception the author picked:

  • In libharfbuzz, the buffer exports throw std::runtime_error for a null buffer (Buffer.cpp:146 onwards) and count as done. hb_shape throws NotImplemented_nid_no_patch for the same null buffer (Shaping.cpp:21) and counts as todo.
  • libharfbuzz shows 31 of 38. Its 7 "todo" exports already forward every valid input to HarfBuzz 10.0.1. Their only NotImplemented_nid_no_patch calls are a null buffer, font, face or feature array, null blob data with a nonzero length, a foreign FreeType face, and a failed load of the bundled ICU data.
  • libfontconfig shows 24 of 53. In it, FcConfigCreate and FcConfigReference always return null, so the "config exists" branches of FcFontList, FcFontMatch, FcFontSort, FcFontSetMatch and FcConfigSubstitute can never run. The other throws are null arguments that Fontconfig 2.15.0 asserts against.

Across core/libs/prx, 133 NotImplemented_nid_no_patch calls in 19 libraries are guarded only by a null check on the same line. There are about 1,900 throw std::invalid_argument sites, many of them for the same kind of input in exports that already count as done.

This understates progress, and it also hides the real gaps: a reader can't tell "behaviour unknown" from "console crashes here, so the host throws".

Proposal

Add a second noreturn helper next to NotImplemented_nid_no_patch in libc/include/General.hpp. The name is open, for example GuestFault_nid_no_patch(name): it would throw the same way, but it is meant only for inputs where the console module faults or asserts, or where upstream behaviour is undefined. Then:

  1. tools/progress.py treats it like a plain throw, so an export whose only remaining throws are faults counts as implemented.
  2. CONTRIBUTING.md and AGENTS.md keep NotImplemented_nid_no_patch for unknown or unimplemented behaviour. The new helper needs a reason, such as "upstream asserts", "module dereferences null" or "unreadable guest pointer", either in the PR or in the library's technical debt, so it isn't used to hide real gaps.
  3. Existing call sites move over only in PRs that justify each one, library by library, rather than in a mass rename.

If you'd rather keep a single helper, an alternative is for progress.py to ignore NotImplemented_nid_no_patch calls whose condition is only null or guest-access checks. That's harder to get right and easier to game, so I'd prefer the explicit helper.

If this is acceptable, I can do the helper and the progress.py change first, then libharfbuzz as the first library, with each call site checked against HarfBuzz 10.0.1.

AI-assisted: yes (Claude Code); the counts and line references are from main at the time of writing.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6479214454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/23391). Originally posted by [RiverWhy](https://github.com/RiverWhy) on 2026-11-18T23:57:38Z. --- ### Problem `tools/progress.py` counts an export as implemented once it no longer calls `NotImplemented_nid_no_patch`. Many exports still call it only on inputs where the console module would crash, or where upstream has undefined behaviour, for example a null pointer or an unreadable guest buffer. On such inputs there is no behaviour left to implement: the host must throw instead of crashing the emulator. But because the throw goes through `NotImplemented_nid_no_patch`, these exports show as unfinished forever. The same situation is counted both ways today, depending only on which exception the author picked: - In `libharfbuzz`, the buffer exports throw `std::runtime_error` for a null buffer (`Buffer.cpp:146` onwards) and count as done. `hb_shape` throws `NotImplemented_nid_no_patch` for the same null buffer (`Shaping.cpp:21`) and counts as todo. - `libharfbuzz` shows 31 of 38. Its 7 "todo" exports already forward every valid input to HarfBuzz 10.0.1. Their only `NotImplemented_nid_no_patch` calls are a null buffer, font, face or feature array, null blob data with a nonzero length, a foreign FreeType face, and a failed load of the bundled ICU data. - `libfontconfig` shows 24 of 53. In it, `FcConfigCreate` and `FcConfigReference` always return null, so the "config exists" branches of `FcFontList`, `FcFontMatch`, `FcFontSort`, `FcFontSetMatch` and `FcConfigSubstitute` can never run. The other throws are null arguments that Fontconfig 2.15.0 asserts against. Across `core/libs/prx`, 133 `NotImplemented_nid_no_patch` calls in 19 libraries are guarded only by a null check on the same line. There are about 1,900 `throw std::invalid_argument` sites, many of them for the same kind of input in exports that already count as done. This understates progress, and it also hides the real gaps: a reader can't tell "behaviour unknown" from "console crashes here, so the host throws". ### Proposal Add a second noreturn helper next to `NotImplemented_nid_no_patch` in `libc/include/General.hpp`. The name is open, for example `GuestFault_nid_no_patch(name)`: it would throw the same way, but it is meant only for inputs where the console module faults or asserts, or where upstream behaviour is undefined. Then: 1. `tools/progress.py` treats it like a plain `throw`, so an export whose only remaining throws are faults counts as implemented. 2. `CONTRIBUTING.md` and `AGENTS.md` keep `NotImplemented_nid_no_patch` for unknown or unimplemented behaviour. The new helper needs a reason, such as "upstream asserts", "module dereferences null" or "unreadable guest pointer", either in the PR or in the library's technical debt, so it isn't used to hide real gaps. 3. Existing call sites move over only in PRs that justify each one, library by library, rather than in a mass rename. If you'd rather keep a single helper, an alternative is for `progress.py` to ignore `NotImplemented_nid_no_patch` calls whose condition is only null or guest-access checks. That's harder to get right and easier to game, so I'd prefer the explicit helper. If this is acceptable, I can do the helper and the `progress.py` change first, then `libharfbuzz` as the first library, with each call site checked against HarfBuzz 10.0.1. AI-assisted: yes (Claude Code); the counts and line references are from `main` at the time of writing.
Sign in to join this conversation.
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#23391
No description provided.