fix: resolve same-file call targets to qualified names#38
Closed
n24q02m wants to merge 1 commit intotirth8205:mainfrom
Closed
fix: resolve same-file call targets to qualified names#38n24q02m wants to merge 1 commit intotirth8205:mainfrom
n24q02m wants to merge 1 commit intotirth8205:mainfrom
Conversation
After parsing all nodes in a file, build a symbol table of local definitions (functions, classes, types). For each CALLS edge with a bare target name, check if it matches a local definition and replace it with the qualified name (file_path::name). External calls (names not defined in the file) remain bare. This fixes callers_of/callees_of returning empty results for functions called by bare name, which is the common case in Go (middleware chaining), Python (helper functions), and most other languages. Closes tirth8205#20 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tirth8205
added a commit
that referenced
this pull request
Mar 20, 2026
- Multi-word AND search logic for search_nodes (#37 by n24q02m) - Resolve same-file bare call targets to qualified names (#38 by n24q02m) - Output pagination with truncation flag for impact radius (#39 by n24q02m) - Update tests to handle qualified call targets from _resolve_call_targets Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Integrated into main via a344eaf. Thanks for the contribution! Same-file call target resolution is now live. |
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
Fixes #20.
callers_ofandcallees_ofqueries return empty results because the parser stores CALLS edges with bare target names (e.g.FirebaseAuth) while graph queries look up qualified names (e.g.main.go::FirebaseAuth).This PR adds a post-parse resolution step that builds a symbol table from parsed nodes and qualifies bare call targets that match local definitions.
Before:
callers_of("main.go::FirebaseAuth")returns 0 results, even thoughsetupRoutes()callsFirebaseAuth()in the same file.After: The CALLS edge target is resolved from
FirebaseAuthtomain.go::FirebaseAuth, socallers_ofcorrectly returnssetupRoutes.External calls (names not defined in the file) remain bare -- this is correct since they reference symbols in other files or libraries.
Changes
code_review_graph/parser.py:_resolve_call_targets()method that builds a symbol table and qualifies bare targetsparse_bytes()after tree extractionTest plan
func FirebaseAuth()andfunc setupRoutes() { FirebaseAuth() }produces a CALLS edge with qualified targetmain.go::FirebaseAuthjson.loads()) remain bare (no::in target)