Help us shape the future of Go! Take the 2026 Go Developer Survey

optimisation

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package optimisation computes reviewable proposals from explicitly supplied evidence. It cannot read source, call a model, publish or dispatch a workflow.

Index

Constants

View Source
const MaxCheckoutSourceBytes = 32 << 10

Variables

View Source
var ErrUnsupported = errors.New("checkout preview needs pinned regular workflow source, matching successful timing evidence, reviewed history needs and source/edit policy")

Functions

func CheckCurrent

func CheckCurrent(p Preview, s Source, policy Policy) error

CheckCurrent is a local precondition, not publication authorisation. The future publisher must independently fetch the head and recheck policy immediately.

Types

type HistoryReview

type HistoryReview struct {
	HeadSHA      string
	SourceSHA256 string
	Scope        string
	NeedsHistory *bool
}

HistoryReview explicitly covers repository tooling and downstream consumers. Source scanning alone cannot discover every need for tags or commit history.

type Policy

type Policy struct {
	SourceAllowed        bool
	WorkflowEditsAllowed bool
}

type Preview

type Preview struct {
	Version      string
	Kind         string
	State        string
	HeadSHA      string
	SourceSHA256 string
	AfterSHA256  string
	EvidenceID   string
	RunID        string
	Attempt      int
	JobIndex     int
	StepIndex    int
	Line         int
	CheckoutMS   int64
	Edit         prrepair.Edit
	File         prrepair.File
	Verification string
	Explanation  string
}

func PreviewCheckout

func PreviewCheckout(s Source, timing Timing, history HistoryReview, policy Policy) (Preview, error)

type Source

type Source struct {
	HeadSHA string
	File    prrepair.File
}

type Timing

type Timing struct {
	EvidenceID   string
	HeadSHA      string
	SourceSHA256 string
	RunID        string
	Attempt      int
	JobIndex     int
	StepIndex    int
	Outcome      string
	CheckoutMS   *int64
}

Timing is caller-supplied, not independently attested by this package. A future collector must bind the exact run, attempt and step before admitting it.

Jump to

Keyboard shortcuts

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