Skip to content

Operations reference

All types are exported from @cratis/arc.core; the assertions come from @cratis/arc.testing.

MemberRequiredMeaning
execute(signal, ...dependencies)YesPerform the effect; may return a promise
compensate(failure, signal, ...dependencies)NoUndo the effect after a known uncommitted failure
executeDependenciesNoTokens resolved and passed to execute, in order
compensateDependenciesNoTokens resolved and passed to compensate, in order

operations(first, second, ...) creates an explicit CommandOperations batch. Return operations from handle(), alone or inside tuple(...).

Extends CommandExecutionScope (begin, complete) with:

MemberMeaning
isCommitParticipanttrue for the one scope that commits business changes; false promises the scope commits nothing
getCommitDisposition(context)The authoritative CommandCommitDisposition, also after complete() throws
ValueMeaningCompensation
NoCommitNo participant commits business changesAttempted
NotCommittedThe participant knows nothing committedAttempted
CommittedThe participant committedSuppressed
UnknownThe participant cannot tellNot attempted; recovery is indeterminate
MixedSome changes committed and some did notNot attempted; recovery is indeterminate
FieldMeaning
commitDispositionThe CommandCommitDisposition Arc used
statusCommandRecoveryStatus: NotNeeded, Completed, Incomplete, Suppressed, or Indeterminate
startedCountOperations entered
completedCountOperations whose execute finished
compensatedCountCompensations that finished
failedCompensationCountCompensations that threw
uncompensatedCountEntered operations left without completed compensation

CommandOperationOutcome (result.operationOutcomes)

Section titled “CommandOperationOutcome (result.operationOutcomes)”
FieldMeaning
invocationIndexPosition in the executed order
operationTypeThe operation class name
executionCompletedWhether execute finished
compensationCommandOperationCompensation: NotNeeded, Completed, Failed, NotAvailable, BudgetExpired, or Suppressed
compensationFailureA description when compensation failed

recovery and operationOutcomes are available on direct-call results only; they are never serialized to HTTP JSON.

CommandOperationFailure.source is a CommandOperationFailureSource (ResponseHandling, Execution, Cancellation, or ScopeCompletion). It describes where the original failure occurred; the failure snapshot is passed to compensators only.

OptionDefaultMeaning
commandCompensationTimeoutMs30000Shared cooperative budget for all compensation in one command

CommandScenario results offer:

AssertionPasses when
shouldHaveExecutedOperation(Type)An operation of that type finished execute
shouldHaveCompensatedOperation(Type)An operation of that type finished compensate
shouldHaveNoOperationInvocations()No operation was entered, not even partially
shouldHaveIndeterminateRecovery()The recovery status is Indeterminate, as after an Unknown or Mixed disposition

These inspect real pipeline observations, not simulated work. See Testing commands.