Repository navigation
Description
Summary
In JS and TS, a member call receiver.name(...) is resolved to a function called name declared in the same file, ignoring the receiver. Inside a same-named wrapper, this becomes a calls self-loop marked EXTRACTED.
This is the bug in #4082, which was closed by its reporter after they pruned the edges in their own repo. It still reproduces on 0.9.93, in plain .js as well as .ts, including #4082's own window.confirm example.
Repro (0.9.93, AST only)
app.js:
import { createHistory } from "./history.js";
const history = createHistory();
export function appendFrame(entry) {
return history.appendFrame(entry); // delegates to the history object
}
export function confirm(message) {
return window.confirm(message); // the #4082 case
}history.js:
export function createHistory() {
return { appendFrame: (e) => e };
}from pathlib import Path
from graphify.extract import extract
root = Path("repro").resolve()
r = extract(sorted(root.glob("*")), cache_root=root, root=root)
print([e["source"] for e in r["edges"]
if e.get("relation") == "calls" and e["source"] == e["target"]])
# 0.9.92 and 0.9.93, .js and .ts alike: ['app_appendframe', 'app_confirm']The collision is with any function of that name in the file, not only the enclosing one. With function appendFrame declared elsewhere in the file and a wrapper addFrame calling history.appendFrame(), the graph records addFrame -> appendFrame, which is also wrong.
For comparison: if no function of that name exists in the file, the member call produces no edge. Python does not have this problem; history.append_frame() inside def append_frame produces no self-loop.
Impact in a real project
The repo is a JS frontend whose app.js is a composition root: about 220 wrappers of the form function x(...) { return someController.x(...); }. That file alone yields 219 false self-loops, 92% of all self-loops in a 7.7k-node graph, and graphify diagnose cannot tell them from real recursion.
The bigger problem is the lost edge, not the extra one. Each wrapper's real dependency on the controller method disappears. So "who calls the controller's appendFrame?" misses every caller that goes through the wrapper, and BFS from the wrapper never reaches the module that does the work.
Expected
For receiver.name() where receiver is not this/self:
- Never bind it to a same-file function by bare name. In particular, never to the enclosing function: a member call cannot be direct recursion.
- If the receiver can be followed, resolve the method there. Here
receiveris a module-levelconstinitialised from an imported factory. - Otherwise emit no edge, or an
INFERRED/AMBIGUOUSone, rather than anEXTRACTEDedge to the wrong node.
Related
- AST extractor resolves member calls to same-named local functions (produces false self-loop edges) #4082: same bug, TS, closed without a code change
- [Bug]: C#: a member call on a chained or invoked receiver binds to the caller's own same-named method #4418: the same pattern in C#
callsedges are never resolved for member/dotted calls (obj.method(),Type.method()) by deliberate design — only bare (undotted) calls resolve, via a fragile label-text match that isn't scoped to real definitions #2041, JS/TS extractor: instance-method calls (this.x.y() / obj.method()) never produce calls/indirect_call edges to the method node #2023: member calls in general
Activity
github-actions commentedon Oct 20, 2026
Thanks for opening this issue, @SaschaAndresGrimm. 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.
safishamsi commentedon Oct 22, 2026
Fixed in 0.9.94 by #4605. Thanks @SaschaAndresGrimm for the report. Live on PyPI: https://pypi.org/project/graphifyy/0.9.94/
fix(cpp): bind `x.m()` by the receiver's type, not the file's same-na…