releasevalidation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package releasevalidation loads and validates the repository's fail-closed release matrix. It deliberately knows nothing about OpenRealtime runtime internals: a release gate is an executable contract around the public build, test, client, and benchmark entry points.

Index

Constants

View Source
const (
	BehavioralTargetsVersion    = 1
	FrozenCandidateVersion      = 2
	BehavioralAcceptanceVersion = 2

	RegistrationRegistered    = "registered"
	RegistrationUnavailable   = "unavailable"
	RegistrationNotApplicable = "not_applicable"

	ResultKindBench        = "bench_result"
	ResultKindArchitecture = "architecture_result"

	CaseKeyExact           = "exact"
	CaseKeyBeforeFinalHash = "before_final_hash"

	ComparisonAtLeast = "at_least"
	ComparisonAtMost  = "at_most"

	StatisticSum   = "sum"
	StatisticCount = "count"
	StatisticMin   = "min"
	StatisticP50   = "p50"
	StatisticP90   = "p90"
	StatisticP95   = "p95"
	StatisticP99   = "p99"
	StatisticMax   = "max"
	StatisticMean  = "mean"

	RunFailedFull        = "failed_full"
	RunFocusedDiagnostic = "focused_diagnostic"
	RunFinalFull         = "final_full"
)
View Source
const (
	CampaignClosureFormat          = "openrealtime.behavioral-campaign-closure"
	CampaignClosureVersion         = 1
	CampaignRunSpecFormat          = "openrealtime.behavioral-run-spec"
	CampaignRunSpecVersion         = 1
	CampaignInventoryFormat        = "openrealtime.behavioral-task-inventory"
	CampaignInventoryVersion       = 1
	CampaignScorerFormat           = "openrealtime.behavioral-scorer"
	CampaignScorerVersion          = 1
	CampaignArtifactReceiptFormat  = "openrealtime.behavioral-artifact-receipt"
	CampaignArtifactReceiptVersion = 1
)
View Source
const MatrixVersion = 1

Variables

This section is empty.

Functions

func MarshalBehavioralAcceptanceReport

func MarshalBehavioralAcceptanceReport(report BehavioralAcceptanceReport) ([]byte, error)

func MarshalCampaignArtifact

func MarshalCampaignArtifact(value any) ([]byte, error)

MarshalCampaignArtifact emits the canonical representation required by the closure contract. Supported values are run specs, inventories, scorers, and common source receipt wrappers.

func MarshalCampaignClosureDraft

func MarshalCampaignClosureDraft(closure CampaignClosure) ([]byte, error)

MarshalCampaignClosureDraft emits the only accepted publisher input form.

func MarshalReport

func MarshalReport(report Report) ([]byte, error)

MarshalReport emits deterministic, indented JSON. Gate and prerequisite order is matrix order; maps never enter the evidence shape.

func RequiredGateIDs

func RequiredGateIDs(matrix Matrix) []string

Types

type AggregateTarget

type AggregateTarget struct {
	Registration      Registration `json:"registration"`
	MinimumPassed     *int         `json:"minimum_passed,omitempty"`
	MinimumApplicable *int         `json:"minimum_applicable,omitempty"`
}

type Assertion

type Assertion struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type Availability

type Availability string
const (
	AvailabilityLocal       Availability = "local"
	AvailabilityProvisioned Availability = "provisioned"
)

type BehavioralAcceptanceReport

type BehavioralAcceptanceReport struct {
	FormatVersion         int                     `json:"format_version"`
	TargetsSHA256         string                  `json:"targets_sha256"`
	FrozenCandidateSHA256 string                  `json:"frozen_candidate_sha256"`
	CandidateID           string                  `json:"candidate_id"`
	Revision              string                  `json:"revision"`
	ExecutableSHA256      string                  `json:"executable_sha256"`
	Machine               bench.Machine           `json:"machine"`
	Outcome               BehavioralOutcome       `json:"outcome"`
	Accepted              bool                    `json:"accepted"`
	BlockedBy             []string                `json:"blocked_by,omitempty"`
	Failures              []string                `json:"failures,omitempty"`
	Suites                []BehavioralSuiteReport `json:"suites"`
}

