workflow

package
v0.3.0-dev.26 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workflow defines validated, deterministic workflow documents. It does not execute steps or install a workflow in an orchestration backend.

Index

Constants

View Source
const Version = 1

Version is the document contract version, not a runtime capability claim.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	// contains filtered or unexported fields
}

Definition is an immutable validated step graph implementing core.Document. Its JSON is an intermediate contract, NOT an xyOps event/API payload.

func New

func New(p Props) (*Definition, error)

New validates and snapshots p. All branches require success; failure routing, retries and conditional joins are deliberately outside this first contract.

func (*Definition) JSON

func (w *Definition) JSON() ([]byte, error)

JSON emits canonical data for core.App.Attach. This is definition metadata; runtime inputs, credentials, plan files and approval records are not embedded.

type Kind

type Kind string

Kind describes a step's orchestration role.

const (
	Task     Kind = "task"
	Approval Kind = "approval"
)

type Pipeline

type Pipeline struct {
	Workflow              *XyopsWorkflow
	Plan, Apply           xyops.EventRef
	OwnedPlan, OwnedApply *xyops.Event
}

Pipeline is a native workflow. Plan and Apply are references to the events its nodes run; OwnedPlan/OwnedApply are set only for events it created.

func NewPipeline

func NewPipeline(stack *core.Stack, name string, p PipelineProps) (*Pipeline, error)

NewPipeline creates a visible native graph: plan -> changes? -> manual gate -> apply. Suspend attaches at gate completion, so resume-time parameters cannot alter a process which has yet to start. Resume output and redirects are native xyOps features; deployment handlers must not trust them as deployment intent. The workflow ID and any owned event IDs are claimed app-wide: a collision with another event, workflow or pipeline in the app fails synthesis.

type PipelineProps

type PipelineProps struct {
	ID, Title, Category string
	// Executor runs the gate job and any owned steps.
	Executor        string
	Enabled         bool
	Trigger         xyops.Trigger
	Fields          []xyops.Field
	Plan, Apply     PipelineStep
	MaxRuns         int
	StepConcurrency int
	TimeoutSeconds  int
	AlertWebHook    string
}

PipelineProps defines native xyOps orchestration, not an independent approval service. xyOps permissions authorize Resume and its audit log records it. Plan must emit {"xy":1,"data":{"changes":true}} only after successful admission/planning. Apply must independently enforce pinned deployment intent, expiry, replay protection and disruption guards. A graph is not that policy.

Concurrency has three separate controls:

  • MaxRuns: concurrent runs of this workflow (including ones paused at the gate).
  • StepConcurrency: job limit on events this pipeline owns (default MaxRuns). Shared events keep the limits their owner declared.
  • Target locking (two runs mutating the same infrastructure) belongs to the handlers: the graph cannot know which runs touch the same targets.

type PipelineStep

type PipelineStep struct {
	Task  *XyopsTask
	Event *xyops.EventRef
}

PipelineStep is one handler in a pipeline: either an event this pipeline owns (Task: created as "<pipeline ID>_<step>" on Executor) or an existing event referenced by ID (Event: declared elsewhere in this app, or external). A referenced event is never created or changed by the pipeline, so several pipelines can share one event; its own concurrency limits still apply.

type Props

type Props struct {
	ID               string `json:"id"`
	ConcurrencyKey   string `json:"concurrency_key"`
	SupersedePending bool   `json:"supersede_pending"`
	Steps            []Step `json:"steps"`
}

Props defines a workflow. ConcurrencyKey identifies overlapping targets. Execution must serialize mutations for this key, not hold a lock while waiting for approval. Supersession applies only to runs not yet applying.

type Step

type Step struct {
	ID               string   `json:"id"`
	Kind             Kind     `json:"kind"`
	Needs            []string `json:"needs"`
	Handler          string   `json:"handler,omitempty"`
	TimeoutSeconds   int      `json:"timeout_seconds"`
	Mutates          bool     `json:"mutates"`
	RequiresApproval string   `json:"requires_approval,omitempty"`
	// Approvers are backend-resolved principal identifiers, not credentials.
	Approvers []string `json:"approvers,omitempty"`
}

Step is a node. All Needs must succeed before this node may execute. Handler names an implementation registered by the backend, not a shell command. Approval nodes require a human decision, never an automatically successful task.

type XyopsConnection

