fix(import-audit): parse export aliases as C++ tokens #4196

Merged
Lorkydey merged 1 commit from upstream-pr/4196 into main 2026-10-12 07:30:55 +00:00
Lorkydey commented 2026-10-12 01:06:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-12T01:06:35Z.


What

import_audit.py can report a throwing export as implemented solely because its APS5_EXPORT declaration contains whitespace, comments or a line continuation. A commented-out declaration or a raw-string example can also replace the real alias in the audit's map.

Reuse the existing C++ token parser in nid_names.source_aliases for the audit. It now yields known and unknown aliases; the unknown-name filter stays in collect_unknowns, preserving the NID inventory CLI's behavior.

Reproduction on main 7a84b222: keep a built libkernel.prx unchanged and, in a source copy of Unimplemented.cpp, reformat APS5_EXPORT("AC1FtjqMCL0", sceKernelUnknown03) across lines. The command-line audit changes from stub to implemented on main. With this fix it remains stub, with the correct function name.

Tested

Windows 11 Pro, Python 3.12.4:

  • The two new audit tests fail on main in all nine subcases. They cover formatted declarations for known and unknown names, line splicing, and misleading aliases in comments and raw strings.
  • python -m unittest tools.tests.test_import_audit tools.tests.test_nid_names: 59 tests pass, including a check that known aliases do not enter the unknown-NID inventory.
  • Ran the actual audit CLI against an unchanged built libkernel.prx and the source-copy reproduction above: main/original declaration = stub; main/reformatted declaration = implemented; fix/reformatted declaration = stub.
  • Conventions and whitespace checks pass.
  • Checked file lists for all 406 open PRs: none touch the four changed files. Searched open and closed PRs for the same audit/alias problem and found no matching correction.

This validates the diagnostic tool. No game run, full native build or Linux/macOS run was performed for this Python-only change.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823732497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4196). Originally posted by [Lorkydey](https://github.com/Lorkydey) on 2026-10-12T01:06:35Z. --- ### What `import_audit.py` can report a throwing export as implemented solely because its `APS5_EXPORT` declaration contains whitespace, comments or a line continuation. A commented-out declaration or a raw-string example can also replace the real alias in the audit's map. Reuse the existing C++ token parser in `nid_names.source_aliases` for the audit. It now yields known and unknown aliases; the unknown-name filter stays in `collect_unknowns`, preserving the NID inventory CLI's behavior. Reproduction on `main` `7a84b222`: keep a built `libkernel.prx` unchanged and, in a source copy of `Unimplemented.cpp`, reformat `APS5_EXPORT("AC1FtjqMCL0", sceKernelUnknown03)` across lines. The command-line audit changes from `stub` to `implemented` on main. With this fix it remains `stub`, with the correct function name. ### Tested Windows 11 Pro, Python 3.12.4: - The two new audit tests fail on main in all nine subcases. They cover formatted declarations for known and unknown names, line splicing, and misleading aliases in comments and raw strings. - `python -m unittest tools.tests.test_import_audit tools.tests.test_nid_names`: 59 tests pass, including a check that known aliases do not enter the unknown-NID inventory. - Ran the actual audit CLI against an unchanged built `libkernel.prx` and the source-copy reproduction above: main/original declaration = `stub`; main/reformatted declaration = `implemented`; fix/reformatted declaration = `stub`. - Conventions and whitespace checks pass. - Checked file lists for all 406 open PRs: none touch the four changed files. Searched open and closed PRs for the same audit/alias problem and found no matching correction. This validates the diagnostic tool. No game run, full native build or Linux/macOS run was performed for this Python-only change. ### 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 - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Codex)
MarcZX10 commented 2026-10-12 02:06:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T02:06:41Z.


I opened #4243 carrying the separate #4202 change that audits imports inside --modules files. It touches tools/import_audit.py and tools/tests/test_import_audit.py as this PR does, but the behavior is independent. I merged the current PR heads locally and they combined without conflicts; #4243 notes that a rebase may still be needed depending on merge order.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116470209 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4196#issuecomment-6116470209). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T02:06:41Z. --- I opened #4243 carrying the separate #4202 change that audits imports inside --modules files. It touches tools/import_audit.py and tools/tests/test_import_audit.py as this PR does, but the behavior is independent. I merged the current PR heads locally and they combined without conflicts; #4243 notes that a rebase may still be needed depending on merge order.
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!4196
No description provided.