Skip to content

indexer: emit typed call/import edges with enclosing-symbol attribution (Python) #84

Description

@IceRhymers

Part of #82. Depends on #83.

Summary

Extend the tree-sitter indexing walk to emit typed call and import edges with enclosing-symbol attribution for Python, and write them through the existing per-file lifecycle.

Scope

  • Extend indexer/languages.py with a per-language edge node map alongside SYMBOL_KINDS (same single-source-of-truth architecture); Python first: call (rightmost identifier of the callee) and import_statement/import_from_statement.
  • Extend the walk in indexer/symbols.py (or a sibling edges extractor sharing the walk) to emit edges in the same pass, tracking the enclosing definition node on the traversal path — no second walk, no join at write time.
  • Write edges in indexer/store.py with the same delete-and-reinsert-per-file pattern as symbols, inside the existing transaction (pure DML); ensure branch sweep/orphan cleanup covers edge rows via FK cascade.
  • Bump INDEX_SEMANTICS_VERSION so the CAS skip logic forces re-extraction.
  • Unit fixtures mirroring tests/unit/test_symbols.py: nested calls, method vs bare calls, aliased imports, edge line numbers (1-based).

Acceptance criteria

  • Python files produce typed call/import edges with correct enclosing-symbol attribution and line numbers.
  • Edge extraction overhead ≤ ~15% of parse+walk (deep-dive probe measured 12%).
  • Delete-and-reinsert + sweep proven by tests (re-index removes stale edges; branch retirement cascades).
  • Single deliberate INDEX_SEMANTICS_VERSION bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions