Remedies
A remedy states what happens after a breach. Each breach has a remedy, because the registrar applies a default when you write none.
remedies: on_bound_breach: { do: halt, inform: issuer } on_invariant_breach: { do: revert, inform: holder, strikes: 3 } on_assent_refused: { do: halt, inform: issuer }The three breaches
Section titled “The three breaches”| Breach | Cause | Default remedy |
|---|---|---|
on_bound_breach |
A run reaches a bound. | halt |
on_invariant_breach |
An action breaks an invariant. | inform, 3 strikes |
on_assent_refused |
A person refuses. | halt |
The actions
Section titled “The actions”| Action | Result |
|---|---|
halt |
The run stops now. |
revert |
The registrar undoes the action, and the run continues. |
inform |
The registrar tells the model which clause failed, and the run continues. |
pause |
The run stops and waits. |
escalate |
The run stops and asks a person. |
strikes
Section titled “strikes”The strikes field gives the number of breaches that the run can have before
the run stops.
remedies: on_invariant_breach: { do: inform, strikes: 3 }With strikes: 3, the registrar informs the model 3 times. At the fourth
breach, the run stops.
The strikes field applies to inform and revert, because those two
actions let the run continue. The default is 3 strikes for an invariant
breach, and 1 for a bound breach.
inform
Section titled “inform”The inform field names who gets the message.
| Value | Meaning |
|---|---|
holder |
The model that does the work. |
issuer |
The person who issued the writ. |
A message to the holder is useful. The model learns which clause it broke
and why, so the model can plan inside its limits instead of trying the same
action again.
Select a remedy
Section titled “Select a remedy”Start with the defaults. Change a remedy when the record shows a reason.
- Use
haltwhen a breach means that the writ is wrong. - Use
informwhen the model can correct itself. This is the common case for an invariant. - Use
revertwhen the action leaves the repository in a bad state. - Use
escalatewhen a person must make the decision.