Skip to content

query_graph callers_of/callees_of returns empty — edge targets stored as bare names #20

@ericlitman

Description

@ericlitman

Summary

query_graph("callers_of", ...) and related relational queries return 0 results even when the graph contains matching CALLS edges. The root cause is that call edge targets are stored as bare function names (e.g., createTask) rather than qualified names (e.g., /path/to/file.ts::createTask), so the get_edges_by_target(qualified_name) lookup in query_graph never matches.

Reproduction

# Clone any TypeScript project with cross-file function calls
git clone https://github.com/ericlitman/pipeline-test-1.git /tmp/test-repo
cd /tmp/test-repo
uvx code-review-graph build

# Query callers — returns 0 results
uvx --from code-review-graph python3 -c "
from code_review_graph.tools import query_graph
result = query_graph('callers_of', '/tmp/test-repo/src/models/task.ts::createTask', repo_root='/tmp/test-repo')
print(result)
"

Returns "summary": "Found 0 result(s)" despite the edge data clearly showing createTaskRoutes calls createTask.

Root cause

Raw edge data in SQLite shows:

CALLS: /tmp/test-repo/src/routes/tasks.ts::createTaskRoutes -> createTask

The target is the bare name createTask, not the qualified name /tmp/test-repo/src/models/task.ts::createTask. When query_graph calls store.get_edges_by_target(qualified_name), the qualified name doesn't match the bare name stored in the edge.

The same issue affects importers_of — import edge targets are stored as relative paths (../models/task) rather than resolved qualified names.

Note: get_impact_radius is NOT affected because it uses a different traversal path (NetworkX graph).

Affected queries

  • callers_of — always returns empty
  • importers_of — always returns empty
  • tests_for (via TESTED_BY edges) — no edges created (see related issue)

Expected behavior

Edge targets should be resolved to qualified names during parsing, matching the format used in node qualified_name fields. Alternatively, query_graph should fall back to matching against bare names when qualified name lookup fails.

Environment

  • code-review-graph v1.8.2
  • Python 3.14.3
  • TypeScript codebase (Bun + Hono)
  • macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions