emit_terminal

Function emit_terminal 

Source
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:

  • CompletedEvent::SagaCompleted + log state completed.
  • Compensated { reason }Event::SagaFailed { reason } + log state compensated.
  • Failed { reason }Event::SagaFailed { reason } + log state failed.

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.