pub async fn emit_terminal(
state: &AppState,
saga_id: u64,
terminal: SagaTerminal<'_>,
)Expand description
Emit the saga’s terminal lifecycle event + durable log row.
Maps SagaTerminal to:
Completed→Event::SagaCompleted+ log statecompleted.Compensated { reason }→Event::SagaFailed { reason }+ log statecompensated.Failed { reason }→Event::SagaFailed { reason }+ log statefailed.
The renderer-facing event is the same SagaFailed for both
non-success paths (the renderer doesn’t currently distinguish).
The durable log distinguishes — PR 2’s resume scan picks up
failed rows where compensation may not have run.