Skip to content

fix(tools): reject ambiguous guest modules in import audit - #5273

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-import-audit-module-collisions
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-import-audit-module-collisions

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Different guest modules with the same filename in repeated --modules directories silently replaced each other's imports and combined their exports. Depending on directory order, an audit could report success despite a missing import and needed library.

Reject differing module contents with both paths in the error, using the same SHA-256 identity policy as built libraries. Identical copies are audited once. Input conflicts are rejected before creating or replacing the JSON report.

Checked all 548 open PRs before publication and inspected the five that change the audit files: #5269, #4951, #4916, #4825 and #4425. None changes read_modules or implements this validation.

Tested

Windows, Python 3.14, synthetic ELF fixtures. CTest import_audit: 48/48 tests passed. The new regressions cover both directory orders, absent and existing JSON output, identical copies, repeated directories, imports, dependencies and export providers. Before the fix, all four conflicting-input cases failed with exit codes 0 or 1 instead of 2.

Local conventions check against origin/main and git diff --check passed. Python-only change; no title or runtime-library behavior is claimed.

CI Build passed the relinker build and CTest suite on Linux (155 tests), Windows (150 tests) and macOS (146 tests), with no failures. import_audit passed on all three platforms. Conventions and PR intake also passed. Full runtime-library jobs were skipped by the repository's automatic PR policy.

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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked read_modules (SHA-256 per file name, conflicting contents raise AuditError with both paths, identical copies audited once), and the new tests cover both directory orders, existing/absent JSON output and repeated directories. import_audit passes on the merged tree and fails when the fix is reverted; merging.

@adriadam10
adriadam10 merged commit 918565b into boykopovar:main Oct 14, 2026
11 checks passed
@Ondra97
Ondra97 deleted the codex/fix-import-audit-module-collisions branch October 17, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants