acceptance

package
v0.0.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OriginAuthenticCapture = origin.OriginAuthenticCapture
	OriginPinnedContract   = origin.OriginPinnedContract
	OriginReviewFinding    = origin.OriginReviewFinding
	OriginAuthored         = origin.OriginAuthored
	OriginRaw              = origin.OriginRaw
)
View Source
const (
	MaxObservedResultBytes  = 1 << 20
	MaxReproductionArgs     = MaxArgvEntries
	MaxReproductionArgBytes = 64 << 10
)
View Source
const (
	MaxCorpusCases     = 1024
	MaxCorpusOperators = 64
	MaxGeneratedCases  = 4096
	MaxCorpusBytes     = 8 << 20
	MaxSetupRecords    = 4096
	MaxDeltaEntries    = 100_000
	MaxArgvEntries     = 256
	MaxDataValueBytes  = 1 << 20
)
View Source
const MaxCaptureFixtureBytes = 1 << 20

MaxCaptureFixtureBytes bounds one native capture payload during validation.

View Source
const ReportSchemaVersion = "pasture.acceptance-report/v1"
View Source
const SchemaVersion = "pasture.acceptance-corpus/v1"

Variables

This section is empty.

Functions

func AssertExactRowChanges

func AssertExactRowChanges(before, after StoreSnapshot, allowed []RowChange) error

AssertExactRowChanges requires the complete observed delta to equal allowed. Duplicate or malformed allowed identities fail rather than widening access.

func EvaluateSourceMutations

func EvaluateSourceMutations(operators []SourceMutationOperator, results []SourceMutationResult) error

func IsBareTrackerID added in v0.0.9

func IsBareTrackerID(value string) bool

IsBareTrackerID reports whether a value has the shape of a bare task-tracker identifier. A tracker id is not durable and names nothing a reader can open from the repository, so no committed sidecar may carry one in any field.

func RequireCovered

func RequireCovered(results []CoverageResult) error

func ValidateClearancePath added in v0.0.9

func ValidateClearancePath(clearance string) error

ValidateClearancePath refuses every Clearance value that is not a committed path of a CLEARANCE.md file. The refusals name what the value is, so a writer learns which rule it broke.

func ValidateCorpus

func ValidateCorpus(c Corpus) error

ValidateCorpus validates the final typed corpus. DecodeCorpus and ExpandMutations both use this boundary, so callers constructing Corpus values directly receive the same actionable failures as YAML callers.

Types

type ActorSetup

type ActorSetup struct {
	ID   provenance.ActorID
	Kind provenance.AgentKind
}

type CanonicalRow

type CanonicalRow struct {
	Identity string `json:"identity"`
	Value    string `json:"value"`
}

type CaptureOrigin

type CaptureOrigin = origin.CaptureOrigin

CaptureOrigin aliases the single capture-origin enum definition in internal/acceptance/origin. The definition lives in that leaf package so the lifecycle receipt and envelope carriers can import it without closing an import cycle through acceptance -> internal/tasks -> lifecycle; the corpus re-exports the type and values here under their historical names.

type CaptureProvenance

type CaptureProvenance struct {
	Origin         CaptureOrigin `json:"origin"`
	Harness        HarnessKind   `json:"harness"`
	HarnessVersion string        `json:"harnessVersion"`
	CaptureSource  string        `json:"captureSource"`
	RawFileDigest  string        `json:"rawFileDigest"`
	CapturedAt     string        `json:"capturedAt"`
	// Event is the exact native event name the host declared for the capture.
	Event string `json:"event"`
	// Redaction lists every substitution rule applied to the committed bytes,
	// in the order applied; see ParseRedaction. The digest above is computed
	// over the committed bytes, after every listed rule was applied.
	Redaction string `json:"redaction"`
	// Clearance is the committed path of the CLEARANCE.md that holds the user's
	// verbatim acceptance of the batch this capture was cleared in. It is a
	// path, never a bare identifier.
	Clearance string `json:"clearance"`
}

CaptureProvenance is the sidecar record of one authentic native capture. JSON keys are the sidecar keys as committed next to each fixture.

func (CaptureProvenance) ValidateCommittedFixtureBytes added in v0.0.9

func (p CaptureProvenance) ValidateCommittedFixtureBytes(path string, body []byte) error

ValidateCommittedFixtureBytes validates already bounded capture bytes that are committed at path (absolute or repository-relative, as resolved by the caller). The path is kept for the error a caller reports; the rules are the same as ValidateFixtureBytes, and every capture needs its event, redaction and clearance whatever its host version.

func (CaptureProvenance) ValidateFixture

func (p CaptureProvenance) ValidateFixture(root, fixture string) error

