run

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyCommitted = errors.New("run: already committed")

ErrAlreadyCommitted is returned by Builder.Commit for a run that already has a manifest. A manifest is the immutable record of what one run saw, so a run gets exactly one: committing twice would leave two manifests claiming to be that record, and every later `readproof manifest run-a` / `readproof replay run-a` picking between them arbitrarily.

View Source
var ErrNotFound = errors.New("run: not found")

ErrNotFound is returned by RunStore.GetRun, and by Builder.Commit, when no Run matches.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Runs      RunStore
	Manifests manifest.Store
	Resolver  *resolver.Resolver
	Clock     func() time.Time
}

Builder is the CLI-only orchestrator standing in for the future SDK's readproof.run({id}).mount(uri)...commit() flow.

func (*Builder) Commit

func (b *Builder) Commit(ctx context.Context, runID string) (man manifest.Manifest, err error)

Commit builds and persists the immutable Manifest from all staged mounts, preserving entry order by construction. It fails with ErrNotFound for a run that was never started and ErrAlreadyCommitted for one that already has a manifest — committing an unknown run id used to succeed and hand back an empty manifest, which is indistinguishable from "this agent genuinely read nothing" and is the one answer a provenance record must never invent.

The readproof.run.commit span carries the Merkle root of the committed entries — the same value `readproof evidence export` puts in the bundle's in-toto subject digest (see internal/merkle). That makes the trace and the evidence bundle joinable on a single field: given a trace, an auditor can tell whether a bundle they were handed describes that exact run.

func (*Builder) Mount

func (b *Builder) Mount(ctx context.Context, runID, rawURI string) (result resolver.ResolveResult, err error)

Mount resolves rawURI via the same pipeline `readproof get` uses — including a trailing "@<tag>" — then stages it as the next entry in the run. The entry records the bare URI and the ref separately, so what the run mounted stays readable without re-parsing the combined string.

The whole mount is one readproof.run.mount span, so the readproof.resolve tree and the readproof.manifest.append that records it hang off the same parent: a reader of the trace sees "this run mounted this URI, and here is everything that took" rather than two unrelated subtrees.

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, runID string, uris []string) (manifest.Manifest, error)

Run is the single-shot convenience wrapper: Start -> Mount* -> Commit.

func (*Builder) Start

func (b *Builder) Start(ctx context.Context, runID string) error

Start opens a run. readproof.run.id is on this span and on every later readproof.run.mount/readproof.run.commit because a run legitimately spans processes (`readproof run start`, then `readproof run mount` from a worker, then `readproof run commit`): with no ambient span to share, that attribute is the only thing joining them.

type MountEntry

type MountEntry struct {
	Position int
	// URI is the bare readproof://<ns>/<path>; Ref is the "@<tag>" it was
	// mounted by, or "" — see manifest.Entry.
	URI               string
	Ref               string
	SnapshotID        string
	MaterializationID string
	ContentHash       string
}

MountEntry is one resolved resource staged into an open Run before commit.

type Run

type Run struct {
	RunID       string
	Status      Status
	CreatedAt   time.Time
	CommittedAt *time.Time
	ManifestID  string
}

type RunStore

type RunStore interface {
	StartRun(ctx context.Context, runID string) error
	GetRun(ctx context.Context, runID string) (Run, error)
	AppendMount(ctx context.Context, runID string, e MountEntry) error
	ListMounts(ctx context.Context, runID string) ([]MountEntry, error)
	MarkCommitted(ctx context.Context, runID, manifestID string) error
}

RunStore persists in-progress runs across separate CLI process invocations (there is no daemon holding this state in memory).

type Status

type Status string
const (
	StatusOpen      Status = "open"
	StatusCommitted Status = "committed"
)

Jump to

Keyboard shortcuts

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