Skip to content

fix(extraction): record callers for methods passed as values (#1820) - #1894

Open
JosefAschauer wants to merge 3 commits into
colbymchenry:mainfrom
JosefAschauer:fix/1820-method-value-callers
Open

JosefAschauer wants to merge 3 commits into
colbymchenry:mainfrom
JosefAschauer:fix/1820-method-value-callers

Conversation

@JosefAschauer

Copy link
Copy Markdown
Contributor

Fixes #1820

Problem

codegraph callers / impact only recorded obj.method(...) call expressions. A method passed as a first-class value had no production edge:

pool.submit(self.store.fetch, ids)          # missed
thread_pool_exec(self.dataStore.fetch, ids) # missed
Submit(c.store.Fetch, ids)  # missed (method value)
go c.store.Fetch(ids)       # already a call expressionunchanged

A unique production method then looked test-only.

Approach

Same capture/resolution discipline as existing function-as-value (#756):

  • Python self.store.fetch / Foo.parse in a value position → *.fetch function-ref
  • Go c.store.Fetch in a value position → *.Fetch function-ref
  • self.method / this.method paths unchanged
  • Resolution: functions and methods, same-file first, unique-or-drop cross-file (two fetch methods still produce no edge — a wrong callback is worse than none)

Native kernel (python.rs / go.rs) and the wasm function-ref.ts path stay in lockstep. EXTRACTION_VERSION 27.

Watcher / daemon

Incremental sync() cannot backfill new edge kinds. MCP catchUpSync() now calls indexAll() when isIndexStale() so codegraph serve --mcp rebuilds once after upgrade; the file watcher then keeps those edges current on subsequent edits.

Tests

__tests__/function-ref.test.ts: Python unique-method callback, Python decoy (two fetch methods → no edge), Go Submit(c.store.Fetch) + go c.store.Fetch(ids). 23/23 in that file on Node 22.

…henry#1820)

pool.submit(obj.method), thread_pool_exec(self.store.fetch), and Go
Submit(c.store.Fetch) produced no callers/impact edge because only
obj.method(...) call expressions were captured. Member values are now
emitted as *.method function-refs and resolve unique-or-drop
(same-file first). Two methods of the same name still produce no edge.

Go go c.store.Fetch(ids) remains a calls edge (it is a call expression).

EXTRACTION_VERSION 27: MCP daemon catch-up rebuilds a stale index on
start so the watcher does not keep serving the hole after upgrade.
…value callers

A unique production method plus a unit-test double of the same name
was treated as ambiguous, so retrieve_vision_vectors still looked
callback-invisible on a real repo. Prefer the non-test file when
exactly one production target remains.
colbymchenry#1820 unique-or-drop treated DocStoreConnection.delete_payload_fields
(the ABC stub) and QdrantConnection.delete_payload_fields as ambiguous,
so gc_stale_member_stamps stayed invisible. Skip short not-implemented
stubs when exactly one real implementation remains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Caller/impact graph misses methods passed as first-class references (callbacks), e.g. executor.submit(obj.method, …)

1 participant