Skip to content

graph: code metadata extractor emits untyped Symbol nodes and misses classes and methods #253

Description

@RichardHightower

Summary

Two gaps in the AST (CodeMetadataExtractor) graph path, found during the v10.7.0 integration test on 2026-09-19 against e2e/sample-project/ (five Python files, one test file):

  1. Entity types do not match the typed entity API. Every extracted node carries label Symbol. GET /graph/entity/{type}/{id} and the MCP resource graph-entity://{type}/{id} reject Symbol:

    {"detail":{"error":"invalid_entity_type","type":"Symbol","valid_types":["APIDoc","Class","ConfigFile","Database","DesignDoc","Endpoint","Enum","Function","Interface","Method","Module","PRD","Package","README","Runbook","Service","UserDoc"], ...}}
    

    Code-extracted entities are unreachable through the typed API.

  2. Coverage is partial. The persisted store held 21 nodes and 22 relations for 13 chunks. Present: Item, OutOfStock, module names, imports, and one test function. Missing: InventoryService, SqliteRepository, InMemoryRepository, reserve_stock, restock, and every method. The find-callers prompt (mode=graph, relationship_types=["calls"]) has nothing to find.

The graph mode itself works after the fixes in the same PR as this issue (parent-side refresh, LlamaIndex triplet read). This issue is about what the extractor puts into the graph.

Proposed fix

  • Emit typed labels from the AST metadata (Class, Function, Method, Module) instead of Symbol, or accept Symbol in the typed API as an alias.
  • Walk every chunk's symbol_name / symbol_kind metadata (present in chunk metadata already) and emit contains and defined_in for classes and methods, plus calls where the AST gives call targets.
  • Add a fixture-backed test that indexes e2e/sample-project/src/inventory and asserts InventoryService and reserve_stock are nodes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions