Skip to main content

Module workflows

Module workflows 

Source
Expand description

Complete sample domains, and the pieces they share: a travel-disruption desk.

Three workflows ship with the kit and are meant to be reused by every other crate, by the examples and by integration tests:

  • trip: the disruption case of one booking, with obligations open at once, one of them per extra; a rebooking card bound to the case revision and to the quote it shows; an airline that may answer late or never, whose states are never collapsed into “done”; and a leg the domain refuses to change once the traveler asked to keep it;
  • traveler: the flat onboarding slice, where deleting is destructive and a new email is a sensitive change behind a review card, and where one field is three-valued (untouched, answered, declined) because a two-valued field cannot tell “we have not asked” from “they said no”;
  • claim: a receipt arrives, values are read from it and held as a proposal, and a review card turns the proposal into state: the worked recipe for proposed values awaiting review, which is domain state rather than framework vocabulary.

All three render a receipt for a ReceiptEvent::Redacted, because a turn that quietly drops one reads as a turn in which nothing happened. The copy says the least any of them could honestly say: the step is on record, its detail was erased. The receipt still cites the event, so it still passes the claim guard, which tests/claim_guard.rs pins.

Each implements PureWorkflow, so the same pure apply drives the InMemoryExecutor of the integration tests and the WorkflowModel of exploration.

Modules§

claim
The receipt-claim sample: proposed values awaiting review, done with what already exists.
traveler
The traveler sample: the flat onboarding slice.
trip
The trip sample: the disruption case of one booking.

Structs§

Applied
The state and the events one command produced.
InMemoryExecutor
An in-memory WorkflowExecutor for any PureWorkflow.

Traits§

PureWorkflow
A workflow whose transitions are one pure function.

Functions§

simulate
Turns PureWorkflow::apply into a SimulatedTransition, so a model only has to describe its initial states and candidate commands.