Skip to main content

Module validate

Module validate 

Source
Expand description

Validation — spec §5 (V1-V9) + §5.8 (modes).

validate is the single entry point. Walking the AST bottom-up, every variant’s V-axiom checks fire; any failure produces a typed ValidationError. Degenerate-but-defined compositions emit a ValidationWarning in Permissive mode and become hard errors in Strict mode.

V4 (per-strategy input-shape contract) fires in two tiers per spec §10.7.8:

  1. Compile-time best-effort — this module, when a caller runs validate on the AST, against the AST’s static metadata-derived IndexFn; catches shape violations the static estimate can prove. For crate::iteration::comprehension::eval_source::EvalClass::Static sources the static IndexFn equals the runtime IndexFn, so this fire is exact; for ContextRequired sources (Generator without registry recognition, WorkloadParamList) the static estimate may be conservative (uses cardinality_hint, or None if absent) and the strategy-invocation-time fire below is load-bearing.
  2. Strategy-invocation-time (load-bearing)crate::iteration::comprehension::runtime::evaluate_for_iteration’s apply_order fires crate::iteration::comprehension::strategies::Strategy::accepts_input against the crate::iteration::comprehension::eval_source::EvaluatedSource’s actual index_fn after source evaluation. This is the definitive V4 check per spec §10.7.8.

Structs§

ValidationReport
Result of a validation pass.

Enums§

Mode
Validation mode per spec §5.8.
ValidationError
V-axiom violation. Each variant carries enough context to produce a useful diagnostic at the call site.
ValidationWarning
Non-blocking warning for degenerate-but-defined compositions per spec §5.8.

Functions§

validate
Validate a comprehension AST per spec §5.