Documentation
¶
Overview ¶
Package rerun starts immutable child runs that replay a verified source attempt.
Index ¶
- Variables
- func SourceAttemptSHA256(source SourceAttempt) string
- type ChildPublicationContext
- type ChildReplay
- type ChildReplayExecutor
- type ChildReplayResult
- type ChildRunIssuer
- type Config
- type ExactInput
- type Parameter
- type PromptManifest
- type ReplayMode
- type Request
- type Result
- type Service
- type SourceAttempt
- type SourceReader
- type Target
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidRequest identifies an invalid rerun request. ErrInvalidRequest = errors.New("invalid rerun request") // ErrSourceCorrupt identifies a source whose immutable replay material is not intact. ErrSourceCorrupt = errors.New("corrupt rerun source") // ErrSourceMutated identifies a source changed while its child was started. ErrSourceMutated = errors.New("rerun source mutated") // ErrInvalidChild identifies a replay executor result that violates child invariants. ErrInvalidChild = errors.New("invalid rerun child") )
Functions ¶
func SourceAttemptSHA256 ¶
func SourceAttemptSHA256(source SourceAttempt) string
SourceAttemptSHA256 returns the domain-separated digest adapters must bind to verified immutable source-attempt material. ImmutableSHA256 itself is excluded.
Types ¶
type ChildPublicationContext ¶
type ChildPublicationContext struct {
SessionID domain.SessionID
ParentRunID domain.RunID
SourceRunID domain.RunID
SourceReviewID domain.ReviewID
SourceAttemptID domain.AttemptID
SourceManifestURI string
SourceManifestSHA256 string
ReplayMode ReplayMode
}
ChildPublicationContext binds a new child publication to the immutable source authority. The executor must preserve every field in its result.
type ChildReplay ¶
type ChildReplay struct {
SessionID domain.SessionID
ParentRunID domain.RunID
SourceRunID domain.RunID
SourceReviewID domain.ReviewID
SourceAttemptID domain.AttemptID
Mode ReplayMode
Target Target
Scope string
Role string
Publication ChildPublicationContext
Run domain.Run
Assignments []review.Assignment
// Exact is populated only for exact replay. It deliberately includes the
// original adapter profile and parameters, plus source prompt authority.
Exact *ExactInput
}
ChildReplay contains defensive copies of verified source authority and a freshly constructed lineage/publication context for one child execution.
type ChildReplayExecutor ¶
type ChildReplayExecutor interface {
ExecuteChildReplay(context.Context, ChildReplay) (ChildReplayResult, error)
}
ChildReplayExecutor creates and executes a child replay. A successful result must contain a new run and execution identity in the source session.
type ChildReplayResult ¶
type ChildReplayResult struct {
SessionID domain.SessionID
RunID domain.RunID
ParentRunID domain.RunID
SourceRunID domain.RunID
SourceReviewID domain.ReviewID
SourceAttemptID domain.AttemptID
ExecutionInvocationID string
PromptIdentity string
PromptManifestURI string
PromptManifestSHA256 string
ReplayMode ReplayMode
ExactReplay bool
// contains filtered or unexported fields
}
ChildReplayResult is the child identity, persisted prompt-manifest view, and verified P2 terminal exit decision.
func NewChildReplayResult ¶
func NewChildReplayResult(sessionID domain.SessionID, runID, parentRunID, sourceRunID domain.RunID, sourceReviewID domain.ReviewID, sourceAttemptID domain.AttemptID, executionInvocationID, promptIdentity, promptManifestURI, promptManifestSHA256 string, replayMode ReplayMode, exactReplay bool, terminalExit domain.OperationalExitDecision) (ChildReplayResult, error)
NewChildReplayResult validates and binds the verified P2 terminal exit to one published rerun child.
func (ChildReplayResult) TerminalExit ¶
func (result ChildReplayResult) TerminalExit() (domain.OperationalExitDecision, bool)
TerminalExit returns the immutable, verified P2 terminal exit decision.
func (ChildReplayResult) ValidateTerminalExit ¶
func (result ChildReplayResult) ValidateTerminalExit() error
ValidateTerminalExit rejects results without a verified committed terminal exit.
type ChildRunIssuer ¶
ChildRunIssuer issues only fresh child run identities.
type Config ¶
type Config struct {
Clock ports.Clock
IDs ChildRunIssuer
Assignments []review.Assignment
}
Config is the required authority used to construct rerun children.
type ExactInput ¶
type ExactInput struct {
ComposedStdin []byte
ComposedStdinSHA256 string
CompleteStdinSHA256 string
SourceInvocationID string
SourceExecutionInvocationID string
TemplateID string
TemplateVersion string
TemplateSHA256 string
AdapterProfile string
SourceProviderInstance string
Parameters []Parameter
SourceManifestURI string
SourceManifestSHA256 string
}
ExactInput is the exact replay-only provider wire contract.
type PromptManifest ¶
type PromptManifest struct {
URI string
SHA256 string
ComposedStdin []byte
ComposedStdinSHA256 string
CompleteStdinSHA256 string
SourceInvocationID string
ExecutionInvocationID string
TemplateID string
TemplateVersion string
TemplateSHA256 string
AdapterProfile string
Parameters []Parameter
Scope string
Role string
}
PromptManifest is the verified source prompt material needed for exact replay. Source manifest identity binds the child prompt to its authority.
type ReplayMode ¶
type ReplayMode string
ReplayMode controls whether source provider wire bytes are replayed or a new prompt is composed from current trusted configuration.
const ( ExactReplay ReplayMode = "exact" RecomposeReplay ReplayMode = "recompose" )
func (ReplayMode) Valid ¶
func (mode ReplayMode) Valid() bool
type Request ¶
type Request struct {
SourceRunID domain.RunID
SourceAttemptID domain.AttemptID
ReplayMode ReplayMode
}
Request identifies the immutable source attempt to rerun.
type Result ¶
type Result struct {
SessionID domain.SessionID
RunID domain.RunID
PromptManifestURI string
// contains filtered or unexported fields
}
Result is the bounded application result exposed to command wiring, including the verified P2 terminal exit decision.
func NewResult ¶
func NewResult(sessionID domain.SessionID, runID domain.RunID, promptManifestURI string, terminalExit domain.OperationalExitDecision) (Result, error)
NewResult validates and binds the verified P2 terminal exit to the bounded rerun application result.
func (Result) TerminalExit ¶
func (result Result) TerminalExit() (domain.OperationalExitDecision, bool)
TerminalExit returns the immutable, verified P2 terminal exit decision.
func (Result) ValidateTerminalExit ¶
ValidateTerminalExit rejects results without a verified committed terminal exit.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service starts child replay runs from verified, immutable attempt material.
func NewService ¶
func NewService(sources SourceReader, executor ChildReplayExecutor, config Config) (*Service, error)
NewService constructs a rerun service with the authority to read verified sources and execute fresh child runs.
func (*Service) StartRerun ¶
StartRerun reads one immutable source attempt and executes it as a distinct child run. Once a valid child result is returned, the committed effect is never retried; source re-observation continues without caller cancellation so late cancellation cannot hide that effect.
type SourceAttempt ¶
type SourceAttempt struct {
SessionID domain.SessionID
RunID domain.RunID
ReviewID domain.ReviewID
AttemptID domain.AttemptID
ProviderInstance string
Target Target
Prompt PromptManifest
ImmutableSHA256 string
}
SourceAttempt is a verified immutable source attempt. ImmutableSHA256 must change whenever any source bytes or replay-relevant identity changes.
type SourceReader ¶
type SourceReader interface {
ReadRerunSource(context.Context, domain.RunID, domain.AttemptID) (SourceAttempt, error)
}
SourceReader is the narrow authority for verified source attempt, target, and prompt-manifest reads. Implementations must reject non-P2 sources.