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
Package-form imports (from package import module) are not resolved to import edges — creates disconnected test-file islands #1146
What happened
The AST extractor resolves from src.services.ai_blog_enricher import X to an import edge, but NOT the package-form from src.services import ai_blog_enricher. Files using the package form get zero edges to the module they import.
Example (measured)
# tests/test_ai_blog_enricher.py line 7fromsrc.servicesimportai_blog_enricher
Result: the test file's 141 nodes form a fully disconnected component with 0 edges to src/services/ai_blog_enricher.py (60 nodes) — despite the test calling ai_blog_enricher.analyze_article(...) etc. throughout.
Impact
On a ~6,000-node graph of a Python repo: 76 connected components; 799 nodes outside the giant component, of which 524 (66%) were test files using this import style (from src.services import X is a common pattern for tests that monkeypatch module attributes). GRAPH_REPORT.md then flags them as "possible documentation gaps or missing edges", which sends users hunting for gaps that are actually extractor blind spots.
Suggested fix
When resolving from <pkg> import <name>, check whether <pkg>/<name>.py (or <pkg>/<name>/__init__.py) exists in the corpus and emit the same import edge as for the dotted form.
from pkg import submod now resolves to a file-level imports_from edge when pkg/submod.py or pkg/submod/__init__.py exists on disk. The fix lives in _collect_python_symbol_resolution_facts — when the resolved target is a package (__init__.py), each imported name is checked as a potential submodule file. Matched submodules are stored in a new module_imports field and emitted as imports_from edges in _apply_symbol_resolution_facts using canonical stem-based IDs.
Confirmed fixed in v0.8.33 on the same repo that produced the report: components 76->61, nodes outside the giant component 799->339 (the remainder are genuinely standalone archive/scripts), and the 141-node test island now has its imports_from edge to the service. The builtin uses@0.5 edges from #1147 are gone too (0 remaining; str dropped out of the god-node top-10). Thanks for the fast turnaround!
Activity
fix(extract): three graph quality fixes (#1145 #1146 #1147)
safishamsi commentedon Jun 6, 2026
Fixed in v0.8.33 (a380b34).
from pkg import submodnow resolves to a file-levelimports_fromedge whenpkg/submod.pyorpkg/submod/__init__.pyexists on disk. The fix lives in_collect_python_symbol_resolution_facts— when the resolved target is a package (__init__.py), each imported name is checked as a potential submodule file. Matched submodules are stored in a newmodule_importsfield and emitted asimports_fromedges in_apply_symbol_resolution_factsusing canonical stem-based IDs.Upgrade:
uv tool upgrade graphifyyjanreview commentedon Jun 6, 2026
Confirmed fixed in v0.8.33 on the same repo that produced the report: components 76->61, nodes outside the giant component 799->339 (the remainder are genuinely standalone archive/scripts), and the 141-node test island now has its imports_from edge to the service. The builtin
uses@0.5 edges from #1147 are gone too (0 remaining;strdropped out of the god-node top-10). Thanks for the fast turnaround!safishamsi commentedon Jun 6, 2026
Haha always fun working on weekends
janreview commentedon Jun 6, 2026
Yes, always good fun on weekends ;)
fix(extract): resolve calls edges through an aliased Python import (#…
Squashed commit of the following:
fix(extract): three graph quality fixes (Graphify-Labs#1145 Graphify-…
fix(extract): resolve calls edges through an aliased Python import (G…
perf: fuse the Python symbol-fact collector onto the phase-2 parse
fix(python): resolve submodule imports inside PEP 420 namespace packa…
fix(python): resolve submodule imports inside PEP 420 namespace packages
fix(python): resolve submodule imports inside PEP 420 namespace packages