func (CaptureProvenance) ValidateFixtureBytes

func (p CaptureProvenance) ValidateFixtureBytes(body []byte) error

ValidateFixtureBytes is the single metadata and digest authority for already bounded capture bytes. Non-authentic provenance remains non-normative.

An authentic capture must carry its event, its redaction record and its clearance path, whatever its host version. No committed capture is exempt: the last captures that predated those three fields left the corpus when the events were recaptured at the recorded host versions.

type Case

type Case struct {
	ID         string
	Class      CaseClass
	Target     Target
	Setup      Setup
	Expect     Expectation
	Delta      PersistedDelta
	Provenance ProvenanceSource
	Mutations  []MutationOperatorID
}

type CaseClass

type CaseClass string
const (
	MustPass CaseClass = "must-pass"
	MustFail CaseClass = "must-fail"
)

func (CaseClass) IsValid

func (c CaseClass) IsValid() bool

func (*CaseClass) UnmarshalText

func (c *CaseClass) UnmarshalText(text []byte) error

type Corpus

type Corpus struct {
	Schema       string
	ID           string
	MaxGenerated int
	Cases        []Case
	Operators    []MutationOperator
}

func DecodeCorpus

func DecodeCorpus(data []byte) (Corpus, error)

func LoadCorpus

func LoadCorpus(path string) (Corpus, error)

type CoverageAssignment

type CoverageAssignment struct {
	Dimension CoverageDimensionID
	Value     CoverageValue
}

type CoverageDimension

type CoverageDimension struct {
	ID        CoverageDimensionID
	Milestone Milestone
	Values    []CoverageValue
}

type CoverageDimensionID

type CoverageDimensionID string

type CoverageResult

type CoverageResult struct {
	Dimension CoverageDimensionID
	Milestone Milestone
	Gated     bool
	Uncovered []CoverageValue
}

func EvaluateCoverage

func EvaluateCoverage(spec CoverageSpec, run Milestone, assignments []CoverageAssignment) ([]CoverageResult, error)

type CoverageSpec

type CoverageSpec struct {
	Milestone  Milestone
	Dimensions []CoverageDimension
}

type CoverageValue

type CoverageValue string

type DataValue

type DataValue struct {
	Inline  *string
	Fixture string
}

func (DataValue) IsInline

func (v DataValue) IsInline() bool

type EvidenceSetup

type EvidenceSetup struct {
	ID      provenance.JournalID
	Kind    provenance.EvidenceKind
	Subject string
	Value   DataValue
}

type ExactDelta

type ExactDelta struct {
	Added      []string
	Changed    []string
	Removed    []string
	RowCount   int
	ByteDigest string
}

func Delta

func Delta(before, after SemanticSnapshot) (ExactDelta, error)

type Expansion

type Expansion struct {
	Sources    []Case
	Mutants    []Mutant
	Accounting []OperatorAccounting
}

func ExpandMutations

func ExpandMutations(corpus Corpus) (Expansion, error)

type Expectation

type Expectation struct {
	Oracle         OracleKind
	ExitCode       *int
	StdoutJSON     *DataValue
	Stderr         *DataValue
	OutputMutation *DataValue
}

type HarnessKind

type HarnessKind string
const (
	HarnessClaudeCode  HarnessKind = "claude-code"
	HarnessCodexCLI    HarnessKind = "codex-cli"
	HarnessOpenCode    HarnessKind = "opencode"
	HarnessAntigravity HarnessKind = "antigravity"
)

func (HarnessKind) IsValid

func (h HarnessKind) IsValid() bool

func (*HarnessKind) UnmarshalText

func (h *HarnessKind) UnmarshalText(text []byte) error

type Milestone

type Milestone uint8
const (
	MilestoneM1 Milestone = iota + 1
	MilestoneM2
	MilestoneM3
	MilestoneM4
	MilestoneM5
	MilestoneM6
)

type Mutant

type Mutant struct {
	Case       Case
	SourceID   string
	OperatorID MutationOperatorID
	Oracle     OracleKind
}

type MutantResult

type MutantResult struct {
	MutantID            string             `json:"mutantId"`
	SourceID            string             `json:"sourceId"`
	OperatorID          MutationOperatorID `json:"operatorId"`
	ExpectedOracle      OracleKind         `json:"expectedOracle"`
	ObservedOracle      OracleKind         `json:"observedOracle"`
	ObservedResult      string             `json:"observedResult"`
	ReproductionCommand []string           `json:"reproductionCommand"`
	Killed              bool               `json:"killed"`
}

type MutationOperator

type MutationOperator struct {
	ID         MutationOperatorID
	Compatible []TargetKind
	Oracle     OracleKind
	MaxPerCase int
}

