sourcebundle

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 28 Imported by: 1 module, 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 sourcebundle implements the provider-neutral recording half of the candidate evidence plug-in. It retains only newly executed attempts, seals a credential-free source bundle, and leaves advisory model evaluation to a separately composed offline review plug-in.

Index

Constants

View Source
const (
	ManifestFormat        = "openrealtime.candidate-source-bundle"
	ManifestFormatVersion = 1
	ReceiptFormat         = "openrealtime.candidate-source-receipt"
	ReceiptFormatVersion  = 1
)

Variables

This section is empty.

Functions

func Verify

func Verify(ctx context.Context, directory, receiptPath string) (Manifest, Receipt, error)

func VerifyReceiptPayload

func VerifyReceiptPayload(ctx context.Context, payload []byte) (Manifest, Receipt, error)

VerifyReceiptPayload reopens a candidate source tree against exact canonical receipt bytes already read by an outer closure. It avoids a second path read and the corresponding receipt-replacement race.

Types

type Artifact

type Artifact struct {
	Name        string `json:"name"`
	Kind        string `json:"kind"`
	Role        string `json:"role"`
	ContentType string `json:"content_type"`
	Path        string `json:"path"`
	SHA256      string `json:"sha256"`
	SizeBytes   int64  `json:"size_bytes"`
}

type AttemptEntry

type AttemptEntry struct {
	AttemptID        string            `json:"attempt_id"`
	Suite            string            `json:"suite"`
	Case             string            `json:"case"`
	Trial            int               `json:"trial"`
	Directory        string            `json:"directory"`
	MediaSource      string            `json:"media_source"`
	AttemptPath      string            `json:"attempt_path"`
	AttemptSHA256    string            `json:"attempt_sha256"`
	CompletionPath   string            `json:"completion_path,omitempty"`
	CompletionSHA256 string            `json:"completion_sha256,omitempty"`
	ContextPath      string            `json:"review_context_path,omitempty"`
	ContextSHA256    string            `json:"review_context_sha256,omitempty"`
	Media            *review.Media     `json:"review_media,omitempty"`
	Artifacts        []Artifact        `json:"artifacts"`
	Deterministic    bench.TaskOutcome `json:"deterministic_outcome,omitempty"`
	EvidenceComplete bool              `json:"evidence_complete"`
	Terminal         string            `json:"terminal"`
}

type Bundle

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

func New

func New(options Options) (*Bundle, error)

func Resume

func Resume(ctx context.Context, options Options) (*Bundle, error)

Resume reopens an interrupted, unsealed current-run source bundle. Only an attempt with a canonical entry.json commit marker written after every other file is recoverable. A directory without that marker is preserved under interruptions/ and its identity becomes available for a clean retry.

A final manifest or external receipt is deliberately not a partial source: callers must use Verify/review-candidate for a sealed campaign. This keeps deterministic execution recovery separate from advisory-review recovery.

func (*Bundle) BeginAttempt

func (bundle *Bundle) BeginAttempt(
	ctx context.Context, specification candidate.Attempt,
) (candidate.AttemptEvidence, error)

func (*Bundle) BindRun

func (bundle *Bundle) BindRun(
	ctx context.Context, suite string, cell bench.Cell, provenance bench.Provenance,
	origin candidate.RunOrigin,
) (bench.Provenance, error)

BindRun binds a fresh or resumed source bundle to exactly one candidate run. A resumed process may have a new wall-clock start observation, but it must be the same immutable build on the same host. The original start time remains authoritative for the final campaign provenance.

func (*Bundle) Close

func (bundle *Bundle) Close() error

Close releases an unsealed bundle after a pre-run or attempt-admission failure. It never deletes retained partial evidence and cannot race an active attempt or a suite seal.

func (*Bundle) FinishSuite

func (bundle *Bundle) FinishSuite(ctx context.Context, result bench.Result) (resultErr error)

func (*Bundle) RecoverAttempt

func (bundle *Bundle) RecoverAttempt(
	ctx context.Context, specification candidate.Attempt,
) (candidate.Recovery, bool, error)

RecoverAttempt returns one exact durable completion from a reopened bundle. Each retained identity can be claimed only once by the new lifecycle.

type Manifest

type Manifest struct {
	Format        string              `json:"format"`
	FormatVersion int                 `json:"format_version"`
	Complete      bool                `json:"complete"`
	Suite         string              `json:"suite"`
	Cell          bench.Cell          `json:"cell"`
	Provenance    bench.Provenance    `json:"provenance"`
	Origin        candidate.RunOrigin `json:"run_origin"`
	AttemptCount  int                 `json:"attempt_count"`
	ResultPath    string              `json:"result_path"`
	ResultSHA256  string              `json:"result_sha256"`
	ReviewPath    string              `json:"review_path"`
	ReviewSHA256  string              `json:"review_sha256"`
	FileSetSHA256 string              `json:"file_set_sha256"`
	Files         []SourceFile        `json:"files"`
	Attempts      []AttemptEntry      `json:"attempts"`
	Advisory      string              `json:"advisory_review_status"`
}

type Options

type Options struct {
	Directory       string
	ReceiptPath     string
	SensitiveValues []string
}

type Receipt

type Receipt struct {
	Format         string `json:"format"`
	FormatVersion  int    `json:"format_version"`
	Directory      string `json:"directory"`
	ManifestSHA256 string `json:"manifest_sha256"`
	FileSetSHA256  string `json:"file_set_sha256"`
	AttemptCount   int    `json:"attempt_count"`
	ReceiptSHA256  string `json:"receipt_sha256"`
}

type ReviewSource

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

ReviewSource is a verified, credential-free cursor over reviewable attempts in one sealed candidate source bundle. It keeps only metadata in memory and emits one owned request at a time, allowing an evaluator to use bounded worker concurrency even for very large benchmark populations.

func OpenReviewSource

func OpenReviewSource(
	ctx context.Context, directory, receiptPath string,
) (*ReviewSource, error)

OpenReviewSource verifies the complete source receipt before exposing any provider-ready input. Advisory provider credentials are deliberately not an option here and never become source-bundle state.

func (*ReviewSource) Close

func (source *ReviewSource) Close(ctx context.Context) error

Close releases the cursor and re-verifies the source receipt after the last consumer read. A mutation during a long advisory campaign therefore fails the campaign even though each individual Evaluate call also snapshots and validates the exact bytes it sent.

func (*ReviewSource) Manifest

func (source *ReviewSource) Manifest() (Manifest, error)

Manifest returns an owned metadata snapshot. The authoritative deterministic outcome remains result.json in the receipt-bound source tree.

func (*ReviewSource) Next

func (source *ReviewSource) Next(
	ctx context.Context, sensitiveValues []string,
) (request review.Request, found bool, resultErr error)

Next returns the next reconstructable review request. Attempts without a complete context/media pair remain in the source manifest and REVIEW.md but are skipped because no multimodal provider can truthfully assess them.

func (*ReviewSource) Receipt

func (source *ReviewSource) Receipt() (Receipt, error)

Receipt returns the exact portable receipt verified when the cursor opened.

type SourceFile

type SourceFile struct {
	Path      string `json:"path"`
	Purpose   string `json:"purpose,omitempty"`
	SHA256    string `json:"sha256"`
	SizeBytes int64  `json:"size_bytes"`
}

Jump to

Keyboard shortcuts

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