func EvaluateBehavioralAcceptance

func EvaluateBehavioralAcceptance(
	targets BehavioralTargets,
	targetsSHA256 string,
	candidate FrozenCandidate,
	candidateSHA256 string,
	inputs []BehavioralClosureInput,
) BehavioralAcceptanceReport

EvaluateBehavioralAcceptance creates one candidate-only acceptance report. Historical result files and bare final results are deliberately not inputs: checked target numbers are the comparison authority, while every observed row is reached through a verified final graph-native campaign closure.

type BehavioralCheck

type BehavioralCheck struct {
	Domain     string  `json:"domain"`
	Name       string  `json:"name"`
	Passed     bool    `json:"passed"`
	Metric     string  `json:"metric,omitempty"`
	Statistic  string  `json:"statistic,omitempty"`
	Comparison string  `json:"comparison,omitempty"`
	Threshold  float64 `json:"threshold,omitempty"`
	Observed   float64 `json:"observed,omitempty"`
	Samples    int     `json:"samples,omitempty"`
	Reason     string  `json:"reason,omitempty"`
}

type BehavioralClosureInput

type BehavioralClosureInput struct {
	ID   string
	Path string
}

type BehavioralExecutionReport

type BehavioralExecutionReport struct {
	RequirementSHA256   string `json:"requirement_sha256"`
	GraphFingerprint    string `json:"graph_fingerprint"`
	ConfigurationID     string `json:"configuration_id"`
	ConfigurationSHA256 string `json:"configuration_sha256"`
	DeploymentID        string `json:"deployment_id"`
	DeploymentSHA256    string `json:"deployment_sha256"`
	RuntimeSetSHA256    string `json:"runtime_set_sha256"`
}

type BehavioralOutcome

type BehavioralOutcome string
const (
	BehavioralPassed  BehavioralOutcome = "passed"
	BehavioralFailed  BehavioralOutcome = "failed"
	BehavioralBlocked BehavioralOutcome = "blocked"
)

type BehavioralResultInput

type BehavioralResultInput = BehavioralClosureInput

BehavioralResultInput remains as a source-compatible alias. Path now names a campaign closure, never a bare result; supplying result JSON fails closed.

type BehavioralSuiteReport

type BehavioralSuiteReport struct {
	ID                 string                     `json:"id"`
	Suite              string                     `json:"suite"`
	ResultKind         string                     `json:"result_kind"`
	Outcome            BehavioralOutcome          `json:"outcome"`
	ResultSHA256       string                     `json:"result_sha256,omitempty"`
	ClosureSHA256      string                     `json:"closure_sha256,omitempty"`
	ExpectedPopulation int                        `json:"expected_population"`
	ObservedPopulation int                        `json:"observed_population"`
	Completed          int                        `json:"completed"`
	Passed             int                        `json:"passed"`
	NotApplicable      int                        `json:"not_applicable,omitempty"`
	Execution          *BehavioralExecutionReport `json:"execution,omitempty"`
	Lineage            []RunLineage               `json:"lineage,omitempty"`
	BlockedBy          []string                   `json:"blocked_by,omitempty"`
	Failures           []string                   `json:"failures,omitempty"`
	Checks             []BehavioralCheck          `json:"checks,omitempty"`
}

type BehavioralSuiteTarget

type BehavioralSuiteTarget struct {
	ID                 string            `json:"id"`
	ResultKind         string            `json:"result_kind"`
	Suite              string            `json:"suite"`
	ExpectedPopulation int               `json:"expected_population"`
	CaseKey            string            `json:"case_key"`
	Aggregate          AggregateTarget   `json:"aggregate"`
	Cases              CaseTargetSet     `json:"cases"`
	Safety             EvidenceTargetSet `json:"safety"`
	Deadline           EvidenceTargetSet `json:"deadline"`
	Latency            EvidenceTargetSet `json:"latency"`
}

type BehavioralTargets

