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.
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:251src/clonehunter/snippets/expansion.py:530Problem
_module_name_mapindexes modules bypath.nameandpath.stem, which collides for files like:pkg1/util.pypkg2/util.pyThis 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.