Resume
The first persistent-resume slice makes the durable event trail sufficient to reconstruct run progress after a restart.
Journaling the run
Section titled “Journaling the run”soma_run:init/1 journals the run into run.started as
#{steps, run_options}, where run_options is an allowlist of resume-safe
metadata: run_id, an optional session_id, and an optional correlation_id.
It never journals process-local values (session_pid, the event store, pids,
monitor refs, timers, OS pids) or secrets.
Reconstructing progress
Section titled “Reconstructing progress”soma_run_resume:reconstruct/2 reads soma_event_store:by_run/2 and rebuilds
#{run_id, steps, run_options, outputs, next_step, terminal_status}:
- committed
step.succeededoutputs keyed by step id; - the first uncommitted journal step as
next_step— a progress marker, not a resume permission; - the terminal status (
completed/failed/timeout/cancelled, elseundefined) when a terminal event is present.
%% Pure read: reconstruct progress, never start or mutate a run.{ok, Progress} = soma_run_resume:reconstruct(Store, RunId).It rejects a trail with no usable run.started journal
({error, no_run_started_journal}) or one whose committed step id is absent
from the journal ({error, {unknown_committed_step, _}}), and is strictly
side-effect-free — it never appends events and never starts a run child.