Skip to main content
The program field of an operation defines its explicit control flow as an ordered block of steps. Every step in the program describes a causal action — running a transaction, executing an effect, making a decision — and every reachable path through the program ends at an explicit terminal. There are no loops; the program structure is acyclic by construction. A retry traverses the same declared control from the first step. What the retry re-encounters at each transaction or effect step is judged by the replay and idempotency rules the verifier applies to that step.

Program structure

The program is a nested block of OperationStep values. Decision steps — match_result and branch — each open two sub-blocks (arms), and the verifier analyzes every path through the complete tree.

Step kinds

transaction

Executes, or resolves the prior keyed commit of, an operation-owned transaction.
For a transaction with idempotency: { kind: deduplicated_by, key: ... }, if a prior Commit(T,K) exists for the same evaluated key, this step resolves that commit and restores all artifacts it retained — transaction outputs and effect intents — without executing the transaction body again. For a transaction without a keyed commit, the body executes.
Id
required
The ID of the transaction to run. Must be declared in the operation’s transactions map.

execute_effect

Constructs one instance of an operation-owned effect and executes it directly.
Id
required
The ID of the effect to execute. Must be declared in the operation’s effects map.
Derivation
required
Declares the provenance of the complete outgoing effect payload. Either kind: unspecified (unknown provenance, declared explicitly) or kind: deterministic with a from list of value references. See Value References.
Id
Binds the effect’s synchronous result under this ID. Only valid for result-bearing effects (request and external effects with a declared result). Publications have no result and must not declare one. Omit when you deliberately ignore the result.
The derivation is evaluated in the operation-level value context. It may not reference transaction_read results, which are local to the transaction that produced them.

execute_effect_intent

Executes an already-established effect intent. The values were fixed when the intent was established; this step runs that fixed instance without recomputing anything.
Id
required
The ID of the effect intent to execute. Must be declared in the operation’s effect_intents map and be definitely available at this program point — established or recovered on every path reaching here.
Id
Optional result binding, following the same rules as for execute_effect.

match_result

Destructures a bound effect result into its ok and err arms. Use this step to branch on the outcome of a request or external effect; do not use branch for this purpose.
Id
required
The result binding to destructure. Must be bound by an execute_effect or execute_effect_intent step on every path reaching this step.
OperationBlock
required
The block to execute when the result is Ok. Inside this block, effect_result_ok:<result> is available as a value source.
OperationBlock
required
The block to execute when the result is Err. Inside this block, effect_result_err:<result> is available as a value source.
The match is exhaustive and mutually exclusive. Both arms must be declared, though either may be empty. Variant payloads are arm-local: effect_result_ok and effect_result_err do not survive the join after the match. If data from the result must be available after the match, export it through a transaction output inside the arm.
Use match_result only for destructuring a synchronous effect result. Use branch for ordinary value comparisons. The two step kinds are not interchangeable.

branch

An ordinary control decision over modeled values. Executes the then block when the condition holds; optionally executes the otherwise block when it does not.
Condition
required
The predicate to evaluate. One of four forms — see Conditions below.
OperationBlock
required
The block to execute when the condition holds.
OperationBlock
The block to execute when the condition does not hold. If absent, the branch falls through to the following step. A branch without otherwise does not terminate its path — the validation rule requires every reachable path to end at a terminal.

Conditions

eq, and, and not are deterministic functions of their references. unspecified is never deterministic. A condition is deterministic only when every component is — a single unspecified anywhere in an and or not makes the whole condition unspecified. For eq, the equals field accepts either a plain scalar literal or a value reference map:

return

Terminates a request-driven execution by constructing the named request input’s declared result. Only valid for operations with a request input; subscription-driven operations use complete.
Id
required
The operation-owned request input whose result contract to return. Must be a kind: request input.
string
required
Either ok (constructs the input’s ok schema payload) or err (constructs the err schema payload).
Derivation
required
Provenance of the result payload. Use kind: unspecified when provenance is unknown; never omit this field.

complete

Terminates an execution that returns nothing. Natural for subscription-driven operations.
complete takes no parameters. Every reachable path in a subscription-driven operation must end at a complete step.

Validation rules

The verifier enforces these structural rules before any replay analysis:
  1. Every reachable path ends at a terminal. A return or complete must be reachable from every branch. A branch without otherwise is not a valid terminal for its path.
  2. No step follows a terminal. Steps after return or complete in the same block are unreachable and reported as errors.
  3. Transaction artifacts are definitely available. A transaction output or effect intent may only be consumed at a program point where a transaction on every path reaching that point has established or recovered it.
  4. Result bindings are definitely assigned. A result binding may only be matched or referenced where an effect-executing step has bound it on every path reaching that point.
  5. Variant scope is respected. effect_result_ok:<r> is valid only inside the ok arm of a match_result on r; effect_result_err:<r> only inside the err arm.
  6. Return targets request inputs. return.request must name a kind: request input of the operation.

Step location notation

Steps carry no IDs. Diagnostics, proofs, and the visualizer identify steps by their location: a dot-separated sequence of one-based positions and arm names. When a proof or an obstacle is reported at a location, the same location notation appears in the JSON report’s evidence and summary fields and in the visualization.

Decision replay

When the verifier analyzes idempotency or result-replay requirements, it must establish that every decision on the path replays — that every attempt in the same logical class takes the same arm. A decision replays when:
  • for branch: the condition is deterministic (no unspecified anywhere) and every value reference it observes is replay-stable, or
  • for match_result: the matched result is replay-stable.
If a decision cannot be established to replay, the verifier reports it as an obstacle. This means a retry might take a different arm, doing different work on repeated attempts. It is not proof that the decision is wrong — it is an honest gap in the model’s declared facts.

Complete example: transcode operation

The following program from the video streaming fixture shows both a match_result decision and three transactions used across the two arms:

Effects

How to declare the effects that program steps execute

Value References

How to write values derivations and condition roots in program steps