type MutationOperatorID

type MutationOperatorID string
const (
	MutRemoveActor         MutationOperatorID = "remove-actor"
	MutUnknownActor        MutationOperatorID = "unknown-actor"
	MutWrongActorKind      MutationOperatorID = "wrong-actor-kind"
	MutEndedAssignment     MutationOperatorID = "ended-assignment"
	MutWrongAssignmentRole MutationOperatorID = "wrong-assignment-role"
	MutWrongSubject        MutationOperatorID = "wrong-subject"
	MutChangedCommand      MutationOperatorID = "changed-command"
	MutChangedEvidence     MutationOperatorID = "changed-evidence"
	MutUnknownJSONField    MutationOperatorID = "unknown-json-field"
	MutTrailingJSON        MutationOperatorID = "trailing-json"
	MutNativeEventMismatch MutationOperatorID = "native-event-mismatch"
)

func (MutationOperatorID) IsValid

func (id MutationOperatorID) IsValid() bool

func (*MutationOperatorID) UnmarshalText

func (id *MutationOperatorID) UnmarshalText(text []byte) error

type NativeEvent

type NativeEvent struct {
	Harness   HarnessKind
	Contract  string
	Event     string
	InputJSON DataValue
}

type Observation

type Observation struct {
	MutantID            string     `json:"mutantId"`
	ObservedOracle      OracleKind `json:"observedOracle"`
	ObservedResult      string     `json:"observedResult"`
	ReproductionCommand []string   `json:"reproductionCommand"`
}

type OperatorAccounting

type OperatorAccounting struct {
	OperatorID   MutationOperatorID `json:"operatorId"`
	Selected     int                `json:"selected"`
	Executed     int                `json:"executed"`
	Killed       int                `json:"killed"`
	Survived     int                `json:"survived"`
	Incompatible int                `json:"incompatible"`
	Duplicate    int                `json:"duplicate"`
}

type OracleKind

type OracleKind string
const (
	OracleSuccess         OracleKind = "success"
	OracleValidation      OracleKind = "validation-error"
	OracleAuthority       OracleKind = "authority-error"
	OracleConflict        OracleKind = "identity-conflict"
	OracleGate            OracleKind = "gate-rejection"
	OracleNativeTransport OracleKind = "native-transport"
	OracleNoWrites        OracleKind = "no-writes"
)

func (OracleKind) IsValid

func (o OracleKind) IsValid() bool

func (*OracleKind) UnmarshalText

func (o *OracleKind) UnmarshalText(text []byte) error

type PersistedDelta

type PersistedDelta struct {
	Graph       ExactDelta
	Assignments ExactDelta
	Decisions   ExactDelta
	Evidence    ExactDelta
	Activities  ExactDelta
	Events      ExactDelta
	Journal     ExactDelta
	Projection  ExactDelta
}

func (PersistedDelta) All

func (d PersistedDelta) All() []ExactDelta

type ProductionCommand

type ProductionCommand struct {
	Argv  []string
	Stdin DataValue
}

type ProvenanceSource

type ProvenanceSource struct {
	Requirement string
	Record      string
	Rationale   string
	Capture     CaptureProvenance
}

type RedactionRule added in v0.0.9

type RedactionRule string

RedactionRule is one substitution rule applied to a capture before its bytes were committed. The set is closed: a sidecar that names a rule outside it is refused, so a rule can never be invented in a sidecar alone.

const (
	// RedactionNone states that no substitution was applied. It stands alone.
	RedactionNone RedactionRule = "none"
	// RedactionHomePath replaces the capturing user's home directory.
	RedactionHomePath RedactionRule = "home-path-v1"
	// RedactionFreeText replaces free-text fields (prompt text, tool arguments,
	// tool output) with placeholders of the same shape.
	RedactionFreeText RedactionRule = "free-text-v1"
	// RedactionEnvDump replaces every value of an environment-dump object with
	// a fixed placeholder, preserving keys, nesting and types. It is the one
	// rule that can clear a name-shape environment-dump refusal, and only
	// together with a neutralization check: the refusal is admitted for a path
	// only when the provenance lists this rule and every value under that path
	// is already the placeholder.
	RedactionEnvDump RedactionRule = "env-dump-v1"
)

func ParseRedaction added in v0.0.9

func ParseRedaction(value string) ([]RedactionRule, error)

ParseRedaction reads a Redaction value: "none", or every applied rule in the order it was applied, joined by ",". A rule outside the closed set, a rule listed twice, "none" combined with a rule, and an empty value are refused.

func (RedactionRule) IsValid added in v0.0.9

