Repository navigation
Description
Pre-flight checks
- I have checked the Troubleshooting section in the README
What happened?
Follow-up to #5242. On 0.9.112 the case reported there (same type name declared in two packages) emits its edges again, but a second shape still loses them.
A same-file member call s.helper() gets no calls edge when both are true:
- the receiver type is declared in a sibling file of the same package, and
- another package names that type (a struct field, a parameter, or a return type all trigger it).
Either condition alone is fine. 0.9.101 emits the edge in every variant.
Expected: case B below emits calls, like A and C.
Impact on a real codebase: a private Go backend, 1,064 non-test files, laid out the usual way: type Service struct in service.go, its methods spread over sibling files, and a cmd/server package that wires the services together.
| 0.9.101 | 0.9.112 | |
|---|---|---|
calls edges |
16,852 | 15,504 |
| of which same-file | 8,170 | 6,759 |
188 of the missing same-file edges are direct recv.method() calls that I confirmed in the source; 184 of those have the receiver type declared in a sibling file. affected --relation calls and path lose the service → helper hop for those methods.
Not everything in the drop is a regression: on the same corpus 0.9.112 gains about 200 correct cross-file recv.method() edges and removes a few hundred wrong bare-name matches that 0.9.101 produced.
Steps to reproduce
cat > repro.py <<'EOF'
import importlib.metadata as md, tempfile, warnings
from pathlib import Path
from graphify.extract import extract
warnings.simplefilter("ignore")
TYPES = "package alpha\n\ntype Service struct{}\n"
IMPL = "package alpha\n\nfunc (s *Service) helper() int { return 1 }\n\nfunc (s *Service) Run() int { return s.helper() }\n"
MAIN = 'package main\n\nimport "example.com/app/alpha"\n\ntype deps struct{ svc *alpha.Service }\n'
def edge(files):
with tempfile.TemporaryDirectory() as t, tempfile.TemporaryDirectory() as cache:
root = Path(t) / "app"
for rel, text in {"go.mod": "module example.com/app\n\ngo 1.22\n", **files}.items():
p = root / rel
p.parent.mkdir(parents=True, exist_ok=True)
p.write_text(text)
r = extract(sorted(root.rglob("*.go")), root=root, cache_root=Path(cache))
label = {n["id"]: n.get("label") for n in r["nodes"]}
return [e["relation"] for e in r["edges"]
if label.get(e["source"]) == ".Run()" and label.get(e["target"]) == ".helper()"]
if __name__ == "__main__":
print("graphifyy", md.version("graphifyy"))
print("A type in sibling file, no outside reference :", edge({"alpha/types.go": TYPES, "alpha/impl.go": IMPL}))
print("B type in sibling file + cmd/main.go names it:", edge({"alpha/types.go": TYPES, "alpha/impl.go": IMPL, "cmd/main.go": MAIN}))
print("C type in same file + cmd/main.go names it:", edge({"alpha/impl.go": TYPES + IMPL.split("\n", 2)[2], "cmd/main.go": MAIN}))
EOF
uv run --no-project --with graphifyy==0.9.101 python repro.py
uv run --no-project --with graphifyy==0.9.112 python repro.pyError output or graph output
graphifyy 0.9.101
A type in sibling file, no outside reference : ['calls']
B type in sibling file + cmd/main.go names it: ['calls']
C type in same file + cmd/main.go names it: ['calls']
graphifyy 0.9.112
A type in sibling file, no outside reference : ['calls']
B type in sibling file + cmd/main.go names it: []
C type in same file + cmd/main.go names it: ['calls']
Graphify version
0.9.112 (regression vs 0.9.101)
Operating System
macOS
Python Version
3.13
Installation Method
uv tool install (recommended)
Additional Environment Details
macOS 26.6.2, Python 3.13.9. Repro runs in throwaway envs via uv run --with, so it does not depend on the installed tool.
Additional context
In case B, replacing the struct field in cmd/main.go with func wire(s *alpha.Service) int { return s.Run() } or func wire() *alpha.Service { return &alpha.Service{} } drops the edge the same way.
Possibly related, not isolated: about 1,200 more same-file edges are gone on the real corpus where the call goes through an interface-typed field (s.repo.Get() → the interface method declared in the same file). A minimal single-package version of that still emits calls on 0.9.112, so I have no repro for it yet.
Activity
github-actions commentedon Nov 18, 2026
Thanks for opening this issue, @Modeux. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
fix(go): keep member calls when another package names a sibling-file …
PravalVerma commentedon Nov 23, 2026
The case in this report (B and its parameter/return-type variants) is fixed in 0.9.113 by dd11a04. On current
v8all three emitcallsagain.One related shape was still dropping the edge: the receiver type declared in a sibling file plus a second same-named package directory (e.g.
other/alpha) that also declares the type, the #5242 layout. It doesn't need the outside reference. Fix and tests in #5414 .fix(go): fold sibling-file type copies per directory when a same-name…