You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Relative import of a subpackage emits an abs-path slug imports_from target to a non-existent <pkg>.py #2455
A relative import of a sibling subpackage emits an imports_from edge whose target is an absolute-path-derived slug for a non-existent <subpackage>.py, instead of resolving to the subpackage's __init__.py.
graphify update proj --no-cluster produces two edges out of health:
src_mypkg_api_routes_health --imports_from--> <abs-scan-slug>_proj_src_mypkg_graphs_py # BUG: graphs.py does not exist
src_mypkg_api_routes_health --imports--> src_mypkg_graphs_init_build_graph # correct
graphs/ is a package (graphs/__init__.py), so the imports_from target should be graphs/__init__.py, which is exactly what the companion imports edge already resolves to. Instead it is a slug for a graphs.py that is not on disk.
Why it matters
The endpoint is derived from the absolute scan path, so it is machine-specific and differs per checkout path. Committed graphs then show a spurious diff on every rebuild from a different location, the same reproducibility problem as #2262 and #2273. In a real repo this fails a fail-closed host-path check.
Notes
Specific to the relative form. An absolute import of the same subpackage (from mypkg import graphs) resolves correctly to the package __init__, no slug.
Seen on a real Python src-layout package where several from ...graphs import X / from ...services import X lines each produced one of these.
Suggested fix
Resolve a relative subpackage import to the subpackage's __init__.py (match what the imports edge does), or canonicalize/drop the node-less endpoint rather than leaving the absolute-derived slug.
Confirmed this still reproduces on 0.9.36 (the minimal repro above is unchanged). Any read on whether it's a quick fix? Happy to test a patch or add detail if useful.
Still reproduces on graphify 0.9.38. The minimal repro from the report (a relative import of a subpackage, from ...graphs import build_graph where graphs/ is a package) still emits the absolute-path slug imports_from target:
The imports edge resolves correctly to graphs/__init__; only the imports_from edge still points at a non-existent graphs.py via a machine-specific absolute-path slug. No change from 0.9.32.
Activity
vanjos commentedon Aug 10, 2026
Confirmed this still reproduces on 0.9.36 (the minimal repro above is unchanged). Any read on whether it's a quick fix? Happy to test a patch or add detail if useful.
vanjos commentedon Aug 11, 2026
Still reproduces on graphify 0.9.38. The minimal repro from the report (a relative import of a subpackage,
from ...graphs import build_graphwheregraphs/is a package) still emits the absolute-path slugimports_fromtarget:The
importsedge resolves correctly tographs/__init__; only theimports_fromedge still points at a non-existentgraphs.pyvia a machine-specific absolute-path slug. No change from 0.9.32.omsenjalia commentedon Oct 18, 2026
This looks fixed on the
v8branch by 1c120063 (fix: resolve Python imports within scan root). Could a maintainer confirm and close?