Skip to main content

Module graph_eval

Module graph_eval 

Source
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: uses segments_match for qualified name suffix matching
  • kind:, lang:, visibility:, scope.* are case-sensitive
  • imports: per-node — matches a node iff its own outgoing Imports edge target/alias/wildcard matches, or it is an Import node whose text matches. Aligned with sqry-db::queries::ImportsQuery per 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: includes References + Calls + Imports + FfiCall edges
  • callers: checks OUTGOING edges (find nodes that call X)
  • callees: checks INCOMING edges (find nodes called by X)
  • Relation predicates use segments_match for qualified names

§Limitations (v1)

The following predicates are NOT SUPPORTED in graph backend v1:

  • returns: - requires signature parsing/metadata not in NodeEntry
  • Plugin fields - requires metadata HashMap not in NodeEntry
  • Numeric operators - requires metadata values

Supported boolean predicates: async:true, static:true

Structs§

GraphEvalContext
Context for graph-native predicate evaluation.
JoinEvalResult
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 true when the given Imports edge imports something matching target_module, checking the target node text, the edge’s alias, and the wildcard flag. Shared with crate::graph::unified::concurrent::GraphSnapshot consumers (including sqry-db::queries::relation) that need the same semantics as the graph-native imports: 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 canonicalize expected into graph-internal :: form before retrying.