Skip to main content

Module property_graph

Module property_graph 

Source
Expand description

Property Graph Engine — SQLite-backed code knowledge graph.

Stores nodes (File, Symbol, Module) and edges (imports, calls, defines, exports) extracted by deep_queries + import_resolver. Provides efficient traversal queries for impact analysis, architecture discovery, and graph-driven context loading.

Re-exports§

pub use file_catalog::FileCatalogEntry;
pub use node::Node;
pub use node::NodeKind;
pub use semantic_cache::CachedResolution;

Modules§

file_catalog
node
Node types and CRUD operations for graph nodes.
semantic_cache
Persistent cache of semantic-backend answers, keyed by call site.
snapshot
Versioned, committable graph snapshots — Context-as-Code (GL#451).

Structs§

CodeGraph
DependencyChain
Edge
GraphQuery
ImpactResult
PropertyGraphMetaV1
StoredCounts
Row counts of a persisted graph, read for status reporting only.

Enums§

EdgeKind

Constants§

GRAPH_ENGINE_VERSION
Property-graph engine generation. Bump whenever edge extraction changes (e.g. the type_ref edges that connect C#/Java same-namespace consumers to their definers, GH #398) so an existing graph built by an older engine is transparently rebuilt on the next query instead of being served without the new edges. Graphs whose graph.meta.json predates this stamp deserialize to engine version 0, so the first query after an upgrade rebuilds once.

Traits§

GraphSource
A graph store as a whole-graph computation reads it — a ranking, a community detection, a rule scan: the rows, and the serve-time source check that decides which of them exist for the computation (G04).

Functions§

edge_weight
Weight multiplier per edge kind for impact scoring.
engine_outdated
true when the persisted graph was built by another engine generation than GRAPH_ENGINE_VERSION — older, NEWER, or before the version stamp existed (missing or unreadable meta) — and must therefore be rebuilt before its edges can be trusted. A newer stamp is what an installation finds after a rollback to an earlier release: that graph holds edges this engine’s rules did not produce and cannot interpret, so it is rebuilt, not read. Callers pair this with a node-count check: an empty graph is rebuilt regardless; a non-empty graph of another generation is rebuilt by this gate.
file_connectivity
Graph connectivity stats for a file: incoming/outgoing edge counts by kind.
graph_dir
Resolve the directory for graph.db and graph.meta.json.
load_meta
meta_path
mirror_index
Reliable, reusable PG build entry (#682.2): open the project’s graph store, populate_from_project_index from index, and stamp graph.meta.json.
parse_symbol_metadata
Inverse of symbol_metadata: recover the source kind and exported flag from a symbol node’s metadata JSON. The property-graph Node only models a coarse NodeKind, so the precise graph_index kind (function, struct, …) and export flag live in this metadata blob — the provider facade must read them back to surface a lossless symbol (#696 C1). Returns (None, None) for absent/malformed metadata so callers can fall back.
populate_from_project_index
Mirror index into graph: file nodes + file catalog, symbol nodes (with line spans + kind/export metadata), and structural edges. Clears the code graph first (preserving provider cross-source edges) so the result is a faithful 1:1 representation of the index.
related_files
Related files for a given path: direct neighbors via any structural edge, sorted by edge weight (strongest relationship first). Returns (path, weight) pairs.
stored_counts
What project_root’s persisted graph holds, without serving anything from it (#2179). Status readers (doctor, index status) used to rebuild the whole index through the serving surface just to count its files — a source check per catalogued file — and to open the store through CodeGraph::open, which migrates and creates schema. This opens the existing graph.db only (never creates it), reads no schema it would change (query_only), and waits at most STORED_COUNTS_BUSY for a lock another process holds: None when there is no graph, its schema is not this engine’s, or it stays busy.
write_meta

Type Aliases§

Served
The serve-time source check of one request, as a traversal takes it: whether the file at a repo-relative path may be used now. One request has one such check, so the walk and the caller’s output filter agree.