Skip to main content

Module graph

Module graph 

Source
Expand description

Graph persistence layer using sqlitegraph

§Position Conventions

Symbol and reference spans in the graph use tree-sitter position conventions:

  • Line positions: 1-indexed (line 1 is the first line)
  • Column positions: 0-indexed (column 0 is the first character in a line)
  • Byte offsets: 0-indexed from file start (byte 0 is the first byte)

See MANUAL.md for detailed documentation.

§:memory: Database Limitation

CodeGraph uses SQLite Shared connections via sqlitegraph and opens a separate shared connection for ChunkStore. These Shared connections don’t work with :memory: databases because each thread would get its own separate in-memory database instance.

Workaround: Use file-based databases for CodeGraph operations. See MANUAL.md for details.

Re-exports§

pub use metrics::BackfillResult;
pub use algorithms::CondensationGraph;
pub use algorithms::CondensationResult;
pub use algorithms::Cycle;
pub use algorithms::CycleKind;
pub use algorithms::CycleReport;
pub use algorithms::DeadSymbol;
pub use algorithms::ExecutionPath;
pub use algorithms::PathEnumerationResult;
pub use algorithms::PathStatistics;
pub use algorithms::ProgramSlice;
pub use algorithms::SliceDirection;
pub use algorithms::SliceResult;
pub use algorithms::SliceStatistics;
pub use algorithms::Supernode;
pub use algorithms::SymbolInfo;
pub use export::ExportConfig;
pub use export::ExportFormat;

Modules§

algorithms
Graph algorithms for code analysis
ambiguity
Ambiguity tracking for CodeGraph
canonical_fqn
Fully-Qualified Name builder for canonical and display FQN computation
crate_name
Crate name detection for Rust projects
export
Export functionality for CodeGraph
filter
File filtering for gitignore-style rules and CLI include/exclude globs.
metrics
Metrics operations for CodeGraph
query
Query operations for CodeGraph
scan
Directory scanning operations for CodeGraph
test_helpers
Test-only helpers for delete operation testing.
validation
Graph validation module

Structs§

AstNode
AST node extracted from source code
AstNodeWithText
AST node with optional source text snippet
CacheStats
Cache statistics for monitoring effectiveness
CallNode
Call node payload stored in sqlitegraph
CodeGraph
Graph database wrapper for Magellan
DeleteResult
Deletion statistics returned by delete_file_facts()
FileNode
File node payload stored in sqlitegraph
FreshnessStatus
Freshness status of the database
ReferenceNode
Reference node payload stored in sqlitegraph
SymbolNode
Symbol node payload stored in sqlitegraph

Enums§

ReconcileOutcome
Deterministic reconcile outcome.

Constants§

MAGELLAN_SCHEMA_VERSION
Magellan-owned schema version for side tables (e.g. magellan_meta).
STALE_THRESHOLD_SECS
Staleness threshold in seconds (5 minutes)

Functions§

check_freshness
Check database freshness
ensure_ast_schema
Ensure ast_nodes table exists for Phase 36
extract_ast_nodes
Extract AST nodes from a tree-sitter tree
generate_symbol_id
Generate a stable symbol ID from (language, fqn, span_id)
is_structural_kind
Check if a node kind is a structural node (should be stored)
language_from_path
Detect the programming language from a file extension
normalize_node_kind
Normalize a tree-sitter node kind to a language-agnostic kind

Type Aliases§

ScanProgress
Progress callback for scan_directory