interp

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package interp is the provider-independent DAG interpreter core. It is the single source of truth for the runtime semantics of a Plan — which steps are ready, how approval gates hold, and how failure propagates — so the Step Functions and Temporal providers cannot drift from each other. It contains no orchestration-engine or I/O code: Advance is a pure function of the Plan and the current State.

Semantics

  • A step is ready when every step in its DependsOn has succeeded, it is not already running or finished, and (if it is a Gate) it has been approved.
  • A Gate step whose dependencies have succeeded but which has not been approved is "awaiting approval"; the run stays RUNNING until an approval arrives (or the run is cancelled).
  • Failure is fail-soft: a failed step blocks only its transitive dependents; independent branches continue to completion. The run ends FAILED if any step failed, otherwise SUCCEEDED. It is the Plan author's responsibility to add a dependency edge wherever a step must not run after another's failure.
  • Cancellation is terminal immediately: Advance reports CANCELLED and no further steps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision struct {
	// Ready lists step IDs that should be dispatched to the executor now,
	// sorted by ID for determinism (required so the same decision replays
	// identically inside a Temporal workflow).
	Ready []string
	// AwaitingApproval lists Gate step IDs whose dependencies are satisfied
	// but which have not yet been approved, sorted by ID.
	AwaitingApproval []string
	// Terminal is the run's terminal status, or "" if the run is still in
	// progress.
	Terminal omniworkflow.RunStatus
}

Decision is the interpreter's verdict for one Advance call.

func Advance

func Advance(plan omniworkflow.Plan, st State) Decision

Advance computes, from the Plan and the current State, which steps are ready to dispatch, which gates are awaiting approval, and whether the run has reached a terminal status. It is pure: it never mutates its arguments and its output depends only on its inputs.

type State

type State struct {
	Succeeded map[string]bool
	Failed    map[string]bool
	Running   map[string]bool
	Approved  map[string]bool // gate step IDs that have received approval
	Cancelled bool
}

State is the observed execution state of a run: which steps have reached each outcome, which gate steps have been approved, and whether the run was cancelled. The driver (a provider's worker or workflow) owns and mutates it; Advance only reads it. The maps must be non-nil; use NewState.

func NewState

func NewState() State

NewState returns a State with all maps initialized and nothing recorded.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL