Durable description of one node execution attempt.
Task state appears in event payloads, checkpoint metadata, and — while a
superstep is parked between attempts — in Docket.Run.active_tasks. An
active entry pins the activation identity for the next attempt: the stable
task_id, the attempt number to execute, the committed state snapshot and
source versions the superstep planned against, and every prior failed
attempt. Re-executing from this state preserves the task and idempotency
identity of the superstep that parked it.
Summary
Functions
Builds the idempotency key for one attempt of a task.
Hashes a committed state snapshot into the activation's input identity.
Builds the stable task identity for one node execution in one superstep.
Types
@type failure() :: %{attempt: pos_integer(), reason: String.t()}
One durably recorded failed attempt: the attempt number and reason text.
@type t() :: %Docket.Run.TaskState{ attempt: pos_integer(), deadline_at: DateTime.t() | nil, failures: [failure()], idempotency_key: String.t() | nil, input_hash: String.t() | nil, metadata: map(), node_id: String.t(), snapshot: map() | nil, source_versions: %{optional(String.t()) => non_neg_integer()} | nil, started_at: DateTime.t() | nil, status: atom() | nil, step: non_neg_integer(), task_id: String.t() }
Functions
@spec idempotency_key(String.t(), pos_integer()) :: String.t()
Builds the idempotency key for one attempt of a task.
Hashes a committed state snapshot into the activation's input identity.
The hash is over deterministic external term format bytes, so equal durable snapshots hash equally regardless of map insertion order.
@spec task_id(String.t(), non_neg_integer(), String.t()) :: String.t()
Builds the stable task identity for one node execution in one superstep.
The same committed run always yields the same task ID, so a superstep that never commits re-plans with byte-identical identities.