Skip to content

fix(tools): ignore non-module sidecars in import audit - #5519

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Zinebyte:fix/import-audit-module-sidecars
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Zinebyte:fix/import-audit-module-sidecars

Conversation

@Zinebyte

@Zinebyte Zinebyte commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

The documented import-audit workflow fails when a title's module directory contains a README or other metadata. The relinker accepts that directory, but import_audit.py --modules attempts to parse every file as ELF and exits 2 before reporting the imports.

Select ELF module candidates by their header, regardless of filename. Ignore ordinary non-module sidecars; retain errors for malformed named module files, unsupported ELF, PE and SELF containers. Metadata cannot become a module provider or satisfy a missing dependency. The usage documentation states this selection policy.

Reproduced with the repository's existing main_fixture() and module_with_symbol(True) fixtures: conversion with --registry succeeds with sce_module/provider.prx and a 22-byte README.txt; auditing those generated registries fails on README's ELF header. Removing only README makes the baseline audit succeed. With this patch the same audit succeeds with README present. No title files were used.

Tested

Zorin OS 18.1 x86-64, Python 3.12.3, GCC 13.3.0, CMake 3.28.3; final branch based on bf8dc610e665a7547d027418e31ddcbb3261b3e0. Original regression baseline: c7601b797119da8e81191dd7d31bdfffd77d9f3b; the two audit files are unchanged between those upstream revisions.

  • The same four new tests were run against the exact baseline: the sidecar regression fails; three preservation controls pass. Patched import-audit suite: 50/50 pass.
  • CLI-entry regressions verify unchanged text/JSON reports with README, text, JSON, .DS_Store and empty metadata; real imports, exports and dependencies in an ELF with a nonstandard extension; missing imports named after metadata; malformed/PE/SELF refusal without creating or replacing the JSON report.
  • Full Release relinker-only build and all 155 configured CTests pass in 14.63 s on the final branch. Conventions and whitespace checks pass. Existing assertions are retained.
  • Independent composition with fix(tools): reject ambiguous guest modules in import audit #5273 head 27e5a6d75d96eab58175451938b43b14f42cc34a applies cleanly with Git's three-way merge; all 52 combined audit tests pass. An additional control with different README contents beside identical modules audits the module once and still reports its real missing import.

Hosted relinker CI passed on Linux, Windows and macOS at final head 3b2601daa348a7953bd90a1ed9ca71d99fad9070; eligibility and conventions also passed. The original submission passed intake. The implementation and tests are unchanged by the documentation clarification and rebase.

Related work

#5273 adds duplicate-module identity checks inside read_modules; it does not select module candidates. This patch changes the iterator through a separate helper, so duplicate checks run only for actual modules in the tested composition. Neither patch requires the other. The repository's overlap checker reports no conflict at current main with both dependency lists empty.

Checklist

  • Based on current main; no equivalent module-selection fix found
  • One topic per PR; follow-ups go in a new PR
  • No added code comments
  • No runtime stubs or silent fallback for malformed modules
  • No notes, investigation files, images or dependencies added
  • Generic behaviour
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, OpenAI Codex; implementation, tests, independent review and description

@Zinebyte
Zinebyte force-pushed the fix/import-audit-module-sidecars branch from c3dbb4f to 3b2601d Compare October 13, 2026 22:26
@github-actions github-actions Bot added the docs label Oct 13, 2026
@adriadam10 adriadam10 self-assigned this Oct 14, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked module_files() selection by ELF header, the sidecar/malformed/PE/SELF cases and the USAGE.md change. test_import_audit passes (79 OK) and the new tests fail without the fix; relinker CI is green on Linux, Windows and macOS. Merging.

@adriadam10
adriadam10 merged commit 153d5d4 into boykopovar:main Oct 14, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants