Expand description
Graph-native predicate evaluation.
This module provides graph-native predicate evaluation for queries against
CodeGraph, bypassing the legacy index path.
§Design (v6 - CodeGraph-Native Query Executor)
Key semantics preserved from the legacy index path:
name:usessegments_matchfor qualified name suffix matchingkind:,lang:,visibility:,scope.*are case-sensitiveimports:per-node — matches a node iff its own outgoingImportsedge target/alias/wildcard matches, or it is anImportnode whose text matches. Aligned withsqry-db::queries::ImportsQueryper the Phase N “Unified Surface Contract” (planner-IR is canonical, all transports mirror it). The previous file-scoped semantic was retired in DB15 to remove the cross-engine divergence flagged by Codex’s DB14 review.references:includesReferences+Calls+Imports+FfiCalledgescallers:checks OUTGOING edges (find nodes that call X)callees:checks INCOMING edges (find nodes called by X)- Relation predicates use
segments_matchfor qualified names
§returns: evaluation
returns:<TypeName> is evaluated edge-based, mirroring the planner’s
node_returns_type (see sqry_db::planner::execute::node_returns_type):
the candidate node’s outgoing edges are scanned for
EdgeKind::TypeOf { context: Some(TypeOfContext::Return), .. }, and the
target node’s interned primary name is byte-exact-compared (case-sensitive)
to the predicate value. Substring/regex semantics are out of scope and may
land later as a distinct returns~ operator. The legacy
NodeEntry.signature.contains(...) substring path was retired in favour of
this contract because it produced false positives whenever the requested
type name occurred anywhere in the function signature text.
§Limitations (v1)
The following predicates are NOT SUPPORTED in graph backend v1:
- Plugin fields - requires metadata
HashMapnot inNodeEntry - Numeric operators - requires metadata values
Supported boolean predicates: async:true, static:true
Structs§
- Graph
Eval Context - Context for graph-native predicate evaluation.
- Join
Eval Result - Result of a join evaluation including truncation metadata.
Functions§
- entry_
query_ texts - Collects every string form that can satisfy a name query for the given
node entry: the interned name, the qualified name, and (when a language
is recorded) the display-qualified name produced by
display_graph_qualified_name. Duplicates are dropped so that relation matchers do not re-check equivalent forms. - evaluate_
all - Evaluates query against all nodes, returning matching
NodeIds. - evaluate_
join - Evaluate a join expression, returning matched (left, right) node pairs.
- evaluate_
node - Evaluates a single node against an expression.
- evaluate_
subquery - Evaluate an expression against all nodes and return the set of matching node IDs.
- extract_
method_ name - Extract the method name from a qualified name.
e.g., “
Player::takeDamage” -> Some(“takeDamage”) e.g., “takeDamage” -> None (no separator, not qualified) - import_
edge_ matches - Returns
truewhen the givenImportsedge imports something matchingtarget_module, checking the target node text, the edge’s alias, and the wildcard flag. Shared withcrate::graph::unified::concurrent::GraphSnapshotconsumers (includingsqry-db::queries::relation) that need the same semantics as the graph-nativeimports:predicate. - import_
entry_ matches - Matches an Import/candidate node entry against a target module using
the shared
imports:substring + canonicalization semantics. - import_
text_ matches - Substring-based text match for
imports:semantics, with language-aware canonicalization fallback when the file’s language maps the input module path into graph-internal::form. - language_
aware_ segments_ match - Segment-aware name equality with a language-specific canonicalization
fallback. First tries a direct
segments_match; if that fails, the file’s language (if any) is consulted to canonicalizeexpectedinto graph-internal::form before retrying.