Normalization helpers for workflow specs compiled into IR.
Normalizes spec shapes to reduce downstream conditionals in the stepwise engine and pipeline components.
Summary
Functions
Normalizes a raw workflow spec into the internal representation (IR).
Types
@type t() :: map()
Functions
Normalizes a raw workflow spec into the internal representation (IR).
Applies the following normalizations:
- Coerces
"stepwise"string profile to:stepwiseatom - Extracts
:initial_statefrom atom or string keys - Ensures
:statesand:transitionsare maps (converts keyword lists)
This reduces downstream conditionals in engine and pipeline components.
Parameters
spec— a raw workflow specification map
Returns
- A normalized spec map (IR) with consistent atom keys.
Examples
IR.normalize(%{"profile" => "stepwise", "initial_state" => :step_one, "states" => %{}})
#=> %{profile: :stepwise, initial_state: :step_one, states: %{}, transitions: %{}, ...}