testvaliditydoc

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 15 Imported by: 0

Documentation

Overview

Package testvaliditydoc builds the corvint-test-validity/0 document (docs/specs/live-proof-carrying-verification-v0.md LPCV-V0-051): the shared five-axis projection of every test-level result a JavaScript receipt or Go preview-session event carries. Projections are recomputed from observations, never trusted from the input. The corvint test-validity verb and the experimental MCP test-validity profile both call this package.

Index

Constants

View Source
const (
	// EvidenceDirectory is the one worktree-relative retained-evidence
	// location discovery reads (LPCV-V0-053, decision 0202).
	EvidenceDirectory = ".corvint/test-evidence"
	// MaxEvidenceEntries bounds the retained-evidence directory listing.
	MaxEvidenceEntries = 256
	// MaxDiscoveryAttempts bounds how many newest candidates are read.
	MaxDiscoveryAttempts = 16
)
View Source
const (
	// Schema names the emitted document.
	Schema = "corvint-test-validity/0"
	// MaxInputBytes bounds one provider document.
	MaxInputBytes = 4 << 20
)

Variables

View Source
var ErrInputTooLarge = errors.New("receipt exceeds 4 MiB")

ErrInputTooLarge identifies a receipt that exceeds the input byte bound.

Functions

func ReadFile

func ReadFile(root *os.Root, name string) ([]byte, error)

ReadFile reads a resolved, root-relative receipt without following symlinks. Each directory is pinned before descent, as in contextindex's blob reader.

Types

type Discovery

type Discovery struct {
	Location  string             `json:"location"`
	Evidence  string             `json:"evidence,omitempty"`
	Freshness *testvalidity.Axis `json:"freshness,omitempty"`
	Skipped   int                `json:"skipped"`
}

Discovery records which retained document was selected and whether its bound identity still matches the worktree. It is emitted only by discovery.

type DiscoveryError

type DiscoveryError struct{ Code, Message string }

DiscoveryError is a coded discovery refusal shared by the CLI and MCP tool.

func (*DiscoveryError) Error

func (failure *DiscoveryError) Error() string

type Document

type Document struct {
	Playwright   *jstestprovider.Receipt `json:"playwright,omitempty"`
	Schema       string                  `json:"schema"`
	Source       string                  `json:"source"`
	Kind         string                  `json:"kind"`
	Tests        []Test                  `json:"tests"`
	Run          testvalidity.Projection `json:"run"`
	TestsOmitted int                     `json:"testsOmitted,omitempty"`
	Tier         string                  `json:"tier,omitempty"`
	Promotable   *bool                   `json:"promotable,omitempty"`
	Discovery    *Discovery              `json:"discovery,omitempty"`
}

Document is the corvint-test-validity/0 document. Tier and Promotable are present only for preview inputs, keeping JavaScript output byte-identical.

func Discover

func Discover(root string) (Document, error)

Discover projects the newest completed provider document retained under EvidenceDirectory of the absolute worktree root. It lists only that one directory, reads beyond it only the confined files the document binds, never follows a symlink, and writes nothing.

func Project

func Project(input Input) Document

Project recomputes every per-test and run projection from the decoded observations. No carried projection is consulted.

func ProjectPinned

func ProjectPinned(input Input, lookup func(string) ([]byte, bool)) Document

ProjectPinned recomputes native observations and binds their original source digest keys through the caller's explicit immutable source lookup. It grants no adequacy or run-authenticity claim, and an opaque Go session identity stays unverifiable, matching retained-evidence discovery.

func Unsupported

func Unsupported() Document

Unsupported is the document for no input: no test-level evidence, so the run projection states every axis UNSUPPORTED (LPCV-V0-049), never a pass.

type Input

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

Input is one closed provider input accepted by Decode. Its fields remain private so Project can receive only a successfully classified document.

func Decode

func Decode(data []byte) (Input, error)

Decode classifies and decodes exactly one closed JavaScript provider document or completed Go preview-session event. Unknown and ambiguous kinds are refused instead of guessed; callers expose the shared coded refusal.

type Test

type Test struct {
	ID         string                          `json:"id,omitempty"`
	Project    *jstestprovider.ProjectIdentity `json:"project,omitempty"`
	Attempts   []jstestprovider.Attempt        `json:"attempts,omitempty"`
	Name       string                          `json:"name"`
	Package    string                          `json:"package,omitempty"`
	State      string                          `json:"state"`
	Projection testvalidity.Projection         `json:"projection"`
}

Test is one test-level observation and its recomputed projection. Package is emitted only for Go, whose test identity is the (package, name) pair.

Jump to

Keyboard shortcuts

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