feat(tools): point import_audit at a missing library's module directory #8572

Merged
xXPBSXx merged 2 commits from upstream-pr/8572 into main 2026-10-21 04:47:44 +00:00
xXPBSXx commented 2026-10-20 16:55:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T16:55:27Z.


What

When a needed library has no file in --libs or --modules, import_audit now looks for a file of that name (case-insensitive) up to four directory levels below each registry's folder and adds one line per hit: <library> is in <directory>: pass that directory with --modules. The exit code, the JSON report and the Needed libraries list are unchanged. Nothing is searched when no library is missing.
Fixes #8571
Overlap: #7454 and #6171 (both open) also change main() and the module handling of import_audit.py; git merge-tree of the heads has two conflicts with each, so whichever lands second rebases. pr_overlap was not run.

Tested

Windows 10 (19045), Python 3.12, on current upstream/main + this commit:

  • tools/tests/test_import_audit.py: the new test fails without the change to import_audit.py and passes with it; the whole file passes (121 tests, 3 skipped). The new test puts the file in a folder with a space in its name and checks that a library with no file anywhere is not listed and that the hint disappears once the directory is passed.
  • Measured use: the audit of 49 converted titles; 12 reports of missing Unity/Steam modules name the folder in\Media\Modules or in\prospero.
  • python tools/check_conventions.py --base upstream/main: passes.
  • Not tested: Linux/macOS, a registry folder with very many files (the walk is limited to four levels).

