Skip to content

fix: improve call graph accuracy -- filter method call noise, add Kotlin support#106

Closed
gzenz wants to merge 1 commit intotirth8205:mainfrom
gzenz:fix/call-graph-accuracy
Closed

fix: improve call graph accuracy -- filter method call noise, add Kotlin support#106
gzenz wants to merge 1 commit intotirth8205:mainfrom
gzenz:fix/call-graph-accuracy

Conversation

@gzenz
Copy link
Copy Markdown
Contributor

@gzenz gzenz commented Apr 5, 2026

Summary

  • Filter method call noise: obj.method(), response.json(), data.get() were recorded as bare CALLS targets (method, json, get), polluting the graph with unresolvable noise and creating false callers via name collisions. Now only self/cls/this/super method calls emit CALLS edges.
  • Add Kotlin call extraction: Kotlin uses simple_identifier and navigation_expression in its tree-sitter AST, which were not handled -- producing zero CALLS edges for Kotlin files.

Impact (measured on this repo, Python-only)

Metric Before After Change
Total CALLS edges 3006 1262 -58%
Resolved (qualified) 403 377 -6%
Bare (unresolvable) 2603 885 -66%

Almost all meaningful call relationships preserved (6% drop). The 58% total drop is noise removal.

Test plan

  • test_method_call_filtering_python_self -- self.method() emits CALLS
  • test_method_call_filtering_python_external -- obj.method() does not
  • test_method_call_filtering_python_super -- super().method() emits CALLS
  • test_method_call_filtering_ts_this -- this.method() emits CALLS
  • test_method_call_filtering_ts_external -- obj.method() does not
  • Kotlin test_finds_calls -- println() works, repo.save() filtered
  • Full suite: 615 passed, 0 failed

…lin support

Method calls like obj.method(), response.json(), data.get() were recorded
as bare CALLS targets ("method", "json", "get"), polluting the graph with
unresolvable noise and creating false callers via name collisions.

Now only self/cls/this/super method calls emit CALLS edges -- these resolve
within the class. External method calls are dropped (unresolvable without
type inference). On this repo: 58% fewer CALLS edges, but only 6% fewer
resolved edges -- almost all useful relationships preserved.

Also adds Kotlin call extraction (simple_identifier + navigation_expression)
which was completely missing.
@gzenz
Copy link
Copy Markdown
Contributor Author

gzenz commented Apr 5, 2026

Split into #107 (Kotlin) and #108 (method call filtering)

@gzenz gzenz closed this Apr 5, 2026
@tirth8205
Copy link
Copy Markdown
Owner

This PR addresses call graph noise (obj.method() creating false CALLS edges) and adds Kotlin call extraction. The changes are substantial (58% reduction in noisy CALLS edges) and all tests pass. Let me check if this has been integrated into main...

@tirth8205
Copy link
Copy Markdown
Owner

The call graph noise filtering (only emit CALLS for self/cls/this method calls, filter out obj.method()) does not appear to be in main — the current parser.py extracts method names from all member_expression calls without filtering by receiver type. The 58% noise reduction and Kotlin call extraction this PR provides are still not in main. Worth reviving — this would significantly improve call graph accuracy and reduce false positives.

@tirth8205 tirth8205 reopened this Apr 11, 2026
@gzenz
Copy link
Copy Markdown
Contributor Author

gzenz commented Apr 11, 2026

The noise filtering from this PR is fully included in #158 — same core logic (only allow self/cls/this/super receivers) plus additional refinements: uppercase receivers for class/static calls, namespace import receivers checked against the import map, nested member expression resolution (os.path.getsize), and a test-file exception to preserve TESTED_BY edges. Closing in favor of #158.

@gzenz
Copy link
Copy Markdown
Contributor Author

gzenz commented Apr 11, 2026

Noise filtering is included in #158 with additional improvements (see comment above). Closing.

@gzenz gzenz closed this Apr 11, 2026
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.

2 participants