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
Calls inside anonymous callbacks are dropped from the call graph (JS/TS) — find_callers misses them #1570
A function call whose nearest enclosing function is an anonymous callback (the arrow/function passed to setTimeout, .then, app.use, an event handler, …) is not recorded as a CALLS edge, so find_callers misses it. The call is attributed to a nameless caller and dropped, instead of to the nearest named enclosing function.
For agent/LLM consumers this is an incompleteness problem: a blast-radius query silently omits real call sites that happen to live inside callbacks.
Environment
codegraphcontext==0.5.5 (PyPI); also main
Python 3.13, macOS arm64
Backend: embedded FalkorDB (-db falkordb)
Languages: TypeScript (.ts, .tsx) and JavaScript
Reproduction
// probe.tsexportconstrequestTimeout=(req,res,next)=>{setTimeout(()=>{customErrorHandler(req,res);// ← call inside an anonymous callback},1000);};functioncustomErrorHandler(...args: unknown[]){}
cgc -db falkordb index /tmp/probe --force
cgc -db falkordb analyze callers customErrorHandler
# → requestTimeout is absent (0 callers reported)
Observed on a real file: a symbol with 55 grep-confirmed call sites returns 54 from find_callers; the single miss is a call inside a setTimeout(() => { … }) arrow nested in a named function.
Root cause
_get_parent_context (tools/languages/typescript.py, javascript.py; .tsx inherits from the TS parser) walks up to the first function-like node, and arrow_function / function_expression are in the match set. When that node is an anonymous callback it cannot resolve a name and returns a nameless caller:
A caller with no name produces no node, so the CALLS edge is dropped. The walk stops at the anonymous scope instead of continuing to the enclosing named function (e.g. requestTimeout).
(Python is unaffected — its _get_parent_context matches only named function_definition / class_definition; lambdas can't hold statement calls.)
Activity
github-actions commentedon Aug 3, 2026
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ
Shriraj888 commentedon Aug 4, 2026
i would like to work on this issue , under GSSoC '26 , /assign
shanmukhdatta commentedon Aug 11, 2026
Hi, I'd like to work on this issue for GSSoC 2026. I can get a PR up by tomorrow. Could you please assign it to me? Thanks!
fix(parser): retain enclosing context for calls in anonymous callback…