Substrate-neutral operational projection of one durable run.
Operational health lives outside Docket.Run: the run document describes
graph execution, while this projection adds what the backend knows about
scheduling and delivery health. Backends return it from inspect_run; it
never exposes the claim token.
Fields:
run- the last committedDocket.Run.wake_at- when the run next advances autonomously: a past-or-present instant means runnable, a future instant means a timer or retry backoff, andnilmeans claimed, externally parked, poisoned, or terminal.claimed_at- when the current execution claim was acquired or last refreshed, ornilwhen unclaimed.claim_attempts- consecutive claims consumed by launched execution without committed progress; resets to zero on any committed run mutation, and a pre-execution claim abandon hands its acquisition increment back.claim_abandons- consecutive pre-execution claim abandons without committed progress; a sustained count signals work this deployment cannot yet execute (typically graph compilation incompatibility). Resets to zero on any committed run mutation and on poison recovery.poisoned_at/poison_reason- paired poison facts, bothnilfor a healthy run. A poisoned run is excluded from dispatch until an operator (orretry_poisoned_run) recovers it.
inspect_run
inspect_run(run_id, opts) is the operational read: it returns
{:ok, %Docket.RunInfo{}} for the committed run plus the fields above, or
{:error, :not_found} for an unknown or out-of-scope run. fetch_run
remains the committed run-document read and returns only the Docket.Run.
await_run
await_run(run_id, opts) blocks until the run reaches a terminal status,
parks waiting on input, becomes poisoned, or the required :timeout
elapses - whichever comes first:
- terminal or waiting:
{:ok, %Docket.Run{}}as of that boundary - poisoned:
{:error, {:poisoned, %Docket.RunInfo{}}}- the typed operational halt. Awaiting stops as soon as poison facts are present rather than polling until timeout, because a poisoned run makes no autonomous progress until it is recovered. - timeout:
{:error, :timeout}
Summary
Functions
Builds a projection from a map or keyword list, validating field shapes.
Returns true when the projection carries current poison facts.
Types
@type await_halt() :: {:poisoned, t()}
Typed operational halt returned by a poisoned await_run.
@type t() :: %Docket.RunInfo{ claim_abandons: non_neg_integer(), claim_attempts: non_neg_integer(), claimed_at: DateTime.t() | nil, poison_reason: String.t() | nil, poisoned_at: DateTime.t() | nil, run: Docket.Run.t(), wake_at: DateTime.t() | nil }
Functions
Builds a projection from a map or keyword list, validating field shapes.
Requires :run; poisoned_at and poison_reason must be present
together. Raises ArgumentError on malformed input.
Returns true when the projection carries current poison facts.