Mental model
Automatic recovery is not a “retry kind.” It does not create a corrective run. When budgets are exhausted, the document becomes a system error and support uses a fresh corrective plan.
Evidence before mutation
Lambda treats the original CargoWise capture as immutable accounting evidence. The invoice row is Lambda’s current claim. Before a corrective retry mutates anything, the system asks:- Is this document already successful, cancelled, in flight, or waiting on a parent?
- Does policy allow a stamp retry for the active classification?
- Can we resume the exact stored attempt, or must we reprocess from the original capture?
- For failed documents: is there proof the fiscal projection changed, or that an approved prerequisite was corrected?
Preview, then apply
Corrective retries are plan-bound:- Preview recomputes what would happen and returns a deterministic plan hash.
- Apply recomputes under lock and only proceeds if that exact hash still matches.
- A private reason is stored on the ops run. It is not copied into customer notifications.
Strategies in one line
- Resume attempt — continue the exact stored Facturapi request and idempotency key.
- Reprocess source — remap the original capture with current Lambda code and create one new attempt only when the prior create never produced a provider invoice.
Who owns what during recovery
Stamp success and CargoWise delivery stay separate. Delivery retries never re-stamp.