feat: Improve Java/Python resolution, context relevance, and multi-symbol aggregation#75
Merged
Merged
Conversation
Eliminate cross-language false positives in name resolution and deprioritize test files in context building. Benchmarked on a Python+Rust codebase where 37% of edges were false positives from Python built-in methods resolving to Rust functions (e.g., list.extend → Rust extend). Resolution fixes (index-time): - Filter Python built-in type method calls (list.extend, dict.update, etc.) - Filter bare Python built-in method names (append, extend, pop, keys, etc.) - Add language boundary checks to matchMethodCall strategies 1, 2, and 3 - Penalize cross-language matches: -80 points in findBestMatch (was 0) - Reduce confidence for single cross-language exact matches (0.5 vs 0.9) - Prefer same-language candidates in matchFuzzy Context relevance fixes (query-time): - Add isTestFile() utility detecting test files across Python/JS/TS/Go/Rust/Java - Deprioritize test files in scorePathRelevance (-15 penalty) - Reduce test file scores to 30% in context builder result merging - Both skip deprioritization when query mentions "test" or "spec" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…raversal Java extraction: - Handle Java method_invocation AST (receiver.method pattern) - Support Java extends_interfaces and super_interfaces with type_list - Create unresolved references for Java imports for cross-file resolution - Extract interface inheritance via extractInheritance MCP tools: - Aggregate callers/callees/impact across ALL matching symbols (e.g. multiple overloads or same-named methods in different classes) - New findAllSymbols() helper for multi-symbol lookup Graph traversal: - Impact analysis now traverses into container children (class → methods) so that callers of methods appear in the impact radius of their class Other: - Add deleteSpecificResolvedReferences() for precise cleanup after resolution - Add 'instance-method' to resolvedBy union type - Version bump to 0.6.8 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
codegraph_contextreturns production code firstBenchmark
Tested on a 96-file Java project and a 115-file Python+Rust project.
Java: CodeGraph delivered production-quality results across all benchmarks — symbol search (10x richer than grep), call graph (17 callees in 1 call vs impossible with grep), impact analysis (transitive chains), and context building (entry points + code in 1 call).
Python (before fix): 37% of all edges were false positives from Python built-in methods resolving to Rust functions.
codegraph_contextreturned test functions instead of production code.Python (after fix):
subprocess.run→ Rustrun)submit_messagecalleesextend❌)QueryEnginePortimpactWhat changed
Python resolution fixes (index-time) —
src/resolution/name-matcher.ts:matchMethodCallstrategies — cross-language class/method matches are skippedfindBestMatch: cross-language penalty of -80 points (was 0, only had +50 same-language bonus)matchByExactName: single cross-language matches get 0.5 confidence (was 0.9)matchFuzzy: prefers same-language candidates; cross-language get 0.3 confidence (was 0.5)index.ts(isBuiltInOrExternal):list.extend,dict.update,str.split, etc.)append,extend,pop,keys,values,join, etc.)Context relevance fixes (query-time) —
src/context/,src/search/isTestFile()utility — detects test files across Python, JS/TS, Go, Rust, Java conventionsscorePathRelevance()applies -15 penalty to test files (unless query is about tests)Java extraction improvements —
src/extraction/tree-sitter.tsmethod_invocationAST node (receiver.method()pattern via object+name fields)extends_interfacesandsuper_interfaceswithtype_listwrapper for JavaextractInheritanceMulti-symbol aggregation —
src/mcp/tools.tscodegraph_callers,codegraph_callees,codegraph_impactnow aggregate results across ALL matching symbols (e.g., multiple overloads, same-named methods in different classes)findAllSymbols()helper with note when results span multiple symbolsImpact traversal —
src/graph/traversal.tsOther
deleteSpecificResolvedReferences()insrc/db/queries.tsfor precise cleanup after resolution'instance-method'toresolvedByunion type insrc/resolution/types.tsTest plan
extend/appendedges after re-index🤖 Generated with Claude Code