Dsxir.RuntimeProgram.Validator (dsxir v0.2.0)

Copy Markdown

Three-phase semantic validator for %Dsxir.RuntimeProgram{}.

Errors from one phase do not suppress the next. Within a phase, errors accumulate across independent units (per-node, per-edge, per-guard).

  • Phase 1 (structural): unique node names, impl/signature resolvable, edge endpoints reference real nodes and fields, every program output has an inbound edge, DAG is acyclic, no required input is dangling.
  • Phase 2 (guards): per-node, parse the guard source then type-check the resulting AST against an upstream-only environment. Successful ASTs are attached to the node via Dsxir.Predicate.Source.attach_ast/2.
  • Phase 3 (types): per-edge structural type compatibility between producer and consumer fields. :any is a universal top.

On :ok the returned %RuntimeProgram{} has guard ASTs attached so the executor does not need to re-parse.

Summary

Functions

Run the three-phase validator over rp. Returns {:ok, rewritten_rp} on success (guard ASTs attached), or {:error, %Invalid.RuntimeProgram{}} carrying the accumulated errors.

Functions

validate(rp)

Run the three-phase validator over rp. Returns {:ok, rewritten_rp} on success (guard ASTs attached), or {:error, %Invalid.RuntimeProgram{}} carrying the accumulated errors.