A compensating action is a business operation that “undoes” a previous step (e.g., cancel a reservation after payment fails). It’s tricky because it’s not a real rollback: it can fail, it may not perfectly restore the previous state, and it must be idempotent and well-observed.
Expanding on the short answer — what usually matters in practice:
A tiny example (an explanation template):
// Example: discuss trade-offs for "in-a-saga,-what-is-a-compensating-action-and-why"
function explain() {
// Start from the core idea:
// A compensating action is a business operation that “undoes” a previous step (e.g., cancel
}