Skip to content

Expansion import resolution collides on duplicate module filenames #14

@drogers0

Description

@drogers0

Summary

Call expansion can resolve imports to the wrong module when multiple files share the same name/stem.

Affected code

  • src/clonehunter/snippets/expansion.py:251
  • src/clonehunter/snippets/expansion.py:530

Problem

_module_name_map indexes modules by path.name and path.stem, which collides for files like:

  • pkg1/util.py
  • pkg2/util.py

This can cause expansion to attach helper code from the wrong module.

Expected

Use a collision-safe module identity (fully qualified module path / repo-relative path mapping) so import resolution is deterministic and correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions