SquidMesh.Runtime.StepExecutor (squid_mesh v0.1.0-alpha.6)

Copy Markdown View Source

Executes one workflow step through Jido and persists the outcome.

This module is the runtime boundary where declarative workflow definitions are turned into durable step execution and persisted run progress.

Summary

Types

execution_error()

@type execution_error() ::
  :not_found
  | {:invalid_workflow, module() | String.t()}
  | {:invalid_step, atom() | String.t() | nil}
  | {:dispatch_failed, term()}
  | {:invalid_run, Ecto.Changeset.t()}
  | {:invalid_transition, SquidMesh.Run.status(), SquidMesh.Run.status()}
  | {:invalid_compensation_run_status, SquidMesh.Run.status()}
  | {:unknown_transition, atom(), atom()}
  | {:unknown_step, atom()}
  | {:missing_config, [atom()]}

expected_step()

@type expected_step() :: atom() | String.t() | nil

Functions

compensate(run_id, overrides \\ [])

@spec compensate(
  Ecto.UUID.t(),
  keyword()
) :: :ok | {:error, execution_error() | term()}

Executes pending compensation for a failed run.

Compensation jobs are separate from step execution jobs so the failed run and failed step attempt are durable before rollback side effects start. If a compensation callback fails, the run remains failed and its last_error is updated with the compensation failure details for inspection.

execute(run_id, expected_step \\ nil, overrides \\ [])

@spec execute(Ecto.UUID.t(), expected_step(), keyword()) ::
  :ok | {:error, execution_error() | term()}