Pixir.WorkflowRun (pixir v0.1.5)

Copy Markdown View Source

In-memory ownership boundary for one Workflow execution.

A WorkflowRun owns the runtime state for one normalized Workflow graph: pending steps, active child references, completed step records, wave history, and the run start time used for Workflow-level timeouts.

This is intentionally not a durable GenServer yet. Subagents remain the execution authority, Pixir.Workflows remains the tool-facing projection, and this module does not emit replayable Workflow events. It is the first safe backend slice toward a future OTP WorkflowRun process without introducing a second source of truth.

Summary

Functions

Returns whether the Workflow-level deadline has elapsed for this run.

Builds the runtime state for one normalized Workflow.

Types

t()

@type t() :: %Pixir.WorkflowRun{
  active: map(),
  completed: map(),
  completed_order: [String.t()],
  pending: [map()],
  started_at_ms: integer(),
  wave: non_neg_integer(),
  waves: [[String.t()]],
  workflow_id: String.t()
}

Functions

deadline_exceeded?(workflow, run, now_ms \\ nil)

@spec deadline_exceeded?(map(), t(), integer() | nil) ::
  {:ok, boolean()} | {:error, map()}

Returns whether the Workflow-level deadline has elapsed for this run.

new(workflow, opts \\ [])

@spec new(
  map(),
  keyword()
) :: {:ok, t()} | {:error, map()}

Builds the runtime state for one normalized Workflow.