fix: add receiver field to call sites to eliminate false positive edges#38
Closed
carlos-alm wants to merge 9 commits intomainfrom
Closed
fix: add receiver field to call sites to eliminate false positive edges#38carlos-alm wants to merge 9 commits intomainfrom
carlos-alm wants to merge 9 commits intomainfrom
Conversation
Dogfooding revealed ~52% of call edges were false positives because obj.method() and standalone() both produced identical call records, causing the global fallback to match ANY function with that name. Add an optional receiver field to call site extraction across all 11 language extractors (WASM + Rust native). The builder's global fallback now only fires for standalone calls or this/self/super — method calls on a receiver skip it entirely. Graph edges on self-analysis dropped from ~1742 to 1321 (24% reduction), all removed edges being false positives like insertNode.run() resolving to f run in cli.test.js.
Contributor
Greptile SummaryThis PR eliminates false positive call graph edges by adding a Key changes:
Implementation quality:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Source Code] --> B[Tree-sitter Parse]
B --> C{Call Type?}
C -->|Standalone call<br/>fn| D[Extract: name=fn<br/>receiver=undefined]
C -->|Method call<br/>obj.method| E[Extract: name=method<br/>receiver=obj]
C -->|this/self call<br/>this.foo| F[Extract: name=foo<br/>receiver=this]
D --> G[builder.js Resolution]
E --> G
F --> G
G --> H{Has receiver?}
H -->|No receiver| I[Try global fallback]
H -->|Receiver = this/self/super| I
H -->|Receiver = other| J[Skip global fallback<br/>Prevents false positives]
I --> K[nodesByName.get]
J --> L[Only use method hierarchy]
K --> M[Create Edge]
L --> M
style J fill:#90EE90
style K fill:#FFB6C6
style L fill:#90EE90
Last reviewed commit: b08c2b2 |
…literals Import ListToolsRequestSchema and CallToolRequestSchema from @modelcontextprotocol/sdk/types.js and pass them to setRequestHandler instead of raw 'tools/list' and 'tools/call' strings. Updates mocks in tests to match. Also includes updated DEPENDENCIES.md and dogfood report.
The prebuilt native binary doesn't have the receiver field yet. Exclude it from the cross-engine parity comparison to unblock CI until the next native binary release.
Move DEPENDENCIES.md, DOGFOOD-REPORT-2.1.0.md, COMPETITIVE_ANALYSIS.md, and architecture.md out of the repo root into generated/ to reduce top-level clutter.
Add benchmark scripts that measure both native (Rust) and WASM engine performance by running codegraph on its own codebase. Results are normalized per file for cross-version comparability and include a 50k-file extrapolation. - scripts/benchmark.js: runs dual-engine builds, outputs JSON - scripts/update-benchmark-report.js: updates BENCHMARKS.md + README - .github/workflows/benchmark.yml: runs on release, commits via PR - README.md: replaced hardcoded metrics with auto-updated section
…d built-in skip Dogfooding revealed ~52% false positives in call edges. Three targeted fixes reduce edges from ~1430 to ~615 (57% reduction) while preserving all real dependencies: - Scope-aware fallback: standalone calls no longer resolve globally (confidence 0.3); only same-directory (0.7) and parent-directory (0.5) matches are kept - Edge deduplication: track seen caller→target pairs per file to prevent duplicate edges from repeated calls to the same function - Built-in receiver skip: skip resolution for console, Math, JSON, Object, Array, Promise, process, Buffer, and other runtime globals that never resolve to user-defined symbols
- .gitattributes: keep binary file rules from branch - package-lock.json: accept main's v2.1.0 - DEPENDENCIES.md → DEPENDENCIES.json: auto-generated in publish workflow via `npm ls --json --all --omit=dev`
3 tasks
carlos-alm
added a commit
that referenced
this pull request
Mar 21, 2026
- GitNexus overall score corrected from 4.7 to 4.5 to match the arithmetic mean of its six sub-scores (5+5+4+4+4+5)/6 = 4.5 - Tier 2 renumbered starting at #38 (was duplicating #37 with Tier 1); also resolves the pre-existing duplicate #43 (Bikach/ChrisRoyse now #44/#45), with all subsequent entries incremented accordingly - jelly section header updated from 417 to 423 stars to match the ranking table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
receiverfield to call site extraction across all 11 language extractors (WASM + Rust native) to distinguishobj.method()fromstandalone()calls. Skip global fallback for method calls with a receiver (exceptthis/self/super)caller→targetpairs per file, preventing duplicate edges when a function is called multiple timesconsole,Math,JSON,Object,Array,Promise,process,Buffer, etc.) that never resolve to user-defined symbolsResults (dogfooding on self)
Test plan
npm run lint— cleannode src/cli.js build .— clean rebuild, 615 edgesnode src/cli.js fn buildGraph— 11 correct call dependenciesnode src/cli.js fn openDb— 3 correct cross-file callersnode scripts/benchmark.js— WASM 690 / Native 716 edges