Summary
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.ts
export const requestTimeout = (req, res, next) => {
setTimeout(() => {
customErrorHandler(req, res); // ← call inside an anonymous callback
}, 1000);
};
function customErrorHandler(...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:
return self._get_node_text(name_node) if name_node else None, curr.type, curr.start_point[0] + 1
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.)
Summary
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 aCALLSedge, sofind_callersmisses 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); alsomain-db falkordb).ts,.tsx) and JavaScriptReproduction
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 asetTimeout(() => { … })arrow nested in a named function.Root cause
_get_parent_context(tools/languages/typescript.py,javascript.py;.tsxinherits from the TS parser) walks up to the first function-like node, andarrow_function/function_expressionare 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
CALLSedge 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_contextmatches only namedfunction_definition/class_definition; lambdas can't hold statement calls.)