fix(incremental): seed callee::restName typeMap keys and pass callerName for Phase 8.3f#1404
Conversation
…ame in buildCallEdges Incremental rebuilds using buildCallEdges (incremental.ts) were missing two things needed for Phase 8.3f scoped-key resolution (#1358 / #1369): 1. The typeMap was not seeded with callee::restName entries from objectRestParamBindings × paramBindings. Without this seeding the scoped key `callee::restName` (e.g. `f2::rest`) is absent from the map, so resolveByMethodOrGlobal's third fallback (`typeMap.get(callerName::receiver)`) has nothing to find and the rest-param call goes unresolved. 2. caller.callerName was not passed to resolveCallTargets, so even if the scoped key was present in the typeMap (e.g. from WASM extraction), the `${callerName}::${effectiveReceiver}` lookup in resolveByMethodOrGlobal never fired. Fix: mirror what buildObjectRestParamPostPass (native full-build post-pass) and buildCallEdgesJS (WASM full-build path) already do: - Compute restNameCallees to know how many callees share a rest name. - Seed typeMap[callee::restName] for each objectRestParamBinding × paramBinding pair. - Also seed the unscoped key when only one callee uses that rest name, so resolution still works when callerName is null (findCaller couldn't match). - Pass caller.callerName to resolveCallTargets (already present from #1389). Also syncs call-resolver.ts and build-edges.ts with the scoped-key changes from PR #1368 (merged to main separately), which this branch was missing. docs check acknowledged Closes #1369
Greptile SummaryThis PR fixes two missing pieces in the incremental rebuild path (
Confidence Score: 5/5Safe to merge — the changes close a gap where incremental rebuilds silently produced incomplete call graphs for files using shared rest-param names. The typeMap seeding block is a line-for-line match to buildObjectRestParamPostPass (same confidence constant, same guard conditions, same unscoped-key-when-singleton rule). The callerName forwarding is a one-argument addition to an already-existing call. Both fallbacks are direct ports from the verified full-build path. The integration test covers the exact regression scenario end-to-end. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant BG as buildGraph (incremental)
participant BCE as buildCallEdges
participant TM as typeMap
participant FC as findCaller
participant RCT as resolveCallTargets
participant RBMG as resolveByMethodOrGlobal
BG->>BCE: symbols (calls, objectRestParamBindings, paramBindings)
BCE->>TM: seed callee::restName keys (Phase 8.3f)
note over TM: e.g. f2::rest → { type: obj2 }
loop for each call
BCE->>FC: findCaller(call, definitions)
FC-->>BCE: "caller { id, callerName }"
BCE->>RCT: resolveCallTargets(..., callerName) ← NEW
RCT->>RBMG: resolveByMethodOrGlobal(typeMap, callerName)
RBMG->>TM: typeMap.get("f2::rest") ← scoped key now found
TM-->>RBMG: "{ type: obj2 }"
RBMG-->>RCT: targets [m2]
RCT-->>BCE: "{ targets [m2], importedFrom }"
alt targets empty AND this.method() call
BCE->>BCE: same-class fallback: ClassName.methodName lookup
end
alt targets empty AND definePropertyReceivers
BCE->>BCE: definePropertyReceivers fallback
end
end
Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
Codegraph Impact Analysis1 functions changed → 5 callers affected across 2 files
|
Resolved one-line conflict in buildCallEdges: kept main's const/let split pattern (targets: initialTargets → let targets) and removed duplicate this-method and definePropertyReceivers fallback blocks introduced by the merge.
Summary
buildCallEdgesin the incremental rebuild path (incremental.ts) was missing two things needed for Phase 8.3f scoped-key lookup to work after a file edit:objectRestParamBindings × paramBindingswere not cross-referenced to seedcallee::restNameentries (e.g.f2::rest) in the typeMap. Without this seeding the scoped-key fallback inresolveByMethodOrGlobal(typeMap.get(callerName::receiver)) has nothing to find.caller.callerNamenot passed: Even with scoped keys in the typeMap, the${callerName}::${effectiveReceiver}lookup never fired becausecallerNamewas not passed toresolveCallTargets.this.method()fallback anddefinePropertyReceiversfallback from the full-build path intobuildCallEdges, completing incremental/full-build parity for these resolution patterns.Test plan
issue-1369integration test: full build producesf1→m1andf2→m2(same fixture as fix(resolver): scope Phase 8.3f typeMap key by function to avoid same-name rest-param collision #1358); subsequent incremental rebuild (file touch) preserves both edges with no cross-edges#1336,#1358,#1369) pass locallyCloses #1369