Skip to content

Bug Report: CodeQL call-graph edges silently dropped on (file, start_line) join miss #25

@rahlk

Description

@rahlk

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

  1. Analyze a project containing decorated functions/methods with CodeQL
    enabled (--codeql).
  2. 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:

  1. exact (abs_path, start_line) — unchanged precise path;
  2. 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;
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions