Mobus.Stepwise.IR (mobus_stepwise v0.2.0)

Copy Markdown View Source

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

t()

@type t() :: map()

Functions

normalize(spec)

@spec normalize(map()) :: t()

Normalizes a raw workflow spec into the internal representation (IR).

Applies the following normalizations:

  • Coerces "stepwise" string profile to :stepwise atom
  • Extracts :initial_state from atom or string keys
  • Ensures :states and :transitions are 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: %{}, ...}