oracle

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package oracle owns the frozen legacy evidence format and its integrity checks.

Index

Constants

View Source
const Version = 1

Variables

This section is empty.

Functions

func ConfigureCommand

func ConfigureCommand(cmd *exec.Cmd)

ConfigureCommand cancels all compiler descendants with their command owner.

func CountSymbols

func CountSymbols(data []byte) (functions int, definedSymbols int, auditFunctions int, err error)

CountSymbols is shared by the live footprint gate and the legacy recorder.

func Digest

func Digest(data []byte) string

func Directory

func Directory() string

func Inventory

func Inventory(dir string) (map[string]bool, []string, error)

Inventory finds stable assertion sites and their owning test-file entry points.

func JSON

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

func ModelSnapshot

func ModelSnapshot(value any) string

func Publish

func Publish(dir string, b Bundle, refreeze bool) error

Publish publishes a reviewed legacy capture bundle.

func ReadJSON

func ReadJSON(path string, value any) error

func SelectedSites

func SelectedSites(dir string, tests []string) (map[string]bool, error)

func Snapshot

func Snapshot(value any) string

Snapshot records structure, not Go formatting. Named model identities are intentionally erased so separately generated and handwritten models compare. Kind tags, lengths, field names and presence survive that normalization.

func Unconsumed

func Unconsumed(b Bundle, prefix string, consumed map[string]bool, selection Selection) ([]string, error)

Unconsumed checks every frozen occurrence selected by the test flags, including tests that emitted no observations and selected parents of filtered subtests.

func Validate

func Validate(b Bundle) error

Types

type AuditedSource

type AuditedSource struct {
	PostgresTests []string `json:"postgres_tests,omitempty"`
	SHA256        string   `json:"sha256"`
	Tests         []string `json:"paired_tests,omitempty"`
}

type BuildEnvironment

type BuildEnvironment struct {
	GOFLAGS      string
	GOWORK       string
	GOENV        string
	GOOS         string
	GOARCH       string
	CGO_ENABLED  string
	GOEXPERIMENT string
	GOTOOLCHAIN  string
	GOMOD        string
	GOROOT       string
	GOVERSION    string
	GCFlags      string
}

BuildEnvironment is the effective `go env -json` snapshot in each module. GOFLAGS is fixed: overlays, alternate modfiles, tags, gcflags and ldflags are not accepted inputs to an oracle freeze. Workspace and persistent GOENV are off.

func (BuildEnvironment) Validate

func (b BuildEnvironment) Validate(dir string) error

type Bundle

type Bundle struct {
	Version int               `json:"version"`
	Sources map[string]string `json:"source_sha256"`
	Records map[string]Record `json:"records"`
}

func Load

func Load(dir string) (Bundle, error)

Load checks the separate publication receipt before decoding evidence. A missing bundle is allowed only while the checked-in receipt explicitly says pending.

type ComparisonAudit

type ComparisonAudit struct {
	Files map[string]AuditedSource `json:"files"`
}

ComparisonAudit is the historical capture census. Its PostgreSQL entry points remain the source of backend requirements for replay; source hashes describe the retired checkout and are not regenerated from replacement declarations.

type Provenance

type Provenance struct {
	WorkingDirectory string           `json:"working_directory"`
	Build            BuildEnvironment `json:"build"`
	Commit           string           `json:"commit"`
	Sources          string           `json:"source_manifest_sha256"`
	Command          []string         `json:"command"`
	Toolchain        string           `json:"toolchain"`
	Platform         string           `json:"platform"`
}

type Record

type Record struct {
	Package    string     `json:"package,omitempty"`
	Site       string     `json:"site"`
	Kind       string     `json:"kind"`
	Transcript string     `json:"transcript"`
	Provenance Provenance `json:"provenance"`
}

type Replay

type Replay struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Replay is owned by one test package; the prefix separates identical test names in different fixture packages. Main enforces consumption after all subtests exit.

func NewReplay

func NewReplay(prefix string) *Replay

func NewReplayAt

func NewReplayAt(prefix, directory string) *Replay

NewReplayAt selects an independent frozen bundle, without changing fixture defaults.

func (*Replay) Equal

func (r *Replay) Equal(t *testing.T, site, current string) bool

func (*Replay) Finish

func (r *Replay) Finish(code int) int

Finish checks consumption after a test runner shared by internal and external tests.

func (*Replay) Main

func (r *Replay) Main(m *testing.M) int

func (*Replay) Match

func (r *Replay) Match(t *testing.T, site, current string) bool

Match replays an existing legacy observation.

type Selection

type Selection struct {
	// contains filtered or unexported fields
}

Selection follows Go's slash-separated test regex syntax. Expected records come only from the frozen inventory and flags, never from observed callbacks.

func SelectTests

func SelectTests(run, skip string) (Selection, error)

func (Selection) Includes

func (s Selection) Includes(test string) bool

type State

type State struct {
	Version int    `json:"version"`
	Phase   string `json:"phase"`
	SHA256  string `json:"bundle_sha256,omitempty"`
	Command string `json:"authorization_command,omitempty"`
}

Directories

Path Synopsis
cmd
freeze-oracles command
Command freeze-oracles publishes a reviewed framework legacy capture bundle.
Command freeze-oracles publishes a reviewed framework legacy capture bundle.

Jump to

Keyboard shortcuts

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