type XyopsConnection struct {
	ID        string `json:"id"`
	Source    string `json:"source"`
	Dest      string `json:"dest"`
	Condition string `json:"condition,omitempty"`
}

XyopsConnection preserves native routing conditions.

type XyopsManualApproval

type XyopsManualApproval struct {
	Approvers      []string `json:"approvers"`
	TimeoutSeconds int      `json:"timeout"`
}

XyopsManualApproval records a human decision bound to the complete manifest and policy. Approvers are exact xyOps usernames, not caller-supplied identities.

type XyopsNode

type XyopsNode struct {
	ID   string         `json:"id"`
	Type string         `json:"type"`
	X    int            `json:"x"`
	Y    int            `json:"y"`
	Data map[string]any `json:"data,omitempty"`
}

XyopsNode is a native xyOps node. Data is backend-owned JSON, not a CDK deployment vocabulary. Action/limit nodes attach to jobs, not sequential steps.

type XyopsPipeline

type XyopsPipeline struct {
	Run, Approve, Deny *xyops.Event
	Secrets            []*xyops.Secret
}

XyopsPipeline installs three events: execute, approve and deny. The latter two have no infrastructure/signing vault grants and cannot accept API-key or magic-link approval. Execution is a durable, bounded job, not a shell stub.

func NewXyopsPipeline

func NewXyopsPipeline(stack *core.Stack, name string, p XyopsPipelineProps) (*XyopsPipeline, error)

NewXyopsPipeline emits reviewed shell events embedding the same runtime/policy. State is private local storage on one executor; this is not a distributed lock. Every overlapping pipeline must share StateDirectory and ConcurrencyKey.

type XyopsPipelineProps

type XyopsPipelineProps struct {
	ID, Title, Category string
	Enabled             bool
	Endpoint            string
	Executor            string
	StateDirectory      string
	ConcurrencyKey      string
	SupersedePending    bool
	MaxPending          int
	Targets, AppSlots   []string
	Admission           XyopsTask
	Prepare, Deploy     []XyopsTask
	Approval            XyopsManualApproval
	Trigger             xyops.Trigger
	Fields              []xyops.Field
	// Values remain in the vault. IdentitySecret needs XYOPS_WORKFLOW_API_KEY
	// (job read access only). TaskSecrets are granted ONLY to the run event.
	IdentitySecret *xyops.SecretProps
	TaskSecrets    []xyops.SecretProps
}

XyopsPipelineProps composes one executable, single-executor delivery workflow. Admission MUST authenticate source, CI success and provenance before returning the manifest. Prepare may fetch/verify artifacts and plan; Deploy must re-plan, enforce disruption guards, apply and verify. No build runs on this executor.

type XyopsTask

type XyopsTask struct {
	ID             string `json:"id"`
	Script         string `json:"script"`
	TimeoutSeconds int    `json:"timeout"`
}

XyopsTask is a trusted control-plane handler. Scripts come from the control plane, never from application source, artifact content or request parameters. The manifest path is WORKFLOW_MANIFEST; admission reads request JSON on stdin.

type XyopsWorkflow

type XyopsWorkflow struct{ Resource *core.Resource }

XyopsWorkflow is a provider-backed workflow definition, installed when its containing stack is applied (including bootstrap). Construction never runs it.

func NewXyopsWorkflow

func NewXyopsWorkflow(stack *core.Stack, name string, p XyopsWorkflowProps) (*XyopsWorkflow, error)

NewXyopsWorkflow validates and synthesizes a native workflow resource using attributes available since provider 0.1.2-dev.8. Require xyops.Provider on stack. Native loops are allowed. Use an explicit join controller for all-of fan-in.

type XyopsWorkflowProps

type XyopsWorkflowProps struct {
	ID          string
	Title       string
	Category    string
	Enabled     bool
	Nodes       []XyopsNode
	Connections []XyopsConnection
	Triggers    []map[string]any
	Actions     []map[string]any
	Limits      []map[string]any
	Tags        []string
	Import      bool
	Params      map[string]any
	Fields      []map[string]any
	Notes       *string
	Icon        *string
}

XyopsWorkflowProps maps the existing xyops_workflow provider resource. No runtime approval or deployment-safety guarantee is inferred from a graph. Optional metadata and runtime input fields require provider 0.1.2-dev.8 or later.

Jump to

Keyboard shortcuts

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