14.1 The flow
Describe (self)
┌────┐
▼ │
start ──► Draft ──┴────┴──Send──► Checking ──the return is accepted──► Accepted
│
├──the return is refused──► Refused
│
└──it cannot be checked, or is called off──► UncheckedA customer starts a return, says which order and why (Describe, which stays in Draft), and
sends it (Send). A return with no reason is refused with the reason, and stays a draft. A sent
return is Checking: it runs a train, ReturnOrder, on the worker, as checkout's Placing runs
PlaceOrder, and the train's answer moves it on. An order that is the customer's own is accepted.
One that is not, or an id that names no order, is refused.
Only the customer acts on a return, and only on their own. Staff do nothing to it here: one person acting on another's instance is something the features cannot say yet, and the tools refuse a feature that tries.
| You write | Trax writes from it |
|---|---|
features/returns.feature, the scenarios | machines/from-features/order-return.ir.json: the states, the moves, the guard and its message, the train's outcomes |
features/returns.lexicon, what the words mean | machines/from-features/host.json: who may start, send and read a return, which train Checking runs, the view, and which scenario each part came from |
Shopfront.Core/Trains/ReturnOrder/, the train | machines/from-features/access.txt: every grant, one line each, to review |
machines/from-features/glossary.json: the lexicon with everything it leaves to a rule filled in |
The IR is the same portable definition trax machine generate wrote for checkout in chapter 12.
The host file is what only the server reads, so access never ships to a client.
SDK Reference
Write machines as features | Feature files | Feature machines | Feature bindings | AddStateMachines | Views root | trax CLI
Next: 14.2 The lexicon