# Dynamic-Dispatch Coverage Playbook **Audience:** a Claude agent continuing this work. **Mission:** systematically close static-extraction coverage holes for **dynamic dispatch** across **every language and framework codegraph supports**, and validate each one the same way, so cross-symbol *flows* exist in the graph everywhere. > This is the top-level playbook. The deep design for one mechanism (the callback > synthesizer) is in [`callback-edge-synthesis.md`](./callback-edge-synthesis.md). > Full investigation context + findings: auto-memory `project_codegraph_read_displacement`. > **Update (2026-06-01):** the `codegraph_trace` and `codegraph_context` MCP tools were > **removed** — `codegraph_explore` is the single surfacing tool now. Its "Flow" section > (`buildFlowFromNamedSymbols`) surfaces the synthesized edges this playbook is about, and > you validate coverage with `codegraph_explore` / `scripts/agent-eval/probe-explore.mjs`. > Where the text below writes `trace(a, b)` or lists `trace`/`context` among the tools, > read it as "the a→b flow, now surfaced and verified via explore." The synthesizers and > the coverage matrix are unchanged. --- ## 1. The goal (why this matters) codegraph's value is being **the map** — answering structural/flow questions (`trace`, `impact`, callers, "how does X reach Y") that grep/Read cannot. Agents will use codegraph instead of Read **only when it is sufficient**. We proved empirically (see memory) that the lever for sufficiency is **coverage**, not prompting/hooks/new-tools: when a flow is missing from the graph, the agent reads the files to reconstruct it; when the flow *is* in the graph, the agent can answer completely without reading. **Validated end-to-end on excalidraw:** after closing the update-flow hole, 2/3 headless agent runs answered the "how does an update reach the screen" question with **Read 0 and a complete answer** — impossible before, because the key edge wasn't in the graph. (Caveat: coverage *enables* the no-read path; agent confirm-by-reading variance means it doesn't *force* it. Completeness improves unconditionally.) The mission is to make that true for **all** languages/frameworks. --- ## 2. The problem class: dynamic dispatch Static tree-sitter extraction captures explicit calls (`foo()`, `this.bar()`). It **misses** any call whose target is computed/indirect. Four recurring shapes, with a **difficulty gradient** (do the cheap ones first): | # | Shape | Example | Fix mechanism | Cost | |---|---|---|---|---| | 1 | **Named attribute / descriptor** | django `self._iterable_class(self)` | framework resolver (`claimsReference` + `resolve()`) | **cheap** | | 2 | **Field-backed observer** | `onUpdate(cb)` + `for(cb of cbs)cb()` | callback synthesizer (whole-graph pass) | medium | | 3 | **String-keyed EventEmitter** | `on('e',fn)` / `emit('e')` | callback synthesizer (event-keyed) | medium | | 4 | **Inline callback handler** | `on('e', function h(){})` / `() => {}` | extraction (named) + synthesizer link-through-body (anon) | named: cheap · anon: hard | | 5 | **Closure-collection dispatch** | Swift `validators.write{$0.append(v)}` … `validators.forEach{$0()}` | callback synthesizer (`closureCollectionEdges`, element-invoke gated) | medium | Key distinction driving the mechanism choice: - **A named ref exists** to resolve (`_iterable_class` is an attribute name) → **resolver**. - **No ref exists** (`cb()` is anonymous; needs registrar↔dispatcher correlation) → **synthesizer**. --- ## 3. Worked examples (the two mechanisms, end to end) ### 3a. Django ORM descriptor — the **resolver** pattern (Python) - **Hole:** `QuerySet._fetch_all` calls `self._iterable_class(self)` (a runtime-chosen iterable, default `ModelIterable`), whose `__iter__` runs the SQL compiler. Static parsing can't resolve the attribute-as-callable → `_fetch_all`'s only callee was `_prefetch_related_objects`; `trace(_fetch_all, execute_sql)` returned no path. - **Fix:** `djangoResolver` claims the unresolved `_iterable_class` ref through the name-exists pre-filter, then resolves it to `ModelIterable.__iter__`. - **Files:** `src/resolution/types.ts` (`claimsReference?` on `FrameworkResolver`), `src/resolution/index.ts` (pre-filter in `resolveOne` consults `claimsReference`), `src/resolution/frameworks/python.ts` (`djangoResolver.resolve` + `claimsReference` + `resolveModelIterableIter`). - **Result:** `trace(_fetch_all, execute_sql)` → `_fetch_all → __iter__ → execute_sql` (3 hops). ### 3b. Excalidraw observer + EventEmitter — the **synthesizer** (TS) - **Hole:** `Scene.triggerUpdate` does `for (cb of this.callbacks) cb()`; `triggerRender` is registered via `scene.onUpdate(this.triggerRender)`. The `triggerUpdate → triggerRender` edge is dynamic → `trace` returned no path; the whole update flow broke. - **Fix:** a whole-graph pass that detects registrar/dispatcher channels, correlates registration sites, and synthesizes `dispatcher → callback` edges. Plus extraction of **named** inline callbacks so handlers like express's `function onmount(){}` are nodes. - **Files:** `src/resolution/callback-synthesizer.ts` (the pass — field observers + EventEmitter), `src/resolution/index.ts` (calls `synthesizeCallbackEdges()` at the end of `resolveAndPersistBatched`), `src/extraction/tree-sitter.ts` (`visitFunctionBody` extracts named nested functions). - **Result:** `trace(mutateElement, triggerRender)` → 3 hops; express `use → onmount`. ### 3c. Alamofire deferred validation — closure-collection dispatch (Swift) - **Hole:** `DataRequest.validate(_:)` builds a closure and `validators.write { $0.append(validator) }`; the base `Request.didCompleteTask` runs them via `validators.forEach { $0() }`. Append and dispatch live in *different files and classes* (a subclass appends, the base iterates) and the field is a Swift `Protected<[@Sendable () -> Void]>` — so neither same-file pairing nor the name-based registrar match (`onX`/`subscribe`/…) reaches it. `trace(didCompleteTask, validate)` returned no path; the agent grepped `validators` and read three files to reconstruct it. - **Fix:** `closureCollectionEdges` (callback-synthesizer.ts). A **dispatcher** iterates a collection *invoking each element* (`coll.forEach { $0() }` / `{ it() }`); a **registrar** appends a closure to the same-named field (`.append`/`.add`/`.push`/`.insert`, incl. Swift `.write { $0.append }`). The element-invoke (`$0(` / `it(`) is the precision **gate** — it proves the collection holds closures — so a repo with no closure-collection dispatch yields **0 edges** regardless of how many `.append` sites it has. Pairs dispatcher → registrar globally by field name (cross-file/class required), fan-out-capped. Surfaced two ways: inline in `trace`, and as a "Dynamic-dispatch links among your symbols" section in `codegraph_explore` (`buildFlowFromNamedSymbols`) so the relationship shows even when the agent named only `validate`, not the `didCompleteTask` that drains the list. - **Files:** `src/resolution/callback-synthesizer.ts` (`closureCollectionEdges`), `src/mcp/tools.ts` (`synthEdgeNote` closure-collection case + the explore synth-links section). - **Result:** `trace(didCompleteTask, validate)` connects with the closure-collection hop + the `validators.write { $0.append }` wiring site inlined. 9 precise edges on Alamofire (`validators`/`streams`/`finishHandlers`/`requestsToRetry`), **0 on every non-Swift control**. Forced codegraph-only (Read+Grep+Bash blocked): 3/3 runs answer build/send/validate correctly. ### 3d. Insight — an "adoption floor" can hide a trace-endpoint bug (Alamofire) Alamofire (110 files) was the README's weakest repo and was written off as the "small-repo floor" (native grep is cheap, so the agent reads anyway). It wasn't. Reading the **transcripts** — every `Read`'s `file_path`+offset and the assistant text right before it — surfaced the agent's own words: *"the trace collided with same-named symbols (44 `request`s, 8 `task`s), let me read by line."* `codegraph_trace`'s endpoint disambiguation (`scorePair`, shared-dir-prefix only) was resolving an overloaded name to an **empty delegate/protocol stub** — `request` → `EventMonitor.request(){}` (a 1-line no-op) over the real `Session.request`, because two unrelated `Source/Features/` stubs shared a deeper dir prefix than the correct `Source/Core/` pair. Garbage trace → manual reading, sometimes a spiral (12 reads / 11 greps in one run). **Fix:** a `nodeRelevance` term in `handleTrace` pair scoring that penalizes empty stubs (≤1 body line) and test-file symbols; among real methods it's flat, so path-proximity (cosmos `EndBlocker`) is unaffected. Result (n=8): WITH-arm tool calls 12 → 8 median, and the read **variance collapsed** (0–12 → 1–4 — the meltdowns *were* the trace-collision flounder). General bug: protocol/delegate-stub flooding hits Swift/Java/C#/Go. **Methodology lesson:** when the agent reads on a small repo, don't conclude "adoption floor" — diff *what it read* against what the tool returned *immediately before*. A read of content the tool already gave = adoption; a read after the tool returned the **wrong thing** (stub endpoints, collided names) = a fixable bug. The transcript reasoning, not the median, tells you which. The forced codegraph-only hook (block Read+Grep+Glob+Bash-search) is the variance-free way to confirm sufficiency separately from adoption. --- ## 4. The repeatable methodology (run this per language/framework) ### Step 1 — Pick the framework's canonical *flow* question Every framework has a signature data/control flow. Pick the "how does X reach/become Y" question and a real repo (add to `.claude/skills/agent-eval/corpus.json`). Examples: - React state→DOM, Vue reactive→render, Svelte store→update - Rails request→controller→view, Spring request→`@Controller`→service - Express/Koa request→middleware→handler, FastAPI request→route→dependency - Redux action→reducer→store, RxJS subscribe→operator→observer - Any ORM: query builder → SQL execution (django pattern) ### Step 2 — Measure the hole (deterministic, no agent) ```bash rm -rf /.codegraph && ( cd && codegraph init -i ) node scripts/agent-eval/probe-trace.mjs # does the flow break? where? node scripts/agent-eval/probe-node.mjs # trail: is the next hop missing? ``` A "No direct call path … breaks at dynamic dispatch" + a sparse trail at the break point **locates the hole** (this is exactly how `_iterable_class` and `triggerUpdate` were found). Confirm it's dynamic by reading the break symbol's body. ### Step 3 — Classify → choose the mechanism (use the §2 table) - `self.(...)` / descriptor / metaclass → **resolver** (§3a). - `for(cb of store)cb()` / `store.forEach(cb=>cb())` → **field-observer synthesizer** (§3b). - `on('e',fn)` + `emit('e')` → **EventEmitter synthesizer** (§3b). - Inline handler not a node → **named:** extraction (already done generically in `tree-sitter.ts`); **anonymous:** synthesizer link-through-body (not yet built). - Dispatch that CAN'T be precision-gated as a class (runtime-keyed `table[key](...)`, `getattr(self, expr)`, reflection, typed mediator buses, `new Proxy`) → **boundary surfacing** (`src/mcp/dynamic-boundaries.ts`, #687): explore ANNOUNCES the dispatch site where the static path ends — file:line, form, and candidate targets when the key is statically visible — instead of synthesizing an edge. Query-time only, zero graph mutation, fires only when the asked-about flow fails to connect. This is the deliberate floor for the frontier: a wrong edge poisons the map (silent beats wrong), but an honest "the flow continues at THIS site, likely into THESE candidates" still saves the read-reconstruction spiral. When a boundary form later proves precision-gateable on real repos (e.g. a same-repo literal-key command bus), promote it to a synthesizer channel and the boundary note disappears on its own — the flow then connects. ### Step 4 — Implement - **Resolver:** add to `src/resolution/frameworks/.ts` — a `resolve()` branch + `claimsReference(name)` if the ref name isn't a declared symbol. Copy `djangoResolver`. - **Synthesizer channel:** extend `src/resolution/callback-synthesizer.ts` — add the framework's registrar/dispatcher **name patterns** and **body patterns** (e.g. signals use `.connect()`/`.emit()`; Rx uses `.subscribe()`/`.next()`). - Reindex (Step 2 command) and re-run `probe-trace` — the flow should now connect. ### Step 5 — Validate (the same way every time) 1. **Deterministic:** `probe-trace(from,to)` finds the path; `probe-node` shows the bridged hop. The previously-broken hop is closed. 2. **Precision:** count + spot-check synthesized/resolved edges — no explosion, correct targets: ```bash sqlite3 /.codegraph/codegraph.db \ "select s.name||' → '||t.name||' '||coalesce(e.metadata,'') from edges e \ join nodes s on e.source=s.id join nodes t on e.target=t.id where e.provenance='heuristic';" ``` (Resolver edges aren't `heuristic`; verify via the trace + callees instead.) 3. **Regression:** node count stable (`select count(*) from nodes;` before/after — a big jump means an extraction change over-fired); existing traces on a control repo intact. 4. **End-to-end agent eval:** run the flow question with codegraph and measure **reads / answer-completeness / cost** vs a pre-fix baseline: ```bash # headless (exact cost + clean tool sequence) bash scripts/agent-eval/run-agent.sh with "" # or the full A/B + interactive Explore-subagent path: scripts/agent-eval/audit.sh local "" all ``` Then parse: `Read` count, codegraph-tool count, cost, and whether the answer now contains the glue symbols (the ones that previously required a read). ### Success criteria (per language/framework) - `trace` finds the canonical flow end-to-end (no dynamic-dispatch break). - Agent can answer the flow question with **Read 0** (achievable in ≥ some runs) and the glue symbols appear in the answer. - **No node explosion** and no regression on a control repo. - Synthesized edges are precise on a spot-check (no generic-name over-linking). --- ## 5. Validation toolkit (reference) | Tool | Purpose | |---|---| | `scripts/agent-eval/probe-trace.mjs ` | call-path between two symbols (the hole detector) | | `scripts/agent-eval/probe-node.mjs [code]` | symbol + trail (callers/callees); `code` adds the body | | `scripts/agent-eval/probe-context.mjs ""` | context output incl. call-paths | | `scripts/agent-eval/probe-explore.mjs ""` | explore output | | `scripts/agent-eval/{audit,run-agent,itrun}.sh` | agent A/B (headless + interactive); also the `/agent-eval` skill | | `sqlite3 /.codegraph/codegraph.db` | direct edge/node inspection (provenance, metadata, counts) | Probe scripts use the built `dist/` — run `npm run build` first. Reindex after any extraction or resolution change (`rm -rf /.codegraph && codegraph init -i`) — the synthesizer/resolvers run at index time. Test fixtures: keep a tiny per-pattern fixture (see `/tmp/cb-fixture/bus.js`; **move into `__tests__/`** when shipping). --- ## 6. Coverage matrix (fill in as you go) Status legend: ✅ done+validated · 🔬 hole identified · ⬜ not started. `Mechanism`: R = resolver, S = synthesizer channel, X = extraction. | Language | Framework(s) | Canonical flow to test | Mechanism | Status | |---|---|---|---|---| | TypeScript/JS | React / observer / EventEmitter / React Router | state→render; dispatch→callback; route→component | S + X | ✅ rendering+dispatch (excalidraw); **React Router JSX routing** `` (v5) + `element={}` (v6) → component (react-realworld **0→10, 10/10**). + **object data-router** `createBrowserRouter([{path, element/Component}])` (literal form); Next.js config/`nextjs-pages` false-positives FIXED. 🔬 lazy data-router (`path: paths.x.path, lazy: () => import()` — variable paths + lazy modules) | | TypeScript/JS | Vue / Nuxt | template events (@click→handler); component composition; reactive→render | S + X | ✅ events + composition (vitepress S / vben M / element-plus L); 🔬 reactive→render (vue-core Proxy runtime — frontier, deferred) | | TypeScript/JS | Svelte / SvelteKit | template calls/composition; SvelteKit action→api; store→DOM | X | ✅ already strong (realworld S / skeleton M / shadcn L): template `{fn()}` calls, `` composition, `import * as api` namespace, `load`→api all work out of the box. + exported-const object-of-functions extraction (SvelteKit `actions`). 🔬 `$lib`-namespace-from-action + store/reactive frontier | | TypeScript/JS | Express / Koa | request → route → handler → service | R + X | ✅ named handlers + middleware + controller/service (resolver) + **inline arrow handlers → service body calls** (realworld S 19 / parse M / ghost L 65 edges). 🔬 custom routers (payload had 0 routes — not `app.get`-style) | | TypeScript/JS | NestJS | request → @Controller → DI service → repo | R | ✅ already well-covered (realworld S / immich M-L / amplication L): @decorator routes (HTTP/GraphQL/microservice/WS) via resolver + DI `this.svc.method()` controller→service resolves correctly at scale (name + co-location). No dynamic-dispatch hole. 🔬 committed `dist/` build output gets indexed (realworld) — general build-dir-ignore follow-up | | TypeScript/JS | RxJS / signals | subscribe → operator → observer | S | ⬜ | | Python | Django ORM | QuerySet → SQL compiler | R | ✅ | | Python | Django / DRF (views) | url → view → model | R + X | ✅ url→view (`path`/`url`/`as_view`) + **DRF `router.register`→ViewSet** (realworld S / wagtail M / saleor L); ORM QuerySet→SQL (prior work). 🔬 signals (`post_save`→receiver), DRF viewset CRUD actions (inherited), saleor GraphQL resolvers | | Python | Flask / FastAPI | request → route → handler → dependency | R + X | ✅ **Flask: handler resolved across intervening decorators (`@login_required`) + stacked `@x.route` lines** (microblog S 6→27, redash L decorator routes 6/6); **FastAPI: empty-path router-root routes `@router.get("")` incl. multi-line** (realworld S 12→20 / Netflix dispatch L **290/290 100%**) + **bare-name builtin guard** — a handler named after a Python builtin method (`index`/`get`/`update`/`count`…) was filtered as a builtin and lost its route→handler edge. + **Flask-RESTful `add_resource(Resource,'/x')` → Resource class** (redash 6→**77**) + **tuple `methods=('GET',)`** (was mislabeled GET) + **broadened detection** (requirements/Pipfile/setup + subdir app-factory entrypoints — flask-realworld 0→**19**). 🔬 FastAPI `Depends()` dependency edges (light validation) | | Go | Gin / chi / gorilla/mux / net-http | request → route → handler → service; middleware chain (`Use`→`Next`) | S + X | ✅ **routes on ANY group var** (`v1.GET`, `PublicGroup.GET`) not just `r/router` (gin-vue-admin S→M 4→259 / realworld S / gitness L) — was missing all group-routed apps; named handlers resolve precisely. **gorilla/mux confirmed covered** by the any-receiver `HandleFunc`/`Handle` handling (subrouter-var `s.HandleFunc(...)` + namespaced handlers; `.Methods()` chain ignored). + **gin middleware-chain synthesizer** (`ginMiddlewareChainEdges`): gin runs its entire chain through one dynamic line — `(*Context).Next` does `c.handlers[c.index](c)`, a slice-index dispatch tree-sitter can't resolve, so `callees(Next)` dead-ended at the `len()` helper (`safeInt8`) and the agent rabbit-holed re-querying it. Find the dispatcher (a Go method invoking a `handlers` slice by index) and link it → every HandlerFunc registered via `.Use`/`.GET`/…/`.Handle`; gated on the dispatcher existing (inert on non-gin Go repos), named handlers only (closures skipped), capped. gin L: `callees(Next)` now surfaces `Logger`/`Recovery`/`ErrorLogger`+handlers (node count stable 2,544; 5 precise edges with `registeredAt` wiring sites). **Agent A/B (headless median-of-4, Opus 4.8): gin flipped from codegraph −58% cost / −129% time (the rabbit-hole, incl. a stray `Workflow` mis-fire on 2/4 WITH runs) → +7% cost / +35% tokens / +8% time / 38% tool calls, all 4 WITH runs clean (0 Read/Grep/Bash, no Workflow, no duplicate calls).** 🔬 inline `func(c){}` handlers (anonymous, body lost); subrouter/`PathPrefix` path-prefix not prepended (label only); gitness chi custom (26/321) | | Rust | Axum / actix / Rocket | request → route → handler | R + X | ✅ **Axum chained methods + namespaced handlers** — `.route("/x", get(h1).post(h2))` emitted only the first method+handler, and `get(mod::handler)` captured the module not the fn (realworld-axum S **12→19, 19/19**); balanced-paren scan + per-method nodes + last-`::`-segment handler. **Rocket attribute macros 550/556 (99%)** (Rocket repo L) — already strong. crates.io named axum routes resolve (6/8; rest are closures/var handlers; its API is mostly the utoipa `routes!` macro = frontier). Cargo-workspace module resolution (prior work). **actix builder API** `web::resource("/x").route(web::get().to(h))` / `.to(h)` / App `.route("/x", web::get().to(h))` (actix-examples **51→128 routes, 35→112 resolved**) — was the dominant actix style and fully missed (the handler is in `.to(h)`, not `get(h)`). 🔬 actix `web::scope("/api")` prefix (not prepended to nested resource paths) + anonymous `.to` closure handlers | | Java | Spring | request → @RestController → @Autowired service → repo | R + X | ✅ **bare `@GetMapping`/`@PostMapping` + class `@RequestMapping` prefix join → route→method** (realworld S / mall M / halo L) — was missing all path-less method mappings; DI controller→service resolves (name + dir) + **interface→impl dispatch synthesizer** (`interfaceOverrideEdges`: a class's `implements`/`extends` → link each interface/base method → its same-name override; JVM-gated, capped, **overload-aware**; mall **310** / halo **734** synth edges, node count unchanged) so trace follows controller→service-**interface**→**impl** instead of dead-ending at the abstract method — `trace("PmsProductController.getList","PmsProductServiceImpl.list")` connects in **3 hops** (probe-validated). + **field-injected concrete-bean trace** (#389): `this..method()` strips the `this.` receiver at extraction, and the resolver looks up the receiver name in the enclosing class's field declarations to get the declared type, then resolves the method on it — closes the controller→bean hop when the field-name doesn't capitalize to the type (`@Resource(name="userBO") UserBO userbo` → `userbo.toLogin2()` reaches `UserBO.toLogin2`). + **`@Value("${k}")` / `@ConfigurationProperties(prefix="X")` → application.{yml,yaml,properties}** binding with Spring's relaxed binding (kebab↔camel↔snake), incl. `${k:default}`. mall-tiny S: 11/11 `@Value` resolved. ⚠️ **agent A/B null** (n=2: the agent went context→explore→Read and never invoked `trace`, so the synth edges weren't exercised — adoption-gated, the recurring wall; see `docs/benchmarks/call-sequence-analysis.md`). The fix is correct + improves trace/callees/impact/context connectivity regardless; agent-visible read reduction needs trace adoption. 🔬 Spring Data JPA derived queries (`findByEmail`) — metaprogramming frontier; `@PropertySource` external files; Spring Cloud Config; mapper-class simple-name collisions across packages (dropped to avoid mis-resolution) | | Java | MyBatis (XML mappers) | DAO interface method → `` SQL | R (XML extract) + S (Java↔XML synthesizer) | ✅ **XML mapper as first-class language** (#389) — `src/extraction/mybatis-extractor.ts` parses files containing ``; emits one method-shaped node per statement qualified `::` + `` fragments + `` references. Non-mapper XML (pom, log4j) → file node only. `mybatisJavaXmlEdges` synthesizer indexes Java methods by `::` and joins to XML qualified names by suffix-match — ambiguous simple-name collisions dropped (precision over recall). mall-tiny S **6/6 custom-SQL mapper methods bridge** to their XML statements; full enterprise chain `trace(controller.action → mapper.method-xml)` connects across controller / service-iface / impl / mapper / XML. 🔬 cross-mapper `` via unqualified refid; MyBatis Plus dynamic methods (`BaseMapper` CRUD inherited from framework, not in project); annotation-driven mappers (`@Select("SELECT ...")` on Java methods — the SQL lives in the annotation, not XML) | | Kotlin | Spring Boot / Jetpack Compose | request → @RestController → service; @Composable → child | R + X | ✅ **Spring Boot Kotlin** — the Spring resolver was `['java']`-only with a Java-syntax method regex (`public X name()`); extended to `.kt` + Kotlin `fun name(` handler matching (petclinic-kotlin **0→18, 18/18**; class-prefix joins; DI controller→repo resolves — `showOwner ← GET /owners/{ownerId}` → `OwnerRepository.findById`). **Compose composition already static** (@Composable→child are plain function calls — Jetcaster `PodcastInformation→HtmlTextContainer`). Java Spring unchanged (realworld 19/19). 🔬 Ktor `routing { get("/x"){…} }` lambda handlers (anonymous) + Compose recomposition (implicit `mutableStateOf`, no setState gate) + coroutines/Flow | | Swift | Vapor | request → route → controller | R + X | ✅ **was 0 routes on every real app** — the extractor required an `app/router/routes` receiver + a `"path"` literal, but real Vapor routes on grouped builders (`let todos = routes.grouped("todos"); todos.get(use: index)`) with NO path arg. Rewrote: any receiver, optional/non-string path segments, `.grouped`/`.group{}` prefix tracking, `use:` discriminator. vapor-template S **0→3 (3/3**, nested `/todos/:todoID`), SteamPress M **0→27 (27/27)**, SwiftPackageIndex-Server L **0→14 (14/14** handler resolution). 🔬 typed-route enums (SPI `SiteURL.x.pathComponents` — path label only, handler still resolves) + closure handlers `app.get("x"){ }` (anonymous) | | Swift | Alamofire / closure-collection | request → build → send → **validate** (deferred closures) | S | ✅ **closure-collection dispatch synthesizer** (`closureCollectionEdges`): the Swift deferred-handler pattern `DataRequest.validate` `validators.write{$0.append(v)}` … base `Request.didCompleteTask` `validators.forEach{$0()}` (append + dispatch in different files/classes, field is `Protected<[() -> Void]>`). The element-invoke `$0(`/`it(` is the precision gate → **9 edges on Alamofire** (validators/streams/finishHandlers/requestsToRetry), **0 on every non-closure-collection control**. Surfaced inline in `trace` + as an explore "Dynamic-dispatch links" section (so it shows when the agent named only `validate`, not the `didCompleteTask` that drains the list). Forced codegraph-only: **3/3** build/send/validate correct. + **trace endpoint relevance** (`nodeRelevance`): overloaded `request`/`task` (44/8 defs, mostly empty `EventMonitor` delegate stubs) now resolve to the real `Session.request`, not a 1-line no-op — **WITH-arm tool calls 12→8 median, read variance 0–12→1–4** (the meltdowns were all the trace-collision flounder); control-safe (excalidraw/okhttp/gin traces intact, gin A/B 0 reads). + **god-file multi-phase rendering** (`handleExplore`): a flow whose necessary code spans a god-file (Session.swift build chain ~11K) PLUS other files (validate logic) used to truncate at the fixed `maxOutputChars` and drop whichever phase came last. Six coordinated layers make it render all phases: (1) on-spine god-files render spine-full + off-path methods as signatures (true-spine), (2) every NAMED token's substantive def is seeded into the subgraph (FTS buried `validate` under the build terms → Validation.swift was never gathered), (3) a file that DEFINES a named symbol outranks one that merely references the flow (Validation=50 > incidental Combine=23), (4) the 90%-budget early-break and (5) the total cap both exempt necessary (named/spine) files — incidental files stay capped, (6) the final ceiling is 1.5× so it doesn't slice the necessary content the loop assembled. Alamofire now renders build+validators-exec+validate in ONE explore (~16K); A/B reads med 2→**0.5**, tools 8→**5.5**; excalidraw control held at 0 reads (no bloat). Sequential-flow spine is irreducible (no redundant siblings to collapse) — the fix is to render it, not cap it. | | C# | ASP.NET Core | request → [Http*] action → DI service → EF | X | ✅ **feature-folder detection** (realworld 0→19 — was undetected) + **bare `[HttpGet]` + class `[Route]` prefix** (eShopOnWeb 9→33 / jellyfin L) — co-located so no claimsReference needed. 🔬 EF Core LINQ/DbSet (metaprogramming frontier) | | Ruby | Rails / Sinatra | request → routes.rb → Controller#action → model | R | ✅ **RESTful `resources`/`resource` routing → controller#action** (realworld S 16 / spree M / forem L), pluralization + only/except + claimsReference; explicit routes fixed to precise `controller#action` too. 🔬 ActiveRecord dynamic finders (`Article.find_by_slug`) — metaprogramming frontier | | PHP | Laravel | request → route → controller → Eloquent | R | ✅ **precise `Route::get([Ctrl::class,'m'])` / `'Ctrl@m'` → Ctrl@method** (realworld S / firefly M / bookstack L) — was resolving the bare method name to the WRONG controller (every `index`→ArticleController); Route::resource→controller. 🔬 Eloquent dynamic finders/relationships (metaprogramming frontier) | | PHP | Drupal | request → *.routing.yml → _controller/_form | R | ✅ **`claimsReference` for FQCN handlers** (`\Drupal\…\Class::method` passed the pre-filter only because the `::method` name was known; bare `_form` FQCNs `\…\FormClass` and single-colon `Class:method` controller-services were dropped before resolve()) + **single-colon controller match** + **detect via composer `type:drupal-*` / `name:drupal/*` + `*.info.yml` fallback** (a contrib module with empty `require` was undetected → 0 routes). admin_toolbar S **0→14 (14/14)** / webform M 208 (**144**) / core L 836 (536→**731, 87%**). Remainder is the **entity-annotation handler frontier** (`_entity_form: type.op` resolves via the entity's PHP `#[ContentEntityType]` handlers, not a direct class). 🔬 **OOP `#[Hook]` attributes** — Drupal 11 moved ~all procedural hooks to attribute methods (core: 418 `#[Hook]` files vs 3 procedural), so the resolver's docblock/`module_hook` detection is obsolete for modern core (0 hook edges) | | C/C++ | C++ vtables / inheritance | virtual call → override; general direct dispatch | S + X | ✅ **general dispatch strong** (redis C **29k** cross-file calls / leveldb C++ **1.4k**) + **C++ inheritance extraction fix** (`base_class_clause` was unhandled, so C++ extends edges were missing — leveldb **219→298**) + **cpp-override synthesizer** (base virtual method → subclass override, gated to C++, capped — leveldb 12 precise: `Iterator::Next→MergingIterator`). 🔬 C callback structs (`s->fn()` → 422-way fan-out, too noisy to synthesize) + C++ pure-virtual base methods (`virtual void f()=0;` declarations aren't extracted as nodes, so those overrides can't bridge) | | Dart | Flutter | setState → build; build → child widgets | S + X | ✅ **setState→build synthesizer** (Dart analog of react-render: a State method whose body calls `setState(` → `build`) gated to `.dart` + **foundational Dart method-range fix** — Dart models a method body as a *sibling* of the signature, so method nodes were signature-only (`end==start`); now `endLine` spans the body (required for ALL body analysis: callees, context slices, the synthesizer's body scan). counter `initState→build`, books `build→BookDetail/BookForm`; widget composition already static (compass_app `build→ErrorIndicator/HomeButton`). Controls unchanged (excalidraw 9,290 / django 302 — the range fix only extends sibling-body grammars). 🔬 MVVM Command/ChangeNotifier dispatch (compass_app — no setState) + `Navigator.push(MaterialPageRoute(builder:))` nav routes | | Lua / Luau | Neovim / Roblox | module dispatch (require→mod, mod.fn); event/callback | — | ✅ **already covered for the dominant flow (measure-first, no code change)** — Neovim is module-heavy (`require('x')` + `x.fn()`), and the general import + name resolution already handles it: telescope.nvim **220 imports + 335 cross-file `mod.fn` calls**, traces end-to-end (`map_entries ← init.lua → get_current_picker (state.lua)`). Luau instance-path `require(game:GetService(...))` handled by the extractor. 🔬 event-callback registration (`vim.keymap.set(…, fn)`, autocmd `callback=`, Roblox `signal:Connect(fn)`) is predominantly INLINE anonymous closures (corpus ~12 inline vs ~2 named) — the anonymous-handler frontier; named handlers too rare to justify a synthesizer | | Scala | Play / Akka | request → conf/routes → controller action | R + X | ✅ **Play `conf/routes` → controller** — the extensionless `conf/routes` wasn't indexed; added narrow file-walk opt-in (`isPlayRoutesFile`) + a Play resolver parsing `METHOD /path Controller.action(args)` → the action method (computer-database **0→8, 7/8**; starter 0→4, 3/4 — the unresolved are Play's framework `Assets` controller, external). Scala general controller→DAO dispatch already resolves. No-regression: the file-walk change only ADDS Play routes files (excalidraw 9,290 / suite 800 unchanged). 🔬 SIRD programmatic router (`-> /v1 Router` include + `case GET(p"/x")` in code) + Akka actor `receive`/`Behaviors.receiveMessage` message→handler | | Swift × Objective-C | mixed iOS apps | Swift `obj.foo(bar:)` → ObjC `-fooWithBar:`; ObjC `[obj fooWithBar:]` → Swift `@objc func foo(bar:)` | R | ✅ **Swift↔ObjC cross-language bridge** — `frameworks/swift-objc.ts` implements Apple's `@objc` auto-bridging name math (incl. init forms `initWith:`, property getter+setter pairs, `@objc(custom:)` override) and the reverse direction strips Cocoa preposition prefixes (`With`/`For`/`By`/`In`/`On`/`At`/`From`/`To`/`Of`/`As`) to derive Swift base-name candidates. Validated on Charts S **28/1 obj→swift / swift→objc**, realm-swift M **36/1185**, wikipedia-ios L **52/983**. Genericname blocklist (`init`, `description`, `count`, …) keeps precision. Confidence 0.6 (name-match's 1.0 wins ties) — bridge only fires when name-match has no result. 🔬 Swift generics over ObjC protocols, Swift extensions on ObjC classes (silently miss; matches Java/Kotlin generics frontier) | | JS × native | React Native legacy bridge | JS `NativeModules.X.fn(...)` → ObjC `RCT_EXPORT_METHOD` / Java/Kotlin `@ReactMethod` | R | ✅ **RN legacy bridge** — `frameworks/react-native.ts` parses `RCT_EXPORT_MODULE` (default-name from `RCT`-prefix-stripped class name) + `RCT_EXPORT_METHOD(selector:(...))` + `RCT_REMAP_METHOD(jsName, selector)` on the ObjC side and `@ReactMethod` + `getName()` literal on Java/Kotlin. AsyncStorage S **8/8 precise** (`setItem`→`legacy_multiSet`, etc.), react-native-firebase L **18 precise after `RCTEventEmitter` built-in blocklist** (initial 78 included 60 `addListener:`/`remove:` false positives — every emitter subclass declares those via `RCT_EXPORT_METHOD`, JS callers route through the `NativeEventEmitter` abstraction not the native method directly). 🔬 dynamic bridge keys (`NativeModules[someVar]`) — literal-key only | | JS × native | React Native TurboModules | JS spec interface ↔ native impl | R (spec as ground truth) | ✅ partial — parses `TurboModuleRegistry.get*('Name')` + the `Spec` interface methods. Each spec method matches to a native impl by selector first-keyword (ObjC) / identifier (JVM). react-native-svg S **9 precise** (`getTotalLength`, `getPointAtLength`, `getCTM`, `isPointInFill`, …) bridging to Java impls (the iOS side is Codegen-auto-generated without `RCT_EXPORT_METHOD` declarations). 🔬 TurboModule native impl classes that don't use legacy macros (RNSvg iOS — would need inheritance-aware bridging via the Codegen-generated `NativeFooSpec` superclass) | | ObjC/Java/Kotlin → JS | React Native event emitters | native `sendEventWithName:`/`emit(...)` → JS `addListener('e', handler)` | S (cross-lang channel) | ✅ **rn-event-channel synthesizer** — matches ObjC `sendEventWithName:@"X"`, Swift `sendEvent(withName: "X", ...)`, and JVM `.emit("X", ...)` to JS `addListener('X', handler)` keyed by literal event name. Same fan-out cap (`EVENT_FANOUT_CAP=6`) as in-language channel. **Subscribe-wrapper fallback** for RN-library APIs (`const Foo = { watchX(listener) { addListener('e', listener) } }`) — when the handler arg is a parameter, falls back to the enclosing function and then the enclosing `constant`/`variable` (reachability-correct attribution to the JS API surface). RNFirebase L **3 push-notification flow edges** (UIApplicationDelegate → JS `onMessage`/`onNotificationOpenedApp`), RNGeolocation S **2 location-event edges** (Swift `onLocationChange`/`onLocationError` → JS `Geolocation`). 🔬 inline arrow handlers `addListener('e', d => …)` (anonymous frontier) | | JS × Swift/Kotlin | Expo Modules | JS `requireNativeModule('X').fn(...)` → Swift/Kotlin `Function("fn") { ... }` | R (extract → synthetic method nodes) | ✅ **expo-modules framework extractor** — parses Swift/Kotlin `Module { Name("X"); Function("y") { ... }; AsyncFunction("z") { ... }; Property("w") { ... } }` literals and synthesizes `method` nodes named after each declaration. JS callsites resolve via existing name-matcher (no separate `resolve()` needed). expo-haptics S **6 method nodes** (`notificationAsync`, `impactAsync`, `selectionAsync` × Swift + Kotlin), expo-camera M **41** (full SDK surface incl. `takePictureAsync`, `record`, `scanFromURLAsync`, view props `width`/`height`), expo SDK sweep L **134** (7 packages, 72 Swift + 62 Kotlin). Same-name JS wrappers in the package itself shadow the native names (`CameraView.tsx`'s `pausePreview` wraps native `pausePreview`); external consumer apps bridge through to native directly. 🔬 closure body extraction (the Function trailing closure isn't a body-range node yet) | | JS × native | React Native Fabric / Codegen + legacy Paper view components | JSX `` → Codegen spec → native class (or Paper `RCT_EXPORT_VIEW_PROPERTY` / `@ReactProp`) | R (extract) + S (native-impl) + JSX | ✅ **fabric-view extractor + fabric-native-impl synthesizer** — extractor parses **both** modern Codegen TS specs (`codegenNativeComponent('Name', ...)`) **and** legacy Paper view-manager macros (`RCT_EXPORT_VIEW_PROPERTY` on ObjC, `@ReactProp` on Java/Kotlin). Emits a `component` node per declaration + a `property` node per declared prop. Synthesizer links the component to its native impl class by RN's convention-based name+suffix (`exact`/`View`/`ComponentView`/`Manager`/`ViewManager`). Combined with `reactJsxChildEdges`, full consumer flow: JSX `` → fabric `component` → native class. Validated on RNSegmentedControl S **(legacy Paper) 1 component + 11 props + 4 bridges**, RNScreens M **(pure Codegen) 27 components + 272 props + 68 bridges** (was 0 before Phase 6), RNSkia L **(hybrid + monorepo) 5 + 14 + 15 across Codegen TS + Android Java + iOS ObjC**. **Monorepo detect** added: probes `packages//package.json` etc. via `listDirectories` when the root manifest is a workspace declaration (was the gating bug on RNSkia). 🔬 Fabric event-handler props (`onTap={cb}`) — JSX attribute extraction needed | (Verify the exact supported set against `src/extraction/languages/` and `src/resolution/frameworks/` before starting — this table is a starting point.) --- ## 7. Known limits & gotchas (from the excalidraw/django work) - **Coverage enables, doesn't force, the no-read path.** Agents still read to *confirm source* sometimes; cost stays ~flat (codegraph calls trade for reads). The reliable win is **completeness** + making Read-0 *possible*. Don't expect a guaranteed cost drop. - **Vue (validated 2026-05-23, vitepress S / vben M / element-plus L).** SFC `