type BehavioralTargets struct {
	FormatVersion int                     `json:"format_version"`
	Suites        []BehavioralSuiteTarget `json:"suites"`
}

BehavioralTargets is the checked, preregistered behavioral contract. An unavailable registration is explicit checked data, not an omitted field: it keeps acceptance blocked until the benchmark owner records a target.

func LoadBehavioralTargets

func LoadBehavioralTargets(path string) (BehavioralTargets, string, error)

func (BehavioralTargets) Validate

func (targets BehavioralTargets) Validate() error

type CampaignArtifact

type CampaignArtifact struct {
	Format         string `json:"format"`
	FormatVersion  int    `json:"format_version"`
	Path           string `json:"path"`
	ArtifactSHA256 string `json:"artifact_sha256"`
}

CampaignArtifact identifies one typed, immutable artifact. Path is a locator resolved relative to the closure file and is deliberately excluded from ArtifactSHA256's meaning: identity is the digest, never the filename.

type CampaignArtifactReceipt

type CampaignArtifactReceipt struct {
	Format                string `json:"format"`
	FormatVersion         int    `json:"format_version"`
	Kind                  string `json:"kind"`
	ArtifactFormat        string `json:"artifact_format"`
	ArtifactPath          string `json:"artifact_path"`
	ArtifactSHA256        string `json:"artifact_sha256"`
	PortableReceiptSHA256 string `json:"portable_receipt_sha256"`
	ReceiptSHA256         string `json:"receipt_sha256"`
}

CampaignArtifactReceipt is the smallest common, externally verifiable source-evidence receipt. Suite-specific receipts can be wrapped by retaining their raw digest and semantic identity here. Acceptance verifies the wrapper and the exact raw receipt bytes; suite owners remain responsible for replay.

func SealCampaignArtifactReceipt

func SealCampaignArtifactReceipt(receipt CampaignArtifactReceipt) (CampaignArtifactReceipt, error)

SealCampaignArtifactReceipt calculates the receipt's self digest.

func (CampaignArtifactReceipt) Validate

func (receipt CampaignArtifactReceipt) Validate() error

type CampaignClosure

type CampaignClosure struct {
	Format                     string             `json:"format"`
	FormatVersion              int                `json:"format_version"`
	SuiteID                    string             `json:"suite_id"`
	CampaignID                 string             `json:"campaign_id"`
	CandidateID                string             `json:"candidate_id"`
	CandidateSHA256            string             `json:"candidate_sha256"`
	Revision                   string             `json:"revision"`
	ExecutableSHA256           string             `json:"executable_sha256"`
	Machine                    bench.Machine      `json:"machine"`
	ExecutionRequirementSHA256 string             `json:"execution_requirement_sha256"`
	RunSpec                    CampaignArtifact   `json:"run_spec"`
	Inventory                  CampaignArtifact   `json:"inventory"`
	SourceReceipts             []CampaignArtifact `json:"source_receipts"`
	Result                     CampaignArtifact   `json:"result"`
	Scorer                     CampaignArtifact   `json:"scorer"`
	ExpectedPopulation         int                `json:"expected_population"`
	TaskPopulationSHA256       string             `json:"task_population_sha256"`
	Predecessors               []CampaignArtifact `json:"predecessors,omitempty"`
	ClosureSHA256              string             `json:"closure_sha256"`
}

CampaignClosure is a post-run, create-only commit record. ClosureSHA256 is calculated over the canonical JSON representation with that field empty. Predecessors recursively close every declared failed/full and focused run; the current closure must correspond to the last frozen final_full row.

func LoadCampaignClosure

func LoadCampaignClosure(path string) (CampaignClosure, error)

LoadCampaignClosure loads a strict canonical closure. Artifact paths remain relative to the closure's directory until VerifyCampaignClosure resolves them beneath that directory.

func LoadCampaignClosureDraft

func LoadCampaignClosureDraft(path string) (CampaignClosure, error)

LoadCampaignClosureDraft reads the strict canonical input to the create-only publisher. A draft must carry an explicitly empty closure_sha256; publishing calculates it only after every referenced artifact verifies.

