compensate_unresolved_launcher_sagas

Function compensate_unresolved_launcher_sagas 

Source
pub async fn compensate_unresolved_launcher_sagas(
    saga_log: &Arc<LauncherSagaLog>,
) -> Result<usize, String>
Expand description

Walk all unresolved sagas in the durable log and mark each as failed_compensation. Returns the count of sagas touched.

Errors propagate from LauncherSagaLog::unresolved_sagas (read failure: corrupt SQLite, schema mismatch). The caller (main.rs) treats a walker failure as non-fatal — the launcher logs a WARN and continues. Rationale: the saga log is open (open() succeeded), so the schema is intact; a transient SELECT failure is best-surfaced as a launcher-log warning so the saga coordinator still spawns. Prior crashed sagas stay in running for one more restart cycle in that case (and get cleaned up next time). (reagent P2 PR #647 round 1: doc/contract sync.)

Per-saga mark_failed_compensation failures are logged but NOT fatal — the walker continues to subsequent sagas. Stopping on one row’s write failure would leave later unresolved sagas in running when we could have cleaned them. Operators see the per-saga error in the launcher log.