SquidMesh.Workflow.Validation (squid_mesh v0.1.0-alpha.5)

Copy Markdown View Source

Compile-time validation and normalization for workflow modules.

This module keeps contract enforcement in one place so the DSL in SquidMesh.Workflow can remain compact and declarative.

Summary

Functions

Derives workflow retry declarations from per-step retry configuration.

Returns the single workflow entry step for transition-based workflows.

Returns the workflow entry steps or raises when the workflow declaration does not define a valid entry set.

Returns the first step to schedule for runtime dispatch.

Converts trigger declarations into the normalized runtime trigger shape.

Validates a compiled workflow definition and raises a compile error when the declaration is invalid.

Returns the canonical workflow payload contract derived from the trigger set.

Functions

derive_retries(steps)

@spec derive_retries([map()]) :: [map()]

Derives workflow retry declarations from per-step retry configuration.

entry_step!(definition, env)

@spec entry_step!(map(), Macro.Env.t()) :: atom() | nil

Returns the single workflow entry step for transition-based workflows.

Dependency-based workflows return nil because they may declare multiple root steps instead of one singular entry step.

entry_steps!(definition, env)

@spec entry_steps!(map(), Macro.Env.t()) :: [atom()]

Returns the workflow entry steps or raises when the workflow declaration does not define a valid entry set.

initial_step!(definition, env)

@spec initial_step!(map(), Macro.Env.t()) :: atom()

Returns the first step to schedule for runtime dispatch.

normalize_triggers!(definition)

@spec normalize_triggers!(map()) :: [map()]

Converts trigger declarations into the normalized runtime trigger shape.

validate!(definition, env)

@spec validate!(map(), Macro.Env.t()) :: :ok

Validates a compiled workflow definition and raises a compile error when the declaration is invalid.

workflow_payload!(triggers)

@spec workflow_payload!([map()]) :: [map()]

Returns the canonical workflow payload contract derived from the trigger set.