func PublishCampaignClosure

func PublishCampaignClosure(publication CampaignClosurePublication) (CampaignClosure, error)

PublishCampaignClosure verifies the complete campaign before writing a canonical closure with O_EXCL. No existing receipt is ever replaced.

type CampaignClosurePublication

type CampaignClosurePublication struct {
	Closure CampaignClosure
	Path    string
}

CampaignClosurePublication supplies caller-owned artifact paths. Publishing validates and reopens all inputs before atomically creating the closure.

type CampaignNamedDigest

type CampaignNamedDigest struct {
	Name   string `json:"name"`
	SHA256 string `json:"sha256"`
}

type CampaignNamedValue

type CampaignNamedValue struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type CampaignRunSpec

type CampaignRunSpec struct {
	Format           string                `json:"format"`
	FormatVersion    int                   `json:"format_version"`
	SuiteID          string                `json:"suite_id"`
	CampaignID       string                `json:"campaign_id"`
	WorkingDirectory string                `json:"working_directory"`
	Arguments        []string              `json:"arguments"`
	Environment      []CampaignNamedValue  `json:"environment,omitempty"`
	Endpoints        []CampaignNamedDigest `json:"endpoints,omitempty"`
}

CampaignRunSpec retains the behavior-affecting invocation as canonical argv, public environment bindings, and secret-free endpoint identities. Every collection is unique and sorted; positional argv order is preserved.

func (CampaignRunSpec) Validate

func (spec CampaignRunSpec) Validate() error

type CampaignScorerManifest

type CampaignScorerManifest struct {
	Format               string                `json:"format"`
	FormatVersion        int                   `json:"format_version"`
	SuiteID              string                `json:"suite_id"`
	Identity             string                `json:"identity"`
	Revision             string                `json:"revision"`
	ImplementationSHA256 string                `json:"implementation_sha256"`
	Inputs               []CampaignNamedDigest `json:"inputs,omitempty"`
}

CampaignScorerManifest identifies the deterministic code and all immutable inputs which own TaskOutcome.Passed. The named inputs are unique and sorted.

func (CampaignScorerManifest) Validate

func (scorer CampaignScorerManifest) Validate() error

type CampaignSourceRequirement

type CampaignSourceRequirement struct {
	Kind           string `json:"kind"`
	ArtifactFormat string `json:"artifact_format"`
}

CampaignSourceRequirement is frozen before a final campaign. The receipt digest cannot exist yet, but its semantic kind and schema must already be fixed so a final run cannot substitute an unrelated evidence artifact.

type CampaignTaskInventory

type CampaignTaskInventory struct {
	Format             string   `json:"format"`
	FormatVersion      int      `json:"format_version"`
	SuiteID            string   `json:"suite_id"`
	ExpectedPopulation int      `json:"expected_population"`
	TaskIDs            []string `json:"task_ids"`
}

CampaignTaskInventory is the pre-run exact population. Task IDs must be unique and sorted. This prevents a result from choosing its own population.

func (CampaignTaskInventory) Validate

func (inventory CampaignTaskInventory) Validate() error

type CaseTarget

type CaseTarget struct {
	Case              string `json:"case"`
	ExpectedAttempts  int    `json:"expected_attempts"`
	MinimumPassed     int    `json:"minimum_passed"`
	MinimumApplicable *int   `json:"minimum_applicable,omitempty"`
}

type CaseTargetSet

type CaseTargetSet struct {
	Registration Registration `json:"registration"`
	Targets      []CaseTarget `json:"targets,omitempty"`
}

type EvidenceTargetSet

type EvidenceTargetSet struct {
	Registration Registration      `json:"registration"`
	Rules        []MetricRule      `json:"rules,omitempty"`
	Exclusions   []MetricExclusion `json:"exclusions,omitempty"`
}

type FrozenCandidate

type FrozenCandidate struct {
	FormatVersion    int                    `json:"format_version"`
	CandidateID      string                 `json:"candidate_id"`
	Revision         string                 `json:"revision"`
	ExecutableSHA256 string                 `json:"executable_sha256"`
	Machine          bench.Machine          `json:"machine"`
	Suites           []FrozenCandidateSuite `json:"suites"`
}

