Expand description
AST validation per ADR-008 §Validation Rules.
validate normalises an AST in place and rejects queries that violate the
closed edge ontology or attempt to subvert namespace scoping:
- Edge relations must parse to one of the 13 canonical
EdgeRelationvariants (ADR-002). Aliases and case differences are normalised to the canonical snake_case form stored in the database. Applies to edge patterns andWHERE e.relation = '…'constraints. - Node kinds pass through unchanged — the query layer is pack-agnostic (ADR-025). Kind validation is the responsibility of the service boundary, not the query compiler.
- Namespace scoping is a trusted parameter only. Queries must not name
namespacein node property maps orWHEREconditions — the only valid source of namespace filtering isCompileOptions::scopes. This matches ADR-008 §Validation: “never trust query strings to set namespaces.” - Traversal depth is capped at
MAX_DEPTH(10 hops). Requests above the cap are clamped, not rejected — this matches the cap the compiler applies when generating recursive CTEs.
Constants§
- MAX_
DEPTH - Maximum traversal depth allowed by the query layer (ADR-008 §Validation).
Functions§
- validate
- Validate and normalise an AST in place.
- validate_
with_ warnings - Validate and normalise an AST in place, returning any warnings generated.