generatedchild

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package generatedchild implements generated_child@v1, the extraction-safe materialization boundary for workflow definitions produced as typed values.

Source and graph values are bounded and processed through the ordinary compiler/validator before host authorization and immutable registration. The adapter returns only an exact-digest graph.DefinitionRef. A subsequent graph-native call node consumes that typed reference through graph.CallSpec.DefinitionInput; generated_child never mutates a bound plan or starts a child run directly.

Index

Constants

View Source
const (
	KindName    = "generated_child"
	KindVersion = "v1"

	FormatWorkflowSource MaterialFormat = "workflow_source"
	FormatGraphIR        MaterialFormat = "graph_ir"

	OutputDefinition = "definition"

	CodeInvalidInvocation = "generated_child_invalid_invocation"
	CodeValidationFailed  = "generated_child_validation_failed"
	CodePolicyDenied      = "generated_child_policy_denied"
	CodeRegistration      = "generated_child_registration_failed"
)

Variables

View Source
var (
	ErrInvalidOptions       = errors.New("invalid generated-child options")
	ErrInvalidMaterial      = errors.New("invalid generated-child material")
	ErrPolicyDenied         = errors.New("generated-child policy denied")
	ErrRegistrationConflict = errors.New("generated-child registration conflict")
)

Functions

This section is empty.

Types

type AuthorizationDecision

type AuthorizationDecision struct {
	Allow  bool   `json:"allow"`
	Code   string `json:"code"`
	Reason string `json:"reason"`
}

AuthorizationDecision is a persistence-safe closed allow/deny fact.

func (AuthorizationDecision) Validate

func (d AuthorizationDecision) Validate() error

type AuthorizationRequest

type AuthorizationRequest struct {
	Identity             stepkind.InvocationIdentity `json:"identity"`
	Definition           graph.DefinitionRef         `json:"definition"`
	NodeCount            int                         `json:"node_count"`
	EdgeCount            int                         `json:"edge_count"`
	Effects              graph.EffectSet             `json:"effects"`
	RequiredCapabilities []string                    `json:"required_capabilities,omitempty"`
	ConfigDigests        map[string]string           `json:"config_digests"`
}

AuthorizationRequest excludes source/config bytes while retaining exact immutable identity and conservative effects for host policy.

type Authorizer

type Authorizer interface {
	AuthorizeGenerated(context.Context, AuthorizationRequest) (AuthorizationDecision, error)
}

Authorizer owns namespace, trust, provenance, and definition-generation policy. It never receives the raw generated source.

type AuthorizerFunc

AuthorizerFunc adapts a function to Authorizer.

func (AuthorizerFunc) AuthorizeGenerated

func (f AuthorizerFunc) AuthorizeGenerated(ctx context.Context, request AuthorizationRequest) (AuthorizationDecision, error)

type CoreProcessor

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

CoreProcessor is the repository-native implementation of Processor.

func NewProcessor

func NewProcessor(options ProcessorOptions) *CoreProcessor

NewProcessor defensively copies collection options. Interface-backed catalogs and hooks remain host-owned immutable collaborators.

func (*CoreProcessor) ProcessGenerated

func (p *CoreProcessor) ProcessGenerated(ctx context.Context, request ProcessRequest) (ProcessedDefinition, error)

type Executor

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

func New

func New(options Options) (*Executor, error)

func Register

func Register(registry stepkind.Registry, options Options) (*Executor, error)

func (*Executor) Execute

func (*Executor) Spec

func (e *Executor) Spec() stepkind.StepKindSpec

func (*Executor) ValidateConfig

func (e *Executor) ValidateConfig(_ context.Context, config graph.Config) []diagnostic.Diagnostic

type MaterialFormat

type MaterialFormat string

MaterialFormat selects the single typed input representation.

func (MaterialFormat) Valid

func (f MaterialFormat) Valid() bool

type Options

type Options struct {
	Processor  Processor
	Authorizer Authorizer
	Registrar  Registrar
	// Resolver must load the exact registered definition through the same
	// durable resolver path later used by ordinary call execution. Publication
	// is not accepted from registrar-local or process-local state alone.
	Resolver workflowcompile.DefinitionResolver
}

Options contains every required extraction-safe collaborator.

type PolicySummary

type PolicySummary struct {
	Effects              graph.EffectSet   `json:"effects"`
	RequiredCapabilities []string          `json:"required_capabilities,omitempty"`
	ConfigDigests        map[string]string `json:"config_digests"`
}

PolicySummary is the exact validation-time union of authored declarations and frozen registered step-kind contracts. It contains digests rather than raw adapter config so authorization cannot become a generated-source oracle.

type ProcessRequest

type ProcessRequest struct {
	Format    MaterialFormat              `json:"format"`
	Value     values.Value                `json:"value"`
	Authority string                      `json:"authority"`
	Identity  stepkind.InvocationIdentity `json:"identity"`
}

ProcessRequest is the bounded, typed material handed to the core Processor. Value is defensively owned and never contains resolved secret material.

type ProcessedDefinition

type ProcessedDefinition struct {
	Definition workflowcompile.ResolvedDefinition `json:"definition"`
	Policy     PolicySummary                      `json:"policy"`
}

ProcessedDefinition keeps validation and its effective policy summary inseparable through authorization and durable registration.

type Processor

type Processor interface {
	ProcessGenerated(context.Context, ProcessRequest) (ProcessedDefinition, error)
}

Processor applies the ordinary source compiler and graph validator. It must return either diagnostics or one immutable exact-digest definition.

type ProcessorFunc

type ProcessorFunc func(context.Context, ProcessRequest) (ProcessedDefinition, error)

ProcessorFunc adapts a function to Processor.

func (ProcessorFunc) ProcessGenerated

func (f ProcessorFunc) ProcessGenerated(ctx context.Context, request ProcessRequest) (ProcessedDefinition, error)

type ProcessorOptions

type ProcessorOptions struct {
	Compile    workflowcompile.CompileOptions
	Dependency workflowcompile.DependencyOptions
	Validation workflowcompile.ValidationOptions
}

ProcessorOptions freezes the same compiler expanders and validator catalogs used by an application host. Callers must treat supplied registry/policy collaborators as immutable for the processor's lifetime.

type Registrar

type Registrar interface {
	RegisterGenerated(context.Context, RegistrationRequest) (workflowcompile.ResolvedDefinition, RegistrationOutcome, error)
}

Registrar is the host-owned durable definition publication boundary.

type RegistrarFunc

RegistrarFunc adapts a function to Registrar.

type RegistrationOutcome

type RegistrationOutcome string

RegistrationOutcome distinguishes a new immutable publication from replay.

const (
	RegistrationApplied  RegistrationOutcome = "applied"
	RegistrationReplayed RegistrationOutcome = "replayed"
)

func (RegistrationOutcome) Valid

func (o RegistrationOutcome) Valid() bool

type RegistrationRequest

type RegistrationRequest struct {
	Definition     workflowcompile.ResolvedDefinition `json:"definition"`
	Policy         PolicySummary                      `json:"policy"`
	Authorization  AuthorizationDecision              `json:"authorization"`
	IdempotencyKey string                             `json:"idempotency_key"`
}

RegistrationRequest persists one already validated and authorized immutable definition. Registrars must apply exact request-digest idempotency durably.

Jump to

Keyboard shortcuts

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