Checklist

  • Based on current main; no other open PR implements the same functions (#7454 and #6171 also change import_audit.py, see Overlap)
  • 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
  • Fixes: #8571
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4939305067 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T16:55:27Z. --- ### What When a needed library has no file in `--libs` or `--modules`, `import_audit` now looks for a file of that name (case-insensitive) up to four directory levels below each registry's folder and adds one line per hit: `<library> is in <directory>: pass that directory with --modules`. The exit code, the JSON report and the `Needed libraries` list are unchanged. Nothing is searched when no library is missing. Fixes #8571 Overlap: #7454 and #6171 (both open) also change `main()` and the module handling of `import_audit.py`; `git merge-tree` of the heads has two conflicts with each, so whichever lands second rebases. `pr_overlap` was not run. ### Tested Windows 10 (19045), Python 3.12, on current upstream/main + this commit: - `tools/tests/test_import_audit.py`: the new test fails without the change to `import_audit.py` and passes with it; the whole file passes (121 tests, 3 skipped). The new test puts the file in a folder with a space in its name and checks that a library with no file anywhere is not listed and that the hint disappears once the directory is passed. - Measured use: the audit of 49 converted titles; 12 reports of missing Unity/Steam modules name the folder `in\Media\Modules` or `in\prospero`. - `python tools/check_conventions.py --base upstream/main`: passes. - Not tested: Linux/macOS, a registry folder with very many files (the walk is limited to four levels). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (#7454 and #6171 also change `import_audit.py`, see Overlap) - [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] Fixes: #8571 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 17:04:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T17:04:19Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6171 tools/tests/test_import_audit.py L684

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 7454 tools/import_audit.py
tools/tests/test_import_audit.py
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6296522082 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572#issuecomment-6296522082). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T17:04:19Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6171](https://www.github.com/boykopovar/AnyPS5/pull/6171) | `tools/tests/test_import_audit.py` [L684](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177eeffe099c7bf71e8e98c65ca817eb8/tools/tests/test_import_audit.py#L684) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 7454](https://www.github.com/boykopovar/AnyPS5/pull/7454) | `tools/import_audit.py`<br>`tools/tests/test_import_audit.py` |
MarcZX10 commented 2026-10-20 20:36:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:36:26Z.


I inspected the three failing CTest logs: test_missing_library_is_located_next_to_the_registry fails on Windows because the temp path is emitted with its long username while the test expects the 8.3 RUNNER~1 path, and on macOS because the output resolves /var/folders/... to /private/var/folders/.... The production hint is correct; the assertion compares a non-canonical test path. I changed the expected path to elsewhere.resolve() in a local MarcZX10 commit and ran python3 tools/tests/test_import_audit.py (121 passed, 1 skipped), git diff --check, and python3 tools/check_conventions.py --base upstream/main; all passed. GitHub denied pushing to your fork (403), so I could not add the commit directly. Please apply the one-line elsewhere.resolve() adjustment and rerun the three platform jobs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300919882 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572#issuecomment-6300919882). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T20:36:26Z. --- I inspected the three failing CTest logs: `test_missing_library_is_located_next_to_the_registry` fails on Windows because the temp path is emitted with its long username while the test expects the 8.3 `RUNNER~1` path, and on macOS because the output resolves `/var/folders/...` to `/private/var/folders/...`. The production hint is correct; the assertion compares a non-canonical test path. I changed the expected path to `elsewhere.resolve()` in a local MarcZX10 commit and ran `python3 tools/tests/test_import_audit.py` (121 passed, 1 skipped), `git diff --check`, and `python3 tools/check_conventions.py --base upstream/main`; all passed. GitHub denied pushing to your fork (403), so I could not add the commit directly. Please apply the one-line `elsewhere.resolve()` adjustment and rerun the three platform jobs.
MarcZX10 commented 2026-10-20 20:36:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:36:47Z.


I published the one-line portability fix as MarcZX10 commit 4092dc16b8, on branch codex/review-8572-pathfix in my fork. You can cherry-pick it onto your PR branch; it is not a separate PR. The local validation results are in my previous comment.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300926245 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572#issuecomment-6300926245). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T20:36:47Z. --- I published the one-line portability fix as MarcZX10 commit [`4092dc16b8`](https://github.com/MarcZX10/AnyPS5/commit/4092dc16b8b9ab09b01c02df7f41b039a4b998fc), on branch `codex/review-8572-pathfix` in my fork. You can cherry-pick it onto your PR branch; it is not a separate PR. The local validation results are in my previous comment.
xXPBSXx commented 2026-10-20 20:57:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T20:57:42Z.


Thanks @MarcZX10, picked your fix (the resolve() of the expected path; you stay the author) as 6736aa663d. The test compared a non-canonical temp path (8.3 name on Windows, /var -> /private/var on macOS) with the resolved one the tool prints. test_import_audit passes (122, 3 skipped) and check_conventions is clean.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301325124 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572#issuecomment-6301325124). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T20:57:42Z. --- Thanks @MarcZX10, picked your fix (the `resolve()` of the expected path; you stay the author) as 6736aa663d. The test compared a non-canonical temp path (8.3 name on Windows, `/var` -> `/private/var` on macOS) with the resolved one the tool prints. `test_import_audit` passes (122, 3 skipped) and `check_conventions` is clean. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-21 00:54:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T00:54:45Z.

Review: APPROVED


Reviewed the current head 6736aa663d3234cf024af69162f40db455586375. I reran python3 -m unittest tools.tests.test_import_audit (122 passed, 1 skipped), python3 tools/check_conventions.py --base upstream/main --head HEAD, and git diff upstream/main...HEAD --check; all pass. The hosted relinker matrix, ASan, conventions, eligibility and labels pass on this head; full Linux/Windows/register-context/write-watch jobs were skipped. The change is focused on locating missing module files, and its overlap note names the open PRs touching import_audit.py; merge state is currently CLEAN.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593647470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8572#pullrequestreview-5593647470). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T00:54:45Z. **Review:** APPROVED --- Reviewed the current head `6736aa663d3234cf024af69162f40db455586375`. I reran `python3 -m unittest tools.tests.test_import_audit` (122 passed, 1 skipped), `python3 tools/check_conventions.py --base upstream/main --head HEAD`, and `git diff upstream/main...HEAD --check`; all pass. The hosted relinker matrix, ASan, conventions, eligibility and labels pass on this head; full Linux/Windows/register-context/write-watch jobs were skipped. The change is focused on locating missing module files, and its overlap note names the open PRs touching `import_audit.py`; merge state is currently CLEAN.
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!8572
No description provided.