Skip to main content

Module validate

Module validate 

Source
Expand description

Publish-time / load-time validation — the gate that keeps a bad document from ever becoming a live phone line (doc 48). The platform runs the same checks before publish (packages/flow-schema/src/validate.ts); the daemon re-runs them on load so a corrupted cache or a version mismatch fails safe rather than executing undefined behavior. Every rule here has a TypeScript twin, and both are pinned by the shared conformance corpus.

Structural guarantees enforced here: the schema version is one this engine runs; every exit is wired to an existing node and matches the node’s exit set; every node is reachable from entry; no caller can be trapped — every reachable node can reach a terminal; prompt-length and menu/hours sanity caps. All errors are collected (not fail-fast) so the editor can show every problem at once.

Enums§

ValidationError
One thing wrong with a flow document. Carries enough context (node id, exit name, offending value) for the editor to point at it.

Functions§

validate
Validate a parsed flow. Ok(()) means safe to publish / execute; Err carries every problem found.