followup

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package followup starts one immutable, finding-scoped child workflow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildExecutor

type ChildExecutor interface {
	ExecuteFollowup(context.Context, Execution) (ExecutionResult, error)
}

ChildExecutor creates and publishes one new child run. It must not mutate the source.

type CurrentTarget

type CurrentTarget struct {
	Identity        domain.TargetIdentity
	Bytes           []byte
	CapturedArchive []byte
}

CurrentTarget is the freshly captured immutable target and its exact bytes.

type CurrentTargetCapturer

type CurrentTargetCapturer interface {
	CaptureFollowupTarget(context.Context, Target) (CurrentTarget, error)
}

CurrentTargetCapturer captures the selected current target before child execution. It has no source-write authority.

type Error

type Error struct {
	Kind  ErrorKind
	Stage string
	Err   error
}

Error retains a machine-readable failure class and the underlying cause.

func (*Error) Error

func (err *Error) Error() string

func (*Error) Unwrap

func (err *Error) Unwrap() error

type ErrorKind

type ErrorKind string

ErrorKind classifies fail-closed workflow failures without lending provider output authority over source or evidence state.

const (
	ErrorInvalidRequest ErrorKind = "invalid_request"
	ErrorSource         ErrorKind = "source"
	ErrorMutation       ErrorKind = "source_mutation"
	ErrorCancellation   ErrorKind = "cancelled"
	ErrorExecution      ErrorKind = "execution"
	ErrorInvariant      ErrorKind = "invariant"
)

type Execution

type Execution struct {
	SessionID domain.SessionID
	Source    VerifiedSource
	Current   CurrentTarget
	Objective string
	Role      *domain.Role
}

Execution contains only the immutable source/current material an executor needs to create and publish a fresh child run.

type ExecutionResult

type ExecutionResult struct {
	SessionID           domain.SessionID
	RunID               domain.RunID
	FollowupArtifactURI string
	ValidatedOutput     validation.ValidatedFollowup
	// contains filtered or unexported fields
}

ExecutionResult identifies one published child run, its validator-owned followup material, and its verified P2 terminal exit decision.

func NewExecutionResult

func NewExecutionResult(sessionID domain.SessionID, runID domain.RunID, followupArtifactURI string, validatedOutput validation.ValidatedFollowup, terminalExit domain.OperationalExitDecision) (ExecutionResult, error)

NewExecutionResult validates and binds the verified P2 terminal exit to one published followup child run.

func (ExecutionResult) TerminalExit

func (result ExecutionResult) TerminalExit() (domain.OperationalExitDecision, bool)

TerminalExit returns the immutable, verified P2 terminal exit decision.

func (ExecutionResult) ValidateTerminalExit

func (result ExecutionResult) ValidateTerminalExit() error

ValidateTerminalExit rejects results without a verified committed terminal exit.

type Request

type Request struct {
	SourceRunID domain.RunID
	FindingID   string
	Target      Target
	Objective   *string
	Role        *domain.Role
}

Request selects exactly one finding from a committed source run.

type Result

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

Result is the immutable caller-owned projection of a started followup.

func NewResult

func NewResult(sessionID domain.SessionID, runID domain.RunID, followupArtifactURI string, validatedOutput validation.ValidatedFollowup, terminalExit domain.OperationalExitDecision) (Result, error)

NewResult validates and binds the verified P2 terminal exit to the bounded followup application result.

func (Result) FollowupArtifactURI

func (result Result) FollowupArtifactURI() string

func (Result) RunID

func (result Result) RunID() domain.RunID

func (Result) SessionID

func (result Result) SessionID() domain.SessionID

func (Result) TerminalExit

func (result Result) TerminalExit() (domain.OperationalExitDecision, bool)

TerminalExit returns the immutable, verified P2 terminal exit decision.

func (Result) ValidateTerminalExit

func (result Result) ValidateTerminalExit() error

ValidateTerminalExit rejects results without a verified committed terminal exit.

func (Result) ValidatedOutput

func (result Result) ValidatedOutput() validation.ValidatedFollowup

type Service

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

Service starts immutable, finding-scoped child workflows.

func NewService

func NewService(sources SourceReader, capturer CurrentTargetCapturer, executor ChildExecutor) (*Service, error)

NewService constructs a followup service with the narrow authorities needed to read a committed source, capture a current target, and publish a child.

func (*Service) StartFollowupRun

func (service *Service) StartFollowupRun(ctx context.Context, request Request) (Result, error)

StartFollowupRun reads a verified source finding, captures a fresh target, and creates one distinct child run. Before publication it honors cancellation. Once the child executor returns a valid committed result, it does not retry; it independently re-observes the source with cancellation detached so a late caller cancellation cannot obscure the committed effect.

type SourceFinding

type SourceFinding struct {
	ID         string
	Role       domain.Role
	Normalized []byte
	Excerpt    []byte
}

SourceFinding is the normalized, run-scoped finding used to focus the child.

type SourceReader

type SourceReader interface {
	ReadFollowupSource(context.Context, domain.RunID, string) (VerifiedSource, error)
}

SourceReader reads one validated P2 source and its run-scoped finding.

type SourceReceipt

type SourceReceipt struct {
	FinalSHA256    string
	ManifestSHA256 string
	FindingSHA256  string
	ExcerptSHA256  string
}

SourceReceipt binds every source byte read by this workflow. The values are SHA-256 digests of exact source final, manifest, finding, and excerpt bytes.

type Target

type Target struct {
	Kind  TargetKind
	Value string
}

Target is untrusted current-target input. Capture binds it to immutable bytes.

type TargetKind

type TargetKind string

TargetKind is the literal target selector accepted by a followup request.

const (
	TargetWorkspace TargetKind = "workspace"
	TargetStage     TargetKind = "stage"
	TargetDirty     TargetKind = "dirty"
	TargetDiff      TargetKind = "diff"
	TargetPatch     TargetKind = "patch"
	TargetStdin     TargetKind = "stdin"
)

type VerifiedSource

type VerifiedSource struct {
	P2Verified       bool
	ProviderInstance string
	SessionID        domain.SessionID
	RunID            domain.RunID
	ReviewID         domain.ReviewID
	Target           domain.TargetIdentity
	Finding          SourceFinding
	Final            []byte
	Manifest         []byte
	Receipt          SourceReceipt
}

VerifiedSource is a P2-authoritative source view. SourceReader must expose only verified data; Service verifies its identity and byte receipts again.

Jump to

Keyboard shortcuts

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