FrozenCandidate is authored before the final campaigns. It pins the build, machine and complete execution requirement for every suite. The acceptance report binds the resulting files by digest after they exist.

func LoadFrozenCandidate

func LoadFrozenCandidate(path string) (FrozenCandidate, string, error)

func (FrozenCandidate) Validate

func (candidate FrozenCandidate) Validate() error

type FrozenCandidateSuite

type FrozenCandidateSuite struct {
	ID                         string                      `json:"id"`
	ExecutionRequirementSHA256 string                      `json:"execution_requirement_sha256"`
	RunSpecSHA256              string                      `json:"run_spec_sha256"`
	TaskInventorySHA256        string                      `json:"task_inventory_sha256"`
	ScorerSHA256               string                      `json:"scorer_sha256"`
	SourceReceipts             []CampaignSourceRequirement `json:"source_receipts"`
	Lineage                    []RunLineage                `json:"lineage"`
}

type Gate

type Gate struct {
	ID            string            `json:"id"`
	Description   string            `json:"description"`
	Availability  Availability      `json:"availability"`
	Selection     Selection         `json:"selection"`
	Required      bool              `json:"required"`
	WorkingDir    string            `json:"working_directory"`
	Command       []string          `json:"command"`
	Environment   map[string]string `json:"environment,omitempty"`
	Timeout       string            `json:"timeout"`
	SkipPolicy    SkipPolicy        `json:"skip_policy"`
	Prerequisites []Prerequisite    `json:"prerequisites,omitempty"`
	Assertions    []Assertion       `json:"assertions,omitempty"`
	Covers        []string          `json:"covers,omitempty"`
}

Gate is one independently runnable release claim. Required means that the complete matrix cannot be green without a passing result for this gate. Selection controls only the convenient local default; it never changes the completeness calculation. Optional validation gates must be opt-in so they cannot silently become part of the default developer workflow.

type GateResult

type GateResult struct {
	ID              string               `json:"id"`
	Description     string               `json:"description"`
	Availability    Availability         `json:"availability"`
	Required        bool                 `json:"required"`
	Selected        bool                 `json:"selected"`
	Status          Status               `json:"status"`
	Reason          string               `json:"reason,omitempty"`
	Command         []string             `json:"command"`
	Prerequisites   []PrerequisiteResult `json:"prerequisites,omitempty"`
	StartedAt       *time.Time           `json:"started_at,omitempty"`
	FinishedAt      *time.Time           `json:"finished_at,omitempty"`
	DurationMS      int64                `json:"duration_ms,omitempty"`
	ExitCode        *int                 `json:"exit_code,omitempty"`
	TimedOut        bool                 `json:"timed_out,omitempty"`
	ObservedSkips   int                  `json:"observed_skips,omitempty"`
	StdoutLog       string               `json:"stdout_log,omitempty"`
	StderrLog       string               `json:"stderr_log,omitempty"`
	FailedAssertion string               `json:"failed_assertion,omitempty"`
}

type Matrix

type Matrix struct {
	Version int    `json:"version"`
	Gates   []Gate `json:"gates"`
}

Matrix is the checked, versioned release definition.

func Load

func Load(path string) (Matrix, error)

Load reads a strict matrix. Unknown fields and trailing JSON are errors so a misspelled prerequisite or policy cannot silently weaken a gate.

func (Matrix) Digest

func (matrix Matrix) Digest() (string, error)

Digest binds a report to the exact semantic matrix. encoding/json sorts map keys, so equivalent checked JSON has one structural identity independent of whitespace.

func (Matrix) Validate

func (matrix Matrix) Validate() error

type MetricExclusion

type MetricExclusion struct {
	Metric string `json:"metric"`
	Reason string `json:"reason"`
}

type MetricRule

