Repository navigation
Description
Summary
graphify extract --code-only produces zero calls edges for any call made from inside a callback function's body when that callback is passed as an argument to a generic higher-order function (e.g. wrapper(async (req) => { ... })) — the exact shape used by Firebase's onCall/onDocumentWritten, Express middleware, array.map(async (x) => ...), and similar frameworks. An identical call made from a normal named function or class method is captured correctly.
This was previously reported in #1630 (claimed fixed for closures in v0.9.11) and #1740 (closed as a duplicate/fixed), and reported again as a regression in #2143 (still open). This report reproduces it fresh on v0.9.35, the latest release as of this writing, with a minimal, framework-free test case, confirming it is not fixed by the #1630 change and #2143 is not stale.
Environment
graphifyyversion: 0.9.33 and 0.9.35 (both tested; identical behavior)- Python: 3.12.13
- OS: Linux (
python:3.12-slimDocker container; host OS macOS 26.5.1/Docker Desktop, irrelevant to the bug — verified in a clean container both times) - Invocation:
graphify extract <path> --code-only --no-cluster
Minimal reproduction
4 files, no dependencies, no Firebase SDK required (a hand-rolled generic wrapper reproduces the same AST shape as onCall's generic-callback signature).
helpers.ts
export function helperA(): void {
console.log('helperA called');
}
export class Service {
method(): Promise<void> {
return Promise.resolve();
}
}wrapper.ts
// Generic higher-order function, structurally similar to Firebase's
// `onCall<T, Return>(handler: (request: CallableRequest<T>) => Return)`.
export function wrapper<T>(
fn: (req: T) => Promise<void>,
): (req: T) => Promise<void> {
return fn;
}handler.ts — the callback case under test:
import { wrapper } from './wrapper';
import { helperA, Service } from './helpers';
// Callback case: the async arrow function is passed as an argument to a
// generic higher-order function (the pattern used by Firebase's onCall,
// onDocumentWritten, Express middleware, etc). Calls made from inside this
// arrow's body should still produce `calls` edges to helperA and
// Service.method.
export const handler = wrapper(async (req: unknown) => {
helperA();
await new Service().method();
});control.ts — control group: identical calls, but from a normal function and a class method (no callback into a higher-order function):
import { helperA, Service } from './helpers';
export function normalCaller(): void {
helperA();
new Service().method();
}
export class ControlClass {
run(): void {
helperA();
new Service().method();
}
}Run:
graphify extract . --code-only --no-clusterExpected vs Actual
Expected: handler's callback body calls helperA(), so a calls edge from the handler node to helperA should exist — just like normalCaller() and ControlClass.run() get one.
Actual (identical on v0.9.33 and v0.9.35):
$ jq '[.edges[] | select(.source=="handler_handler")]' graph.json
[]
Zero edges of any kind originate from the callback body's node. Meanwhile the control group resolves correctly:
$ jq '[.edges[] | select(.relation=="calls")]' graph.json
[
{
"source": "control_normalcaller",
"target": "helpers_helpera",
"relation": "calls",
"context": "call",
"confidence": "EXTRACTED",
"confidence_score": 1.0,
"source_file": "control.ts",
"source_location": "L6",
"weight": 1.0
},
{
"source": "control_controlclass_run",
"target": "helpers_helpera",
"relation": "calls",
"context": "call",
"confidence": "EXTRACTED",
"confidence_score": 1.0,
"source_file": "control.ts",
"source_location": "L12",
"weight": 1.0
}
]
handler.ts produces exactly one handler_handler node (the exported const) and one contains edge from the file node into it — nothing else. The two helperA/Service imports into handler.ts are extracted fine (imports/imports_from edges exist), so the file-level import resolution works; only the call graph inside the callback body is dropped.
Impact
On a real Firebase Cloud Functions codebase (TypeScript, onCall/onDocumentWritten/onDocumentCreated handlers — the exact "callback passed to a generic higher-order function" shape), 38 of 42 Cloud Functions entry points had zero outgoing calls edges in the extracted graph — i.e. 90% of the actual business logic invoked from Cloud Functions handlers (service calls, repository calls, validation, AI provider calls) is invisible to graphify query/graphify affected/graphify god-nodes, making the tool blind to the majority of real runtime call chains for a serverless/event-driven codebase.
Related issues
- TypeScript/JS: method calls on a typed receiver that is a local
newbinding or a closure-captured parameter are not emitted ascallsedges (v0.9.5) #1630 — claimed closures were fixed in v0.9.11 - JS/TS extractor silently drops calls inside anonymous arrow callbacks (addEventListener, forEach, etc.) #1740 — same symptom reported again, closed
- TypeScript extraction emits internal edges whose endpoint nodes are absent #2143 — same symptom reported again, still open at time of writing
This report adds a minimal, framework-independent repro and confirms the defect is present on the current latest release (v0.9.35), not just old/cached behavior.
Activity
fix(extract): TS member-call gating + Kotlin grammar match (#2553, #2552
safishamsi commentedon Aug 8, 2026
Fixed in v0.9.37. Calls inside a callback body passed to another call (e.g.
export const handler = wrapper(async (req) => { helper() })) are now walked and attributed to the declaration, through the same import-gated resolution so they cannot fabricate edges. Thanks.Merge upstream/v8 (v0.9.37) into chore/sync-upstream-0937
fix: JS/Kotlin/Swift/SQL extractor correctness batch; bump to 0.9.38 (#…
fix(extract): TS member-call gating + Kotlin grammar match (Graphify-…
fix: JS/Kotlin/Swift/SQL extractor correctness batch; bump to 0.9.38 (G…
fix: capture HOF-wrapped CommonJS exports (#3035)
fix(js): narrow the require-binding guard to literal require callees (#…
fix(security): [HIMMEL-7187] sync to upstream 0.9.94 and floor the pa…
chore: [HIMMEL-7394] sync to upstream 0.9.95 and carry the himmel del…