Saga

/saga Tier 2

Distributed-transaction coordinator with LIFO compensating rollback. Each step has Do + Undo. If a mandatory step fails, all prior Undo functions run in reverse order under an uncanceled context. Optional steps may fail without aborting the saga.

step 1reservestep 2chargestep 3 ✗ship FAILstep 4notifyskippedundo 2refundundo 1releaseRollback context: context.WithoutCancel(ctx)Compensating transactions complete even if caller cancelledUndo failures logged via slog, do NOT stop the chain

Signature

action contract
action.NewSaga[Req, Res](name string) *SagaBuilder[Req, Res]