Repository navigation
Python: aliased from-import across a non-repo-root source root loses the CALLS edge #1390
Description
Activity
- addedparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edges
on Jul 31, 2026 Hello, I can fix this issue. Can you please assign this issue to me?
- addedpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
on Aug 3, 2026 Thank you for volunteering to help. PR #1371 is already the active implementation for this issue, so I do not want to assign overlapping work to a second contributor and have both of you spend time on the same fix. I will leave the issue unassigned while that PR is active.
The most useful help would be an independent test of #1371 on a small public Python fixture once the remaining IMPORTS graph-shape decision is resolved. That would add evidence without duplicating the implementation. Thank you for offering.
Confirmed fixed on v0.11.0. Reran the repro — the aliased
from services.callee import target_fn as _target_fnacross theapi/source root now traces back to its caller (callers_total: 1, was 0), same as the plain import. Looks like #1371 did it, so this can close.Thank you, @dergachoff, for the clear src-layout repro and for coming back to confirm on v0.11.0. Much appreciated! You're right: #1371 (merged as
07cac7d6, first released in v0.10.7) resolves the aliased import across a non-repo-root source root, and your case is its regression test. Thanks also to @Joseph-MingEn for the fix. Closing as fixed.
Problem
When the Python source root is not the repo root (setuptools
src/layout, monorepo service dirs), an aliased from-import produces no CALLS edge:trace_path(direction="inbound")returnscallers_total: 0for a function with real callers. The same files with a plain import resolve fine. Found live on v0.9.1-rc.1: two agent sessions concluded a production function had zero callers.Evidence
Each case freshly indexed on v0.9.1-rc.1:
services/)api/(import saysservices.callee, QN saysapi.services.callee)Minimal repro, two files under
<repo>/api/services/:index_repositorythentrace_path(function_name="target_fn", direction="inbound")→callers_total: 0; the plain-import twin repo indexes one more edge (35 vs 34) and findswrapper.search_graphstill shows in-degree 1 (the import edge), so CALLS resolution specifically is the gap.A plain call resolves by call-site name == target name; the alias forces import-path resolution, which assumes the repo root —
services.calleenever maps ontoapi.services.callee. Distinct from #875 (aliased import with repo-root paths, fixed by #979) and #1237 (plain bare import; plain passes here).Expected fix
Make import-path resolution tolerate non-repo-root source roots (e.g. suffix-match the import path against registered module QNs), with the aliased src-layout case as a regression test.