Skip to content

systems graph and impact

Bryan edited this page Jun 13, 2026 · 1 revision

Graph and impact

Active contributors: Bryan

The graph system connects parsed file-local facts into repository-wide relationships. src/lode/graph.py resolves imports, calls, inheritance, and blast-radius traversal over nodes persisted by src/lode/storage.py.

Directory layout

src/lode/graph.py  # graph resolution, traversal, impact reports
src/lode/indexer.py # parser facts consumed by graph resolution
tests/test_graph.py # graph correctness tests

Key abstractions

Name File Description
resolve_graph() src/lode/graph.py Rebuilds resolved edges for a repository.
resolve_python_module() src/lode/graph.py Maps Python module names to indexed paths.
resolve_js_module() src/lode/graph.py Maps TS/JS import paths to indexed paths.
impact_targets() src/lode/graph.py Resolves a user target to one or more nodes.
impact_report() src/lode/graph.py Returns direct callers, callees, files, entrypoints, and blast radius.
blast_radius() src/lode/graph.py Performs bounded upstream, downstream, or bidirectional BFS.

How it works

resolve_graph() loads file nodes, import bindings, local definitions, and unresolved parser facts from SQLite. It deletes old resolved edges, then writes current IMPORTS, CALLS, and EXTENDS edges with resolved confidence where a unique local target exists.

graph TD
    Parsed[(parser facts)] --> Imports[resolve imports]
    Parsed --> Calls[resolve calls]
    Parsed --> Extends[resolve inheritance]
    Imports --> Edges[(resolved edges)]
    Calls --> Edges
    Extends --> Edges
    Edges --> Impact[impact_report]
    Impact --> Blast[blast_radius]
Loading

Traversal behavior

The traversal edge kinds are CALLS, EXTENDS, HANDLES, CONTAINS, and IMPORTS. blast_radius() limits exploration with neighbor_limit, optional depth, and max_nodes, then ranks by edge confidence and distance.

Integration points

  • src/lode/indexer.py emits unresolved call and import facts.
  • src/lode/storage.py stores node and edge rows and returns direct neighbors.
  • src/lode/cli.py exposes lode impact and lode neighbors.
  • src/lode/daemon.py exposes /impact.

Entry points for modification

Change resolution rules inside resolve_target(), resolve_via_imports(), and module resolver helpers in src/lode/graph.py. When changing traversal semantics, add tests in tests/test_graph.py that assert JSON output shape and de-duplication behavior.

Key source files

File Purpose
src/lode/graph.py Import, call, inheritance, impact, and blast-radius logic.
src/lode/indexer.py Unresolved facts used by graph resolution.
src/lode/storage.py Node and edge queries.
tests/test_graph.py Graph regression tests.

Related pages

Clone this wiki locally