bundle

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SafetyDecisionWarn = "warn"
	SafetyDecisionStop = "stop"

	SafetyRuleRepeatedRootFailure = "repeated_root_failure"
	SafetyRuleGoalDrift           = "goal_drift"
	SafetyRuleTestWeakening       = "test_weakening"
	SafetyRuleDependencyChange    = "dependency_change"
	SafetyRuleSuspiciousPathEdit  = "suspicious_path_edit"
)
View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func GoalContractWarnings

func GoalContractWarnings(goal project.Goal, input GoalCheckInput) []string

func RootErrorFingerprint

func RootErrorFingerprint(message string) string

func WriteFailureBundle

func WriteFailureBundle(run project.Run, bundle FailureBundle) error

func WriteNormalizedEvidence

func WriteNormalizedEvidence(run project.Run, normalized NormalizedEvidence) error

Types

type Artifact

type Artifact struct {
	Name string `yaml:"name"`
	Path string `yaml:"path"`
}

type AttemptContext

type AttemptContext struct {
	SameRootErrorSeenBefore bool  `yaml:"same_root_error_seen_before"`
	MatchingAttemptNumbers  []int `yaml:"matching_attempt_numbers,omitempty"`
}

type BudgetMetadata

type BudgetMetadata struct {
	RawEvidenceBytes        int64 `yaml:"raw_evidence_bytes"`
	IncludedExcerptBytes    int64 `yaml:"included_excerpt_bytes"`
	RepeatedBlocksCollapsed int   `yaml:"repeated_blocks_collapsed"`
	EstimatedPromptBytes    int64 `yaml:"estimated_prompt_bytes"`
}

type ChangedFile

type ChangedFile struct {
	Path string
	Diff string
}

type Compiler

type Compiler struct {
	Now    func() time.Time
	Safety project.SafetyConfig
}

func (Compiler) Compile

func (c Compiler) Compile(run project.Run, goal project.Goal, normalized NormalizedEvidence) (FailureBundle, error)

type EvidenceSource

type EvidenceSource struct {
	Source       string `yaml:"source"`
	Provider     string `yaml:"provider,omitempty"`
	ProviderKind string `yaml:"provider_kind,omitempty"`
	Path         string `yaml:"path"`
	Job          string `yaml:"job,omitempty"`
	JobID        int64  `yaml:"job_id,omitempty"`
}

type FailureBundle

type FailureBundle struct {
	Version             int              `yaml:"version"`
	GeneratedAt         time.Time        `yaml:"generated_at"`
	Run                 RunMetadata      `yaml:"run"`
	Goal                GoalContract     `yaml:"goal"`
	Sources             []EvidenceSource `yaml:"sources"`
	AttemptContext      AttemptContext   `yaml:"attempt_context"`
	Budget              BudgetMetadata   `yaml:"budget"`
	RootErrorCandidates []Signal         `yaml:"root_error_candidates"`
	DownstreamSymptoms  []Signal         `yaml:"downstream_symptoms,omitempty"`
	SafetyFindings      []SafetyFinding  `yaml:"safety_findings,omitempty"`
	Artifacts           []Artifact       `yaml:"artifacts"`
	Warnings            []string         `yaml:"warnings,omitempty"`
}

func ReadFailureBundle

func ReadFailureBundle(run project.Run) (FailureBundle, error)

type GoalCheckInput

type GoalCheckInput struct {
	Signals     []Signal
	EditedPaths []string
}

type GoalContract

type GoalContract struct {
	Goal            string   `yaml:"goal"`
	NonGoals        []string `yaml:"non_goals,omitempty"`
	MustPreserve    []string `yaml:"must_preserve,omitempty"`
	DoneConditions  []string `yaml:"done_conditions,omitempty"`
	ExpectedPaths   []string `yaml:"expected_paths,omitempty"`
	SuspiciousPaths []string `yaml:"suspicious_paths,omitempty"`
	StopRules       []string `yaml:"stop_rules,omitempty"`
}

type NormalizedEvidence

type NormalizedEvidence struct {
	Version     int              `yaml:"version"`
	GeneratedAt time.Time        `yaml:"generated_at"`
	Run         RunMetadata      `yaml:"run"`
	Sources     []EvidenceSource `yaml:"sources"`
	Signals     []Signal         `yaml:"signals"`
	Warnings    []string         `yaml:"warnings,omitempty"`
}

func ReadNormalizedEvidence

func ReadNormalizedEvidence(run project.Run) (NormalizedEvidence, error)

type Normalizer

type Normalizer struct {
	Now func() time.Time
}

func (Normalizer) NormalizeRun

func (n Normalizer) NormalizeRun(run project.Run) (NormalizedEvidence, error)

type RunMetadata

type RunMetadata struct {
	Source      string `yaml:"source"`
	Repository  string `yaml:"repository,omitempty"`
	RunID       string `yaml:"run_id,omitempty"`
	CollectedAt string `yaml:"collected_at,omitempty"`
}

type SafetyEngine

type SafetyEngine struct {
	Config project.SafetyConfig
}

func (SafetyEngine) Evaluate

func (e SafetyEngine) Evaluate(input SafetyInput) []SafetyFinding

type SafetyFinding

type SafetyFinding struct {
	Rule     string `yaml:"rule"`
	Decision string `yaml:"decision"`
	Message  string `yaml:"message"`
	Path     string `yaml:"path,omitempty"`
}

type SafetyInput

type SafetyInput struct {
	Bundle       FailureBundle
	Goal         project.Goal
	Signals      []Signal
	EditedPaths  []string
	ChangedFiles []ChangedFile
}

type Signal

type Signal struct {
	Type           string `yaml:"type"`
	Source         string `yaml:"source"`
	Job            string `yaml:"job,omitempty"`
	Message        string `yaml:"message"`
	File           string `yaml:"file,omitempty"`
	Line           int    `yaml:"line,omitempty"`
	Confidence     string `yaml:"confidence"`
	RawExcerpt     string `yaml:"raw_excerpt,omitempty"`
	RawExcerptPath string `yaml:"raw_excerpt_path,omitempty"`
}

Jump to

Keyboard shortcuts

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