workflows

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package workflows hosts the deterministic go-workflows workflow code for the durable shadow pilot (Phase 3). Workflow code must stay deterministic: no time.Now, no randomness, no I/O, no goroutines, no map-iteration-order leaks. All side effects run inside activities.

The shared DTOs (AutomationRunWorkflowInput, ShadowRunTrace) are defined in the activities package - the WriteShadowComparison activity consumes the trace, so workflows imports activities (the one clean direction, no import cycle) and re-exports the names via type aliases.

Index

Constants

This section is empty.

Variables

View Source
var ErrChainShadowOnlyRequired = errors.New("durable chain shadow workflow requires shadow_only=true")
View Source
var ErrShadowOnlyRequired = errors.New("durable shadow workflow requires shadow_only=true")

ErrShadowOnlyRequired rejects non-shadow execution: Phase 3 may observe only, never execute real runs.

Functions

This section is empty.

Types

type AutomationRunWorkflowInput

type AutomationRunWorkflowInput = activities.AutomationRunWorkflowInput

AutomationRunWorkflowInput is the metadata-only workflow input. See the activities package for the definition.

type ChainShadowTrace

type ChainShadowTrace = activities.ChainShadowTrace

func MiviaWorkflowChainShadowWorkflow

func MiviaWorkflowChainShadowWorkflow(ctx workflow.Context, input ChainShadowWorkflowInput) (ChainShadowTrace, error)

MiviaWorkflowChainShadowWorkflow is the Phase 5 multi-workflow chain shadow. It drives the current services only through activities/ports and records bounded metadata. Stage N+1 cannot compile until stage N reaches done. Comparison always runs last.

type ChainShadowWorkflowInput

type ChainShadowWorkflowInput = activities.ChainShadowWorkflowInput

type ExecutionTrace

type ExecutionTrace = activities.ExecutionTrace

ExecutionTrace is the bounded, safe workflow result. See the activities package for the definition.

func MiviaAutomationRunTestExecutionWorkflow

func MiviaAutomationRunTestExecutionWorkflow(ctx workflow.Context, input TestExecutionWorkflowInput) (ExecutionTrace, error)

MiviaAutomationRunTestExecutionWorkflow is the Phase 4 test-only execution workflow. It is deterministic and follows the same rules as the Phase 3 shadow workflow: no wall clock, no randomness, no I/O in workflow code; all side effects live in activities.

Sequence: load snapshot -> claim run (activity) -> complete attempt (activity) -> observe review queue -> observe verifier state -> write execution comparison.

Step semantics (mirroring Phase 3):

  • A step that classifies BLOCKED does not short-circuit: the trace keeps observing so the full picture is captured.
  • A step that FAILS (activity error or unsafe metadata) short-circuits the remaining steps, which are appended as skipped.
  • WriteExecutionComparison ALWAYS runs last, even after a failure.
  • FinalStatus mirrors the most recent snapshot run status ("unknown" when the load failed); FailureCategory is the first non-none category any step produced.
  • Synthetic (workflow-built) step results carry a zero CompletedAt: workflow code must not read the wall clock.
  • The attempt outcome is NOT pre-validated in workflow code beyond pure ref checks on the run ref: the fail-closed unsafe-ref gate lives in the CompleteRunAttempt activity, BEFORE the completion port is invoked, so the guard is exercised end-to-end.

type ShadowRunTrace

type ShadowRunTrace = activities.ShadowRunTrace

ShadowRunTrace is the bounded, safe workflow result. See the activities package for the definition.

func MiviaAutomationRunShadowWorkflow

func MiviaAutomationRunShadowWorkflow(ctx workflow.Context, input AutomationRunWorkflowInput) (ShadowRunTrace, error)

MiviaAutomationRunShadowWorkflow is the Phase 3 shadow workflow. It is observe-only and deterministic. Sequence: load snapshot -> validate executable -> observe work task (only when a task id is present) -> observe codex attempt -> observe governed closeout -> observe review queue -> observe verifier state -> write shadow comparison.

Step semantics (documented decisions):

  • A step that classifies BLOCKED does not short-circuit: shadow mode keeps observing so the trace captures the full picture (the spec allows but does not require skipping after blocked).
  • A step that FAILS (activity error or unsafe metadata) short-circuits the remaining observe steps, which are appended as skipped.
  • WriteShadowComparison ALWAYS runs last, even after a failure.
  • FinalStatus mirrors the snapshot run status ("unknown" when the load failed); FailureCategory is the first non-none category any step set.
  • Synthetic (workflow-built) skipped/failed step results carry a zero CompletedAt: workflow code must not read the wall clock.

type StageTraceEntry

type StageTraceEntry = activities.StageTraceEntry

type TestExecutionWorkflowInput

type TestExecutionWorkflowInput = activities.TestExecutionWorkflowInput

TestExecutionWorkflowInput is the metadata-only workflow input. See the activities package for the definition.

Jump to

Keyboard shortcuts

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