type MetricRule struct {
	Name             string  `json:"name"`
	Metric           string  `json:"metric"`
	Statistic        string  `json:"statistic"`
	Comparison       string  `json:"comparison"`
	Threshold        float64 `json:"threshold"`
	MinimumSamples   int     `json:"minimum_samples"`
	RequireEveryTask bool    `json:"require_every_task"`
}

type Mode

type Mode string
const (
	ModePlan Mode = "plan"
	ModeRun  Mode = "run"
)

type Options

type Options struct {
	Mode         Mode
	Scope        Scope
	GateIDs      []string
	IncludeOptIn bool
	Root         string
	ArtifactsDir string
	GoBinary     string
	Environment  []string
	Now          func() time.Time
	Progress     io.Writer
}

type Prerequisite

type Prerequisite struct {
	Kind         string   `json:"kind"`
	Value        string   `json:"value,omitempty"`
	Alternatives []string `json:"alternatives,omitempty"`
	Description  string   `json:"description"`
}

type PrerequisiteResult

type PrerequisiteResult struct {
	Kind        string `json:"kind"`
	Description string `json:"description"`
	Available   bool   `json:"available"`
	Reason      string `json:"reason,omitempty"`
}

type Registration

type Registration struct {
	Status string `json:"status"`
	Source string `json:"source,omitempty"`
	Reason string `json:"reason,omitempty"`
}

type Report

type Report struct {
	Version              int          `json:"version"`
	MatrixVersion        int          `json:"matrix_version"`
	MatrixSHA256         string       `json:"matrix_sha256"`
	Mode                 Mode         `json:"mode"`
	Scope                Scope        `json:"scope"`
	StartedAt            time.Time    `json:"started_at"`
	FinishedAt           time.Time    `json:"finished_at"`
	ArtifactsDirectory   string       `json:"artifacts_directory,omitempty"`
	SelectedOutcome      string       `json:"selected_outcome"`
	ReleaseComplete      bool         `json:"release_complete"`
	MissingRequiredGates []string     `json:"missing_required_gates,omitempty"`
	Gates                []GateResult `json:"gates"`
}

func Execute

func Execute(ctx context.Context, matrix Matrix, options Options) (Report, error)

Execute evaluates prerequisites for every gate and runs the selected set. Unselected required gates remain not_run and therefore keep ReleaseComplete false. A missing prerequisite is blocked, never passed.

type RunLineage

type RunLineage struct {
	CampaignID     string `json:"campaign_id"`
	Kind           string `json:"kind"`
	Population     int    `json:"population"`
	ArtifactSHA256 string `json:"artifact_sha256,omitempty"`
}

RunLineage is chronological. Earlier failed/full and focused rows bind the raw canonical bytes of their verified campaign closures. The last row is the predeclared final campaign; its post-run closure is supplied separately to acceptance and cannot be written into this pre-run candidate declaration.

type Scope

type Scope string
const (
	ScopeLocal Scope = "local"
	ScopeAll   Scope = "all"
)

type Selection

type Selection string
const (
	SelectionDefault Selection = "default"
	SelectionOptIn   Selection = "opt_in"
)

type SkipPolicy

type SkipPolicy string
const (
	SkipForbid SkipPolicy = "forbid"
	SkipRecord SkipPolicy = "record"
)

type Status

type Status string
const (
	StatusReady   Status = "ready"
	StatusPassed  Status = "passed"
	StatusFailed  Status = "failed"
	StatusBlocked Status = "blocked"
	StatusNotRun  Status = "not_run"
)

type VerifiedCampaignClosure

type VerifiedCampaignClosure struct {
	Closure        CampaignClosure
	Result         bench.Result
	SourceReceipts []CampaignArtifactReceipt
	Predecessors   []CampaignClosure
}

VerifiedCampaignClosure contains the verified final result and closure.

func VerifyCampaignClosure

func VerifyCampaignClosure(path string) (VerifiedCampaignClosure, error)

VerifyCampaignClosure reopens all bound artifacts, recursively verifies the predecessor chain, and returns the exact final benchmark result.

Directories

Path Synopsis
cmd
campaignclosure command
releasevalidate command

Jump to

Keyboard shortcuts

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