Skip to content

Wire up store_kg_edges() — populate edges table #429

Closed

Description

@ajianaz

Blocking #426.

Problem

edges table exists in schema with columns (source, kind, target, file, line, project_id) and store_kg_edges() is defined in src/index/graph.rs:64 — but it is never called. The table is always empty.

Only call_graph (caller → callee only) is populated. Edge kinds IMPORTS, IMPLEMENTS, INHERITS, CHILD_OF are defined in EdgeKind enum but never extracted or stored.

Task

  1. Call store_kg_edges() during indexing in src/index/extract.rs or src/index/mod.rs
  2. Extract IMPORTS edges (use/import/require statements per language)
  3. Extract IMPLEMENTS edges (impl Trait for Type)
  4. Extract INHERITS edges (class extends, struct inheritance)
  5. Keep call_graph as-is for backward compat — edges is the unified table
  6. Add migration to copy existing call_graph rows into edges as CALLS kind

Files to modify

  • src/index/extract.rs — add edge extraction per language
  • src/index/mod.rs — call store_kg_edges() after extraction
  • src/index/graph.rs — already has store_kg_edges(), verify it works
  • src/index/schema.rs — add migration to backfill edges from call_graph

Acceptance

  • edges table populated after cora index --rebuild
  • SELECT kind, COUNT(*) FROM edges GROUP BY kind returns CALLS + IMPORTS + IMPLEMENTS
  • Dead code detection works on edges table (not just call_graph)
  • No regression in existing find_callers, impact_analysis, trace_path

Est: 1-2 days

Activity

  1. added
    enhancement
    scope:core
    scope:code-intel
    on Jul 29, 2026
  2. ajianaz commented on Aug 1, 2026

    @ajianaz
    CollaboratorAuthor

    Implemented. Closing as completed — feature verified in codebase.

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

    enhancementscope:code-intelscope:core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions