Repository navigation
Description
I'm wiring graphify into my own infrastructure — a few private repos, the largest around 103k lines of Python + TypeScript. I am absolutely not a specialist here; I'm doing the implementation with Claude Code and Codex, and they surfaced the findings below while measuring whether the graph was good enough to rely on. The reproducer, the line references and the suggested patch are theirs. I'm passing it on because your BENCHMARKS.md post explicitly invites reports, and this one is small and self-contained.
1. An aliased import still matches by module stem, so a same-named sibling module kills a resolvable call
Minimal reproducer (3 files, stock graphifyy==0.9.32, no LLM):
pkg/__init__.py (empty)
other/__init__.py (empty)
# pkg/service.py
def register_user(name):
return {"name": name}
# other/service.py
def ping():
return "pong"
# pkg/api.py
from pkg import service
from other import service as other_service
def register(payload):
other_service.ping()
return service.register_user(payload["name"])
git init . && git add -A
graphify extract . --code-onlyExpected: two calls edges out of pkg_api_register.
Actual: one.
calls: [('pkg_api_register', 'other_service_ping')]
service.register_user() gets no edge. Delete other/service.py (or drop the aliased import) and the edge appears.
Root cause, as far as we could trace it — the module arm of _resolve_python_member_calls, extract.py:2419-2421:
mods = [t for t in imported_by_filenode.get(caller_file, ())
if t in contains_children
and (_module_stem_key(t) == rkey or file_aliases.get(t) == rkey)]
if len(mods) != 1: # not an imported module, or ambiguous -> bail
continueThe two conditions are OR-ed, so a module imported under an alias still matches its own stem. other/service.py therefore competes for the receiver service, len(mods) == 2, and the call is dropped as ambiguous. In Python there is no ambiguity: from other import service as other_service does not bind the name service in that file at all.
Suggested patch — when an alias is bound for that import edge, match only the alias:
mods = [t for t in imported_by_filenode.get(caller_file, ())
if t in contains_children
and ((file_aliases.get(t) == rkey) if t in file_aliases
else (_module_stem_key(t) == rkey))]With this applied to the installed package, the reproducer emits both expected edges. On our 103k-line repo it added 48 calls edges (19418 → 19466) with no other visible change. We have since reverted it locally and are back on stock 0.9.32 — we didn't want a silently patched dependency.
This pattern is not exotic: service.py, models.py, api.py, tasks.py repeated per package is the default layout in Django/FastAPI codebases, so any file importing two sibling service modules loses every service.foo() edge, not just the ambiguous one.
2. graphify update does not run the language resolvers at all
run_language_resolvers is called only from extract.py:5570. watch.py — the path behind graphify update — never calls it, so _resolve_python_member_calls / _resolve_typescript_member_calls never run on that path. The two build routes therefore produce structurally different graphs from the same source tree.
We noticed because our wrapper builds with update for speed. Whether that is intentional (incremental rebuilds skipping cross-file passes) isn't clear from the code; if it is, it may be worth saying so in the docs, because "rebuild the graph" and "build the graph" are not interchangeable today.
3. Context, and one thing we could not explain
We measure how many cross-module dependencies the graph is missing, restricted to cases where the dependency is unambiguous: calls of the form mod.func() where mod.py sits in the same directory as the caller and the callee exists as a node.
On the 103k-line repo: 136 of 320 such calls have no calls edge (~42%). Two smaller repos measured 35% and 19% by the same method. (It's a lower bound — the "hit" side asks whether any edge from that file reaches the target, not whether this particular call site does.)
Honest caveat: the patch above does not explain that 42%. Applying it left the number unchanged; in the shape <pkg>/api.py calling service.<func>() the edge is still missing even though the target node exists, the import edge exists, and the target module contains exactly one such function. We chased two further hypotheses (local_alias never being populated at extraction time; the update-vs-extract split above) and both failed to account for it, so we stopped rather than guess further. If it helps, we can run any diagnostic you suggest against that repo — it's private, but we can share the measurement script and any anonymized output.
Environment
graphifyy==0.9.32(PyPI wheel, sha2567df67ab3bdd472a51243e61d3b0455ddd8f1c3c5a6f7945c33c7b291ed31a280)- Python 3.12.0, macOS 26.5.2
- Built with
graphify extract . --code-onlyandgraphify update . --no-cluster; both reproduce finding 1.
Activity