func (r RedactionRule) IsValid() bool

type Report

type Report struct {
	Schema    string               `json:"schema"`
	Operators []OperatorAccounting `json:"operators"`
	Mutants   []MutantResult       `json:"mutants"`
}

func EvaluateMutations

func EvaluateMutations(expansion Expansion, observations []Observation) (Report, error)

type RowChange

type RowChange struct {
	Table    string        `json:"table"`
	Identity string        `json:"identity"`
	Kind     RowChangeKind `json:"kind"`
}

func CompareRowChanges

func CompareRowChanges(before, after StoreSnapshot) ([]RowChange, error)

CompareRowChanges returns every exact row-identity change across the complete store. Rows sharing a table are compared independently, so permitting one changed row never exempts unrelated rows in that table.

type RowChangeKind

type RowChangeKind string
const (
	RowAdded   RowChangeKind = "added"
	RowChanged RowChangeKind = "changed"
	RowRemoved RowChangeKind = "removed"
)

type SemanticKind

type SemanticKind string
const (
	SemanticGraph       SemanticKind = "graph"
	SemanticAssignments SemanticKind = "assignments"
	SemanticDecisions   SemanticKind = "decisions"
	SemanticEvidence    SemanticKind = "evidence"
	SemanticActivities  SemanticKind = "activities"
	SemanticEvents      SemanticKind = "events"
	SemanticJournal     SemanticKind = "journal"
	SemanticProjection  SemanticKind = "projection"
)

type SemanticSnapshot

type SemanticSnapshot struct {
	Kind       SemanticKind    `json:"kind"`
	Tables     []TableSnapshot `json:"tables"`
	RowCount   int             `json:"rowCount"`
	ByteDigest string          `json:"byteDigest"`
}

type Setup

type Setup struct {
	Fixture     string
	PreState    DataValue
	Actors      []ActorSetup
	Assignments []AssignmentSetup
	Tasks       []TaskSetup
	Evidence    []EvidenceSetup
}

type SnapshotLimits

type SnapshotLimits struct {
	MaxTables       int
	MaxRows         int
	MaxRowsPerTable int
	MaxCellBytes    int
	MaxTotalBytes   int
}

func DefaultSnapshotLimits

func DefaultSnapshotLimits() SnapshotLimits

type SourceMutationOperator

type SourceMutationOperator struct {
	ID        SourceMutationOperatorID
	Guard     string
	Rationale string
}

type SourceMutationOperatorID

type SourceMutationOperatorID string

type SourceMutationResult

type SourceMutationResult struct {
	OperatorID SourceMutationOperatorID
	Guard      string
	Killed     bool
	Observed   string
}

type StoreSnapshot

type StoreSnapshot struct {
	Tables          []TableSnapshot    `json:"tables"`
	Semantics       []SemanticSnapshot `json:"semantics"`
	RowCount        int                `json:"rowCount"`
	ByteDigest      string             `json:"byteDigest"`
	UnrelatedDigest string             `json:"unrelatedDigest"`
}

func SnapshotFile

func SnapshotFile(ctx context.Context, path string, limits SnapshotLimits) (StoreSnapshot, error)

func (StoreSnapshot) Semantic

func (s StoreSnapshot) Semantic(kind SemanticKind) (SemanticSnapshot, bool)

type TableSnapshot

type TableSnapshot struct {
	Name       string         `json:"name"`
	Columns    []string       `json:"columns"`
	Rows       []CanonicalRow `json:"rows"`
	RowCount   int            `json:"rowCount"`
	ByteDigest string         `json:"byteDigest"`
}

type Target

type Target struct {
	Kind        TargetKind
	Command     *ProductionCommand
	NativeEvent *NativeEvent
}

func (Target) CommandArgv

func (t Target) CommandArgv() []string

type TargetKind

type TargetKind string
const (
	TargetProductionCommand TargetKind = "production-command"
	TargetNativeEvent       TargetKind = "native-event"
)

func (TargetKind) IsValid

func (k TargetKind) IsValid() bool

func (*TargetKind) UnmarshalText

func (k *TargetKind) UnmarshalText(text []byte) error

type TaskSetup

type TaskSetup struct {
	ID     provenance.TaskID
	Kind   provenance.TaskType
	Status provenance.TaskStatus
}

Directories

Path Synopsis
Package origin defines the closed capture-origin provenance enum shared by the acceptance corpus (re-exported through package acceptance) and the lifecycle receipt/envelope origin carriers.
Package origin defines the closed capture-origin provenance enum shared by the acceptance corpus (re-exported through package acceptance) and the lifecycle receipt/envelope origin carriers.

Jump to

Keyboard shortcuts

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