Uh oh!
There was an error while loading. Please reload this page.
fix(python): resolve module-level functions in get_method; truthful callers/callees - #250
Merged
Conversation
get_method(scope, name) delegated straight to get_all_methods_in_class,
so any scope naming a module rather than a class came back empty. Since
get_all_callers/get_all_callees call get_method internally, they
silently reported the false-empty {"caller_details": []} /
{"callee_details": []} for module-level functions even when the call
graph knew the true edge.
Local backend: resolve scope the same way get_all_methods_in_application
already does (class signature or module name as the outer key).
Neo4j backend: try the class path first (get_class), and fall back to a
new targeted _get_module_functions query scoped by module_name so the
fix stays as cheap as the existing class lookup instead of paying a
whole-symbol-table fan-out per call.
Miss-shape semantics (None / empty caller_details) are unchanged. Merged
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 freeto 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.
Closes#246.
What
get_methodonly searched class scope, so module-level functions were unreachable andget_all_callers/get_all_calleesreturned a silent false-empty ({"caller_details": []}) for them even when the call graph had the edges. Fixed on both backends:get_method(scope, name)now resolves module-level functions whenscopeis a module name, mirroringget_all_methods_in_application's keying; short-name fallback preserved.get_all_callers/get_all_callees/get_method_parameters/get_comments_in_a_methodinherit the fix throughget_method.Miss shapes are deliberately unchanged (a genuine miss still returns
None/ empty) — #249 owns miss discrimination.Tests
New
tests/analysis/python/test_python_method_lookup.py(11 tests): module-level lookup + callers/callees on apkg.mod.entry -> pkg.mod.helpercall-edge fixture, both backends, plus genuine-miss regression pins. TDD (RED on unfixed code, GREEN after).Gate on head
0385257:tests/analysis/python— 35 passed, 6 skipped (skips = live-Neo4j gating, no server in the dev sandbox).Notes for reviewers
test_python_neo4j_backend.pyneed a live-DB run (CI or local Neo4j) to execute; the offline stub tests cover the dispatch logic.