Description
CodeQL-derived call-graph edges are joined back into Jedi's PyCallable
signature space by an exact (absolute_file_path, start_line) key
(codeql_analysis.py, _build_callable_location_index /
_iter_resolved_rows / augment_call_sites).
When CodeQL and Jedi disagree on a definition's start line — most
commonly with decorated functions, where the two tools differ on whether
the def line or the first decorator line is the start — the caller
lookup misses and the entire edge is silently discarded. A callee
miss is less severe (it degrades to a ghost node) but is caused by the
same brittle key.
This is a precision regression unique to the CodeQL backend; Jedi-derived
edges are not location-joined and so are unaffected.
Steps to Reproduce
- Analyze a project containing decorated functions/methods with CodeQL
enabled (--codeql).
- Inspect the resulting call graph for edges whose caller is a
decorated function.
Expected Behavior
CodeQL's resolved edge is preserved even when the start line does not
match Jedi's, by falling back to a more robust identity.
Actual Behavior
The edge is dropped (caller miss) or weakened to a ghost node (callee
miss) with only a debug-level log line.
Proposed Fix
Replace the exact-only location index with a resolution ladder:
- exact
(abs_path, start_line) — unchanged precise path;
- on miss, candidates sharing
(abs_path, short_name): single
candidate taken directly, otherwise prefer those whose parameter
count equals the CodeQL positional arity, then the nearest
start_line;
- no name match -> caller skipped / callee becomes a ghost (current
behavior).
Requires emitting Function.getName() and positional arity
(count(Function.getArg(_))) for both endpoints from the CodeQL query.
Description
CodeQL-derived call-graph edges are joined back into Jedi's
PyCallablesignature space by an exact
(absolute_file_path, start_line)key(
codeql_analysis.py,_build_callable_location_index/_iter_resolved_rows/augment_call_sites).When CodeQL and Jedi disagree on a definition's start line — most
commonly with decorated functions, where the two tools differ on whether
the
defline or the first decorator line is the start — the callerlookup misses and the entire edge is silently discarded. A callee
miss is less severe (it degrades to a ghost node) but is caused by the
same brittle key.
This is a precision regression unique to the CodeQL backend; Jedi-derived
edges are not location-joined and so are unaffected.
Steps to Reproduce
enabled (
--codeql).decorated function.
Expected Behavior
CodeQL's resolved edge is preserved even when the start line does not
match Jedi's, by falling back to a more robust identity.
Actual Behavior
The edge is dropped (caller miss) or weakened to a ghost node (callee
miss) with only a debug-level log line.
Proposed Fix
Replace the exact-only location index with a resolution ladder:
(abs_path, start_line)— unchanged precise path;(abs_path, short_name): singlecandidate taken directly, otherwise prefer those whose parameter
count equals the CodeQL positional arity, then the nearest
start_line;behavior).
Requires emitting
Function.getName()and positional arity(
count(Function.getArg(_))) for both endpoints from the CodeQL query.