Forma Orchestrator: durability and recovery
Recovery is where coordinators earn their honesty. The v0.1 law starts from one admission: a restored state creates no new facts. Restart creates no new semantic identity; the checkpoint references journal positions instead of replacing them; a recovered operational state implies nothing about observed external effects; a stale writer cannot recover authority by replay; recovery without demonstrable exclusivity fails closed; and corrupt or incomplete data gets no optimistic defaults. Everything in this chapter is those seven invariants, made operational.
What is durable, and how it is published
The control state is a directory of small, canonically encoded records alongside the
C1 plane’s own persistence: checkpoint.tsv (the coalescing map plus a __fence
publication marker — a checkpoint without it is corruption, because recovering it as
“nothing ever dispatched” would lawfully re-drive every lane), roster.json and
rollout.json (each stamped with the generation it was published under),
composition.json (additive: absence means the deployment never coordinated a
distributed realization), and the plane’s snapshot, digest and writer-fence records.
Publication is one inter-process critical section: acquire the publication lock; verify the held fence is still the durable generation; persist the C1 snapshot first, propagating its error; stage every record to temporary files; then win the writer-token CAS against the recorded generation — the winner adopts and mints the next generation, the loser discards its staged bytes and publishes nothing; fsync and rename each record; and re-check currency after the renames, because a second coordinator can claim the next generation inside the CAS-to-rename window — a takeover there is typed and reported, never a silent success over a state another generation now owns. A rename-phase failure after a won CAS leaves the instance current (it adopted the minted generation) and free to retry lawfully; a genuinely superseded instance refuses every later publication until a lawful re-claim.
Two design consequences are worth saying aloud. The records carry the generation they were published under, so a torn publication — one rename landed, another did not — is detected at recovery (the roster and rollout records disagree about their generation) and refused as typed corruption, never silently mixed. And both records lagging the fence by one failed publication is recoverable by design: they are the last mutually coherent published state, re-stamped by the next successful publication.
Restart is reopen, not rebirth
A recovering coordinator does not “open fresh and hydrate”. It reopens the C1
plane from the durable snapshot, restoring the exact request, operation and attempt
identities of the previous generation — restore, never mint, never discard. This is
what makes late evidence adjudicable: an attempt that was uncertain before the crash
is still uncertain after it, with its exact coordinates intact, so a late
executor receipt can be admitted by those coordinates rather than by generation
bookkeeping. The recovered set of uncertain operations is rebuilt from the reopened
views (reconciliation-required and in-flight attempts survive restart); the
coalescing checkpoint is hydrated; the roster and rollout records are re-read, with
the durable record — not the activating designation — authoritative. Missing or
malformed records are typed ControlStateCorrupt per record; an empty designated
state is typed ControlStateLost. The recovery CLI path never provisions: a lost
state routes through the controlled roster procedure as an explicit operator act.
The five cases, each with its own law
The contract’s transit law exists because these cases are not the same, and each maps to a different operator response:
| Case | What is true | What the mechanism may do | What it must never do |
|---|---|---|---|
| Prepared, not yet authorized | nothing crossed | §13 cancellation, CANCELLED_NOT_EXPOSED | treat as exposed |
| Authorized, not exposed | permit single-use, D4 frozen | cancel while unconsumed | re-present a consumed permit |
| Sent, answer lost in transit | exposure may have occurred | record OUTCOME_UNCERTAIN, reconcile with admitted evidence | re-drive; read silence as “not applied” |
| Message arrives after a generation change | in-flight validity is C1’s question | C1-law adjudication by exact coordinates and idempotency | discard by generation; re-authorize by fence |
| Duplicate or late acknowledgement | replay conditions | replay settlement, zero state change | second exposure without its own permit |
The scope walls on the fence deserve their own line, because they are the most over-read guarantee in systems like this: write exclusivity is not proof of non-occurrence; a lost ack is not proof of non-execution; a new fence is not a new dispatch authority; a restart is not a new semantic world. Fence acquisition establishes publication exclusivity over the designated control state — nothing else. It never re-authorizes an operation whose outcome is uncertain: those remain reconciliation-gated regardless of who holds the fence. Resumption extends only to operations whose C1 state is definite and whose decisions revalidate against the current desired revision.
The recovery procedure, concretely
For an operator holding a refused cycle exit, the procedure is short and typed:
- Exit 5 (persistence error) — the cycle’s dispatches happened; only the
durable publication failed. Fix the publication cause (the typed detail names the
failed stage:
checkpoint write,roster record rename,fence superseded…), then run the nextcycle: activation reopens the state — mutually coherent lagging records are re-stamped — and the loop continues. Do not re-provision; do not expect the failed cycle’s checkpoint entries to exist (their absence is why the affected lanes re-evaluate lawfully). - Exit 4 with
ControlStateCorrupt— the typed detail names the record. A torn publication between the roster and rollout records, an unparsable checkpoint, or a malformed composition record each fail closed; the state is not silently rebuilt. Recovery is an explicit, journaled operator act under the roster procedure — never a parallel state. - Exit 4 with
ControlStateLost— the designated root no longer holds a state. The instance refused to present itself as a first deployment; restoring the state is the controlled procedure’s problem, and the refusal record inactivation-refusalsis the evidence of what happened. - Exit 3 (uncertainty) — nothing to restart: an uncertain operation is not re-driven by any cycle. The remedy is admitted evidence — a governed C2 observation reconciles the attempt, and only an admitted record whose referent is not conflict-shadowed can do it. A transport receipt is not automatically evidence; silence is never evidence.
A last word on scope: local durability is the proven envelope. The control state is an application-level composition above C1, owning its own law, and its persistence runs through the canonical storage plane for the MVCC/ACID envelope claim. Distributed durability of the control state is future work and is not claimed — no high-availability or exactly-once promise extends beyond what the witnesses actually demonstrate.