Skip to main content

Module step

Module step 

Source
Expand description

The durable step primitive and its typestate.

A step is the unit of durable progress: DurableContext::step runs an operation closure, journals its result, and on a later resume returns the journaled result instead of re-running the closure. This module defines the types that describe and carry a step:

  • StepDescriptor — the what of a step: its name, EffectClass, ambiguity policy, and an opaque operation fingerprint. Its constructors enforce the construction-time ambiguity rule (FR-DE-09): a destructive, security-relevant, money-moving, or custom guarded step that omits an OnAmbiguous policy is rejected with DurableError::AmbiguityPolicyRequired.
  • StepHandle — handed to the operation closure so it can forward the step’s IdempotencyKey to an external service as an Idempotency-Key header for boundary dedup.
  • StepError — the closure’s failure channel: any error type the closure produces is wrapped here without coupling the Layer-0 crate to a consumer’s error enum (INV-1).
  • StepOutcome — the Live / Replayed typestate that lets a consumer suppress already-emitted side effects (e.g. re-printing assistant output) on replay.
  • DurableStep — the recorded result of a step: its id, idempotency key, and outcome.

The payload codec is JSON: a step value is serialized to bytes, length-checked, then handed to the journal where the backend AEAD-seals it. The bytes are opaque to the journal — the durable layer never inspects a domain type (INV-1).

Structs§

DurableStep
The recorded result of a DurableContext::step call.
StepDescriptor
The description of a step: its identity, effect contract, and ambiguity policy.
StepError
The error channel for a step’s operation closure.
StepHandle
A handle passed to a step’s operation closure.

Enums§

StepOutcome
Whether a step’s value came from a live run or from the journal.