doccorpus

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 0

Documentation

Overview

Package doccorpus compiles the proposed DCP-V1 documentation evidence profile. Identity validation does not establish semantic truth or accepted intent.

Index

Constants

View Source
const (
	BehaviorAdapterRequestSchema = "corvint-behavior-adapter-request/1"
	BehaviorAdapterResultSchema  = "corvint-behavior-adapter-result/1"
)
View Source
const (
	MaxProviderBytes       = 64 << 20
	SchemaV2               = "corvint-evidence-corpus/2"
	ManifestSchemaV2       = "corvint-corpus-input/2"
	AdoptionProviderSchema = "corvint-corpus-adoption-provider/1"
	MaxCorpusBytes         = 128 << 20
	MaxCorpusRecords       = 100000
	MaxCorpusJourneys      = 4096
)
View Source
const (
	StabilitySchema                 = "corvint-playwright-stability/1"
	BehaviorStabilityProviderSchema = "corvint-corpus-behavior-stability-provider/1"
	StabilityTopologySchema         = "corvint-playwright-stability-topology/1"
)
View Source
const (
	Schema         = "corvint-evidence-corpus/1"
	ManifestSchema = "corvint-corpus-input/1"
	ProviderSchema = "corvint-corpus-provider/1"
	ReceiptSchema  = "corvint-corpus-receipt/2"
	MaxBytes       = 4 << 20
	MaxRecords     = 4096
	MaxResults     = 256
)
View Source
const BehaviorProviderRequestSchemaV2 = "corvint-behavior-provider-request/2"
View Source
const BehaviorProviderSchema = "corvint-corpus-behavior-provider/1"

BehaviorProviderSchema is experimental: declarations never authorize narrowing.

View Source
const BehaviorProviderSchemaV2 = "corvint-corpus-behavior-provider/2"

BehaviorProviderSchemaV2 names every participating repository in the registry's repositories list instead of the three fixed revisions members (AFU-V1-006). Corpus ingestion keeps /2 declarations separate from /1 runtime reconciliation.

View Source
const IncrementalSchema = "corvint-corpus-incremental-cache/0"
View Source
const MaxIndexKeyBytes = 16 << 20
View Source
const MaxIndexPostings = 1000000

Variables

This section is empty.

Functions

func BuildIncremental

func BuildIncremental(ctx context.Context, root string, m Manifest, ids []ShardIdentity, priorRaw []byte, expected string) (*Artifact, *IncrementalCache, IncrementalStats, error)

BuildIncremental pins all original bytes and freshly preloads restrictions. The expected cache digest must come from an operator-pinned previous Result. Unsupported units use the ordinary import path; no speedup is asserted.

func BuildIncrementalVerified

func BuildIncrementalVerified(ctx context.Context, root string, m Manifest, ids []ShardIdentity, priorRaw []byte, expected string) (VerifiedCorpus, *IncrementalCache, IncrementalStats, error)

func CEMProjection

func CEMProjection(ctx context.Context, root string, a *Artifact, data []byte, claimID string) (map[string]any, error)

CEMProjection preserves the immutable original span and carries corpus provenance beside the frozen wire. It never cites generated prose as intent.

func CapabilityFor

func CapabilityFor(operation string) string

func Digest

func Digest(data []byte) string

func EligibilityDigest

func EligibilityDigest(ids []ShardIdentity) (string, error)

func Encode

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

func EncodeIncrementalCache

func EncodeIncrementalCache(cache IncrementalCache) ([]byte, error)

func Freshness

func Freshness(ctx context.Context, root string, a *Artifact) (string, []string, error)

Freshness is a live overlay; it never rewrites the immutable artifact.

func Impact

func Impact(a *Artifact, paths []string, freshness string) map[string]any

Impact connects exact path/symbol anchors to subjects and explicit directed relations. It does not infer a dependency from shared citations.

func NegativeStabilityThreshold

func NegativeStabilityThreshold(t StabilityThreshold) bool

func OpenIncrementalVerified

func OpenIncrementalVerified(ctx context.Context, root string, raw []byte, ids []ShardIdentity, priorRaw []byte, expected string) (VerifiedCorpus, IncrementalStats, error)

OpenIncrementalVerified rederives the complete prior corpus from pinned sources under the same provider/global predicates. Cache admission compares every retained record with its normalized original. Original canonical bytes must still match; ParseArtifact or a supplied cache digest alone never qualifies.

func OperationInput

func OperationInput(op string) string

OperationInput is shared by CLI, MCP and indexed companions. The native Query function retains compatibility with older permissive pure callers.

func ReadCorpusFile

func ReadCorpusFile(root, path string) ([]byte, error)

ReadCorpusFile admits a bounded /2 manifest or artifact; its decoder still enforces the original limit for /1 and for independent receipt profiles.

func ReadFile

func ReadFile(root, path string) ([]byte, error)

func RetirementInputSchema

func RetirementInputSchema() map[string]any

func StabilityThresholdPassed

func StabilityThresholdPassed(counts StabilityCounts, threshold StabilityThreshold) bool

func ValidateBehaviorProviderV2

func ValidateBehaviorProviderV2(p ProviderRecord) error

ValidateBehaviorProviderV2 checks a /2 provider record: a non-empty list of repositories sorted by unique root commit, no /1 revisions member, a source that is one of the listed repositories, and a contract digest that covers the declarations exactly as /1 does.

func ValidateEligibility

func ValidateEligibility(ids []ShardIdentity) error

Types

type Anchor

type Anchor struct {
	Repository string `json:"repository"`
	Revision   string `json:"revision"`
	Path       string `json:"path"`
	Blob       string `json:"blob"`
	SHA256     string `json:"sha256"`
	Start      int    `json:"start_line"`
	End        int    `json:"end_line"`
	SpanSHA256 string `json:"span_sha256"`
	Symbol     string `json:"symbol"`
	Region     string `json:"region"`
	Authority  string `json:"authority"`
	Kind       string `json:"evidence_kind"`
	Reason     string `json:"reason"`
}

type Artifact

type Artifact struct {
	// RuntimeIndex is derived resident state, never evidence or serialized authority.
	RuntimeIndex        *QueryIndex              `json:"-"`
	Details             map[string]RecordDetails `json:"details,omitempty"`
	ImportParity        []ImportParity           `json:"import_parity,omitempty"`
	RestrictedSummaries []RestrictedSummary      `json:"restricted_summaries,omitempty"`
	BehaviorContracts   []BehaviorReport         `json:"behavior_contracts,omitempty"`
	StabilityEvidence   []StabilityReport        `json:"stability_evidence,omitempty"`
	Schema              string                   `json:"schema"`
	Builder             Builder                  `json:"builder"`
	Manifest            Manifest                 `json:"manifest"`
	ManifestSHA256      string                   `json:"manifest_sha256"`
	ProfileSHA256       string                   `json:"profile_sha256"`
	Tree                string                   `json:"tree"`
	Subjects            []Subject                `json:"subjects"`
	Claims              []Claim                  `json:"claims"`
	Relations           []Relation               `json:"relations"`
	Journeys            []Journey                `json:"journeys"`
	Observations        []Observation            `json:"observations"`
	Capabilities        []Capability             `json:"capabilities"`
	Gaps                []Gap                    `json:"gaps"`
	SHA256              string                   `json:"sha256"`
}

func Build

func Build(ctx context.Context, root string, m Manifest) (*Artifact, error)

Build compiles only original immutable inputs. No output is written to disk.

func Open

func Open(ctx context.Context, root string, data []byte) (*Artifact, error)

Open reconstructs all derived records before allowing a query.

func ParseArtifact

func ParseArtifact(data []byte) (*Artifact, error)

func (*Artifact) HasCapability

func (a *Artifact) HasCapability(name string) bool

type BehaviorAdapterArtifact

type BehaviorAdapterArtifact struct {
	Role     string `json:"role"`
	Input    string `json:"input"`
	Anchor   Anchor `json:"anchor"`
	SHA256   string `json:"sha256"`
	Document string `json:"document"`
}

type BehaviorAdapterClaimRecord

type BehaviorAdapterClaimRecord struct {
	TestID string                   `json:"test_id"`
	Claim  BehaviorAdapterTestClaim `json:"claim"`
}

type BehaviorAdapterCoverage

type BehaviorAdapterCoverage struct {
	Metric      string   `json:"metric"`
	Value       int      `json:"value"`
	Denominator int      `json:"denominator"`
	Defined     bool     `json:"defined"`
	State       string   `json:"state"`
	Revision    string   `json:"revision"`
	Rule        string   `json:"rule"`
	Limitations []string `json:"limitations"`
}

type BehaviorAdapterDelta

type BehaviorAdapterDelta struct {
	AddedCriteria     []string `json:"added_criteria"`
	RemovedCriteria   []string `json:"removed_criteria"`
	ChangedCriteria   []string `json:"changed_criteria"`
	LostReverseLinks  []string `json:"lost_reverse_links"`
	PreviousAvailable bool     `json:"previous_available"`
}

type BehaviorAdapterDiagnostic

type BehaviorAdapterDiagnostic struct {
	Kind       string `json:"kind"`
	Subject    string `json:"subject"`
	Input      string `json:"input"`
	Field      string `json:"field"`
	Revision   string `json:"revision"`
	Digest     string `json:"digest"`
	Detail     string `json:"detail"`
	Correction string `json:"correction"`
}

type BehaviorAdapterInput

type BehaviorAdapterInput struct {
	ID       string `json:"id"`
	Anchor   Anchor `json:"anchor"`
	Document string `json:"document"`
}

type BehaviorAdapterMapping

type BehaviorAdapterMapping struct {
	Kind    string            `json:"kind"`
	Input   string            `json:"input"`
	Records string            `json:"records"`
	Fields  map[string]string `json:"fields"`
}

type BehaviorAdapterOutcome

type BehaviorAdapterOutcome struct {
	ID       string `json:"id"`
	Behavior string `json:"behavior"`
	Matcher  string `json:"matcher"`
	Locator  string `json:"locator"`
	Value    string `json:"value"`
}

type BehaviorAdapterRequest

type BehaviorAdapterRequest struct {
	Schema                string                   `json:"schema"`
	ProviderID            string                   `json:"provider_id"`
	ProviderVersion       string                   `json:"provider_version"`
	ContractID            string                   `json:"contract_id"`
	Source                Repository               `json:"source"`
	Revisions             BehaviorRevisions        `json:"revisions"`
	SourceRevision        string                   `json:"source_revision"`
	DocumentationRevision string                   `json:"documentation_revision"`
	MigrationInput        string                   `json:"migration_input"`
	DiscoveryInput        string                   `json:"discovery_input"`
	Inputs                []BehaviorAdapterInput   `json:"inputs"`
	Mappings              []BehaviorAdapterMapping `json:"mappings"`
	Observations          []ObservationLink        `json:"observations"`
}

type BehaviorAdapterResult

type BehaviorAdapterResult struct {
	Schema      string                       `json:"schema"`
	Provider    ProviderRecord               `json:"provider"`
	Variations  []BehaviorAdapterVariation   `json:"variations"`
	Claims      []BehaviorAdapterClaimRecord `json:"claims"`
	Artifacts   []BehaviorAdapterArtifact    `json:"artifacts"`
	Coverage    []BehaviorAdapterCoverage    `json:"coverage"`
	Frontier    []BehaviorAdapterDiagnostic  `json:"frontier"`
	Delta       BehaviorAdapterDelta         `json:"delta"`
	Fallback    string                       `json:"fallback"`
	Limitations []string                     `json:"limitations"`
}

func BuildBehaviorAdapter

func BuildBehaviorAdapter(requestRaw, previousRaw []byte) (BehaviorAdapterResult, error)

type BehaviorAdapterTestClaim

type BehaviorAdapterTestClaim struct {
	VariationID     string   `json:"variation_id"`
	Preconditions   []string `json:"preconditions"`
	Actions         []string `json:"actions"`
	ObservableFacts []string `json:"observable_facts"`
}

type BehaviorAdapterVariation

type BehaviorAdapterVariation struct {
	ID               string                   `json:"variation_id"`
	Flow             string                   `json:"flow"`
	Preconditions    []string                 `json:"preconditions"`
	Actions          []string                 `json:"actions"`
	ObservableFacts  []string                 `json:"observable_facts"`
	ExpectedOutcomes []BehaviorAdapterOutcome `json:"expected_outcomes"`
	Projects         []string                 `json:"projects"`
	Tests            []string                 `json:"tests"`
}

type BehaviorAssertion

type BehaviorAssertion struct {
	ID         string `json:"id"`
	Behavior   string `json:"behavior"`
	Criterion  string `json:"criterion"`
	Annotation Anchor `json:"reviewed_annotation"`
	Matcher    string `json:"matcher"`
	Locator    string `json:"locator"`
	Value      string `json:"value"`
}

type BehaviorDiscovery

type BehaviorDiscovery struct {
	Schema     string              `json:"schema"`
	Mode       string              `json:"mode"`
	Revisions  BehaviorRevisions   `json:"revisions"`
	Config     Anchor              `json:"config"`
	Executions []BehaviorExecution `json:"executions"`
}

type BehaviorEvent

type BehaviorEvent struct {
	Context    string `json:"browser_context"`
	Page       string `json:"page"`
	Frame      string `json:"frame"`
	Navigation string `json:"navigation"`
	ParentPage string `json:"parent_page"`
	Behavior   string `json:"behavior"`
	Criterion  string `json:"criterion"`
	Matcher    string `json:"matcher"`
	Locator    string `json:"locator"`
	Value      string `json:"value"`
	Sequence   int    `json:"sequence"`
	Kind       string `json:"kind"`
	ID         string `json:"id"`
	Passed     bool   `json:"passed"`
}

type BehaviorExecution

type BehaviorExecution struct {
	ID       string `json:"id"`
	Project  string `json:"project"`
	Evidence Anchor `json:"evidence"`
}

type BehaviorFlow

type BehaviorFlow struct {
	Derivation       string          `json:"derivation"`
	ID               string          `json:"id"`
	Evidence         Anchor          `json:"evidence"`
	Criteria         []string        `json:"criteria"`
	Tests            []string        `json:"tests"`
	RequiredPages    []string        `json:"required_pages"`
	NegativeControls []string        `json:"negative_controls"`
	OrderedEvents    []BehaviorEvent `json:"ordered_events"`
	MissingReview    *Anchor         `json:"missing_e2e_review,omitempty"`
}

type BehaviorLegacyCase

type BehaviorLegacyCase struct {
	ID             string                    `json:"id"`
	Suite          string                    `json:"suite"`
	Case           string                    `json:"case"`
	Evidence       Anchor                    `json:"evidence"`
	State          string                    `json:"state"`
	Fixtures       []string                  `json:"fixtures"`
	Roles          []string                  `json:"roles"`
	Criteria       []BehaviorLegacyCriterion `json:"criteria"`
	Runtime        *BehaviorRuntime          `json:"runtime,omitempty"`
	RuntimeTestID  string                    `json:"runtime_test_id,omitempty"`
	RuntimeProject string                    `json:"runtime_project,omitempty"`
}

Legacy criteria describe observables, not test-name similarity or inferred intent.

type BehaviorLegacyCriterion

type BehaviorLegacyCriterion struct {
	ID       string `json:"id"`
	Evidence Anchor `json:"evidence"`
	Matcher  string `json:"matcher"`
	Locator  string `json:"locator"`
	Value    string `json:"value"`
}

type BehaviorLegacyMapping

type BehaviorLegacyMapping struct {
	Criterion       string `json:"criterion"`
	LegacyCase      string `json:"legacy_case"`
	LegacyCriterion string `json:"legacy_criterion"`
	Relation        string `json:"relation"`
	Review          Anchor `json:"review"`
}

type BehaviorLegacyRun

type BehaviorLegacyRun struct {
	Schema         string                    `json:"schema"`
	ContractSHA256 string                    `json:"contract_sha256"`
	Revisions      BehaviorRevisions         `json:"revisions"`
	CaseID         string                    `json:"case_id"`
	SourceSHA256   string                    `json:"source_sha256"`
	RunSHA256      string                    `json:"run_sha256"`
	TestID         string                    `json:"test_id"`
	Project        string                    `json:"project"`
	Retry          int                       `json:"retry"`
	Cleanup        string                    `json:"cleanup"`
	Fixtures       []string                  `json:"fixtures"`
	Roles          []string                  `json:"roles"`
	Criteria       []BehaviorLegacyCriterion `json:"criteria"`
}

type BehaviorMigration

type BehaviorMigration struct {
	Revisions             BehaviorRevisions `json:"revisions"`
	Schema                int               `json:"schema"`
	ContractID            string            `json:"contract_id"`
	SourceRevision        string            `json:"source_revision"`
	DocumentationRevision string            `json:"documentation_revision"`
}

type BehaviorProviderRequestV2

type BehaviorProviderRequestV2 struct {
	Schema   string           `json:"schema"`
	ID       string           `json:"provider_id"`
	Version  string           `json:"provider_version"`
	Source   Repository       `json:"source"`
	Registry BehaviorRegistry `json:"registry"`
}

type BehaviorRegistry

type BehaviorRegistry struct {
	Revisions             BehaviorRevisions    `json:"revisions,omitzero"`
	Repositories          []BehaviorRepository `json:"repositories,omitempty"`
	Discovery             Anchor               `json:"discovery"`
	Schema                int                  `json:"schema"`
	ContractID            string               `json:"contract_id"`
	ContractSHA256        string               `json:"contract_sha256"`
	SourceRevision        string               `json:"source_revision"`
	DocumentationRevision string               `json:"documentation_revision"`
	Manifest              Anchor               `json:"migration_manifest"`
	Flows                 []BehaviorFlow       `json:"flows"`
	Behaviors             []BehaviorSource     `json:"source_behaviors"`
	Tests                 []BehaviorTest       `json:"tests"`
	Legacy                []BehaviorLegacyCase `json:"legacy,omitempty"`
	Stability             *StabilityRegistry   `json:"stability,omitempty"`
}

type BehaviorReport

type BehaviorReport struct {
	ProviderSchema      string            `json:"provider_schema,omitempty"`
	Discovery           BehaviorDiscovery `json:"discovery,omitzero"`
	Provider            string            `json:"provider"`
	Registry            BehaviorRegistry  `json:"registry"`
	VerifiedTests       []string          `json:"verified_tests"`
	LinkedFlows         []string          `json:"linked_flows"`
	LinkedBehaviors     []string          `json:"linked_behaviors"`
	VerifiedFlows       []string          `json:"verified_flows"`
	Fallback            string            `json:"fallback"`
	Limitations         []string          `json:"limitations"`
	LegacyRuntimeParity []string          `json:"legacy_runtime_parity"`
}

type BehaviorRepository

type BehaviorRepository struct {
	RootCommit string `json:"root_commit"`
	Revision   string `json:"revision"`
}

BehaviorRepository is one /2 participating repository: its root commit and the revision the registry was evaluated at.

type BehaviorRevisions

type BehaviorRevisions struct {
	App  Repository `json:"app"`
	E2E  Repository `json:"golf_e2e"`
	Docs Repository `json:"docs_corpus"`
}

type BehaviorRun

type BehaviorRun struct {
	Fixtures              []string          `json:"fixtures,omitempty"`
	Roles                 []string          `json:"roles,omitempty"`
	Revisions             BehaviorRevisions `json:"revisions"`
	Schema                string            `json:"schema"`
	ContractID            string            `json:"contract_id"`
	ContractSHA256        string            `json:"contract_sha256"`
	SourceRevision        string            `json:"source_revision"`
	DocumentationRevision string            `json:"documentation_revision"`
	RunSHA256             string            `json:"run_sha256"`
	TestID                string            `json:"test_id"`
	Project               string            `json:"project"`
	Retry                 int               `json:"retry"`
	Cleanup               string            `json:"cleanup"`
	Events                []BehaviorEvent   `json:"events"`
}

BehaviorRun is a separate, digest-pinned ordered witness, not a passing-test claim.

type BehaviorRuntime

type BehaviorRuntime struct {
	Evidence    Anchor `json:"evidence"`
	Observation string `json:"observation"`
}

type BehaviorSource

type BehaviorSource struct {
	ID       string   `json:"id"`
	Evidence Anchor   `json:"evidence"`
	Flows    []string `json:"flows"`
}

type BehaviorTest

type BehaviorTest struct {
	ID         string                  `json:"id"`
	Project    string                  `json:"project"`
	Title      string                  `json:"title"`
	Evidence   Anchor                  `json:"evidence"`
	Flows      []string                `json:"flows"`
	Criteria   []string                `json:"criteria"`
	Assertions []BehaviorAssertion     `json:"assertions"`
	Runtime    *BehaviorRuntime        `json:"runtime,omitempty"`
	Legacy     []BehaviorLegacyMapping `json:"legacy_criteria,omitempty"`
	Fixtures   []string                `json:"fixtures,omitempty"`
	Roles      []string                `json:"roles,omitempty"`
}

type Builder

type Builder struct {
	Version  string `json:"version"`
	Revision string `json:"revision"`
	Engine   string `json:"engine"`
}

type CachedShard

type CachedShard struct {
	Identity     ShardIdentity     `json:"identity"`
	Fingerprint  string            `json:"fingerprint"`
	Contribution ShardContribution `json:"contribution"`
}

type Capability

type Capability struct {
	RecordsOmitted int      `json:"records_omitted,omitempty"`
	Name           string   `json:"name"`
	State          string   `json:"state"`
	Reason         string   `json:"reason"`
	Records        []string `json:"records"`
	Providers      []string `json:"providers"`
	Tools          []string `json:"tools"`
	Count          int      `json:"count"`
	Denominator    int      `json:"denominator"`
	Rule           string   `json:"rule"`
}

type CapabilityDeclaration

type CapabilityDeclaration struct {
	Name   string `json:"name"`
	State  string `json:"state"`
	Reason string `json:"reason"`
}

type Claim

type Claim struct {
	ID       string   `json:"id"`
	Subject  string   `json:"subject"`
	Text     string   `json:"text"`
	Provider string   `json:"provider"`
	Evidence Evidence `json:"evidence"`
}

type CoverageDetails

type CoverageDetails struct {
	Definition  string   `json:"definition"`
	Denominator []string `json:"denominator"`
	Numerator   []string `json:"numerator"`
	Rule        string   `json:"rule"`
}

type DependencyEdge

type DependencyEdge struct {
	Direction string   `json:"direction"`
	Relation  Relation `json:"relation"`
}

type Error

type Error struct {
	Code    string
	Message string
}

func (*Error) Error

func (e *Error) Error() string

type Evidence

type Evidence struct {
	ReportedTrust string   `json:"reported_trust"`
	Derivation    string   `json:"derivation"`
	Trust         string   `json:"trust"`
	State         string   `json:"state"`
	Freshness     string   `json:"freshness"`
	Anchors       []Anchor `json:"anchors"`
	Unknown       string   `json:"unknown"`
	Limitations   []string `json:"limitations"`
}

type FlowDetails

type FlowDetails struct {
	Sections    []FlowSection `json:"sections"`
	Actors      []string      `json:"actors"`
	Entrypoints []string      `json:"entrypoints"`
	Variations  []string      `json:"variations"`
}

type FlowSection

type FlowSection struct {
	Name       string   `json:"name"`
	Paragraphs []string `json:"paragraphs"`
}

type Gap

type Gap struct {
	Subject string `json:"subject"`
	Kind    string `json:"kind"`
	Reason  string `json:"reason"`
}

type ImportParity

type ImportParity struct {
	Provider   string   `json:"provider"`
	SourceKind string   `json:"source_kind"`
	RecordsIn  int      `json:"records_in"`
	Admitted   int      `json:"admitted"`
	Dropped    int      `json:"dropped"`
	Reasons    []string `json:"reasons"`
}

type IncrementalCache

type IncrementalCache struct {
	Schema            string        `json:"schema"`
	Builder           Builder       `json:"builder"`
	EligibilitySHA256 string        `json:"eligibility_sha256"`
	Shards            []CachedShard `json:"shards"`
}

type IncrementalStats

type IncrementalStats struct {
	Compiled       []ShardIdentity `json:"compiled"`
	Reused         []ShardIdentity `json:"reused"`
	Fallback       []ShardIdentity `json:"fallback"`
	FallbackReason string          `json:"fallback_reason"`
}

type Input

type Input struct {
	Path     string `json:"path"`
	Revision string `json:"revision"`
	Blob     string `json:"blob"`
	SHA256   string `json:"sha256"`
	Provider string `json:"provider"`
	Purpose  string `json:"purpose"`
}

type IntentComparisonDetails

type IntentComparisonDetails struct {
	ReportedIntent []string `json:"reported_intent"`
	ObservedClaims []string `json:"observed_claims"`
	Missing        []string `json:"missing"`
	Conflicts      []string `json:"conflicts"`
}

type Journey

type Journey struct {
	ID            string   `json:"id"`
	Subject       string   `json:"subject"`
	Provider      string   `json:"provider"`
	Status        string   `json:"status"`
	Preconditions []string `json:"preconditions"`
	Cleanup       string   `json:"cleanup"`
	Steps         []Step   `json:"steps"`
	Evidence      Evidence `json:"evidence"`
}

type JourneyRun

type JourneyRun struct {
	Schema         string            `json:"schema"`
	RunSHA256      string            `json:"run_sha256"`
	SourceRevision string            `json:"source_revision"`
	Package        string            `json:"package"`
	Test           string            `json:"test"`
	Cleanup        string            `json:"cleanup"`
	Steps          []StepObservation `json:"steps"`
}

JourneyRun is independently retained step observation data. A native passing test alone cannot populate these ordered expected/observed records.

type Maintenance

type Maintenance struct {
	Schema         string `json:"schema"`
	ArtifactSHA256 string `json:"artifact_sha256"`
	Page           string `json:"page"`
	Before         string `json:"before_sha256"`
	After          string `json:"after_sha256"`
	Recovery       string `json:"recovery_path"`
	Applied        bool   `json:"applied"`
	Proposed       string `json:"proposed"`
}

func Maintain

func Maintain(root, page string, a *Artifact, apply bool) (Maintenance, error)

Maintain derives the proposal in-process. It never accepts caller-authored replacement bytes or a serialized preview as write authority.

type MaintenanceFile

type MaintenanceFile struct {
	Path         string
	Before, Next []byte
}

MaintenanceFile binds an output to the bytes inspected by the caller. Nil Before means exclusive creation. Existing originals remain named, even after success.

type MaintenancePublication

type MaintenancePublication struct {
	Path      string `json:"path"`
	Recovery  string `json:"recovery,omitempty"`
	Published bool   `json:"published"`
}

MaintenancePublication exposes partial progress; it is never a success receipt.

func PublishMaintenancePair

func PublishMaintenancePair(ctx context.Context, root string, files [2]MaintenanceFile, verify func([]MaintenancePublication) error) ([]MaintenancePublication, error)

PublishMaintenancePair stages both files before any capture, then publishes each through no-clobber links. It deliberately offers no pair/crash atomicity. verify runs before staging and again before capture, with exact prospective publication metadata for receipt preflight; checkpoint is a package-private test seam.

type Manifest

type Manifest struct {
	BehaviorRepositories []BehaviorRepository `json:"behavior_repositories,omitempty"`
	BehaviorRevisions    *BehaviorRevisions   `json:"behavior_revisions,omitempty"`
	Schema               string               `json:"schema"`
	Repository           Repository           `json:"repository"`
	BuiltAt              string               `json:"built_at"`
	Profile              Profile              `json:"profile"`
	Scopes               []Scope              `json:"scopes"`
	Inputs               []Input              `json:"inputs"`
	Providers            []Provider           `json:"providers"`
	MergeRule            string               `json:"merge_rule"`
}

func Inventory

func Inventory(ctx context.Context, root, revision, scope, timestamp string) (Manifest, error)

Inventory creates an explicit manifest candidate; it grants no authority.

func ParseManifest

func ParseManifest(data []byte) (Manifest, error)
type NavigationSelector struct {
	ID         string `json:"id"`
	Flow       string `json:"flow"`
	Test       string `json:"test"`
	Locator    string `json:"locator"`
	Annotation Anchor `json:"annotation"`
	Trust      string `json:"trust"`
}

type Observation

type Observation struct {
	Trust       string                   `json:"trust"`
	Limitations []string                 `json:"limitations"`
	Link        ObservationLink          `json:"link"`
	InputSHA256 string                   `json:"input_sha256"`
	Document    testvaliditydoc.Document `json:"document"`
}
type ObservationLink struct {
	TestID         string            `json:"test_id,omitempty"`
	Project        string            `json:"project,omitempty"`
	StepInput      string            `json:"step_input"`
	StepRevision   string            `json:"step_revision"`
	SourcePaths    map[string]string `json:"source_paths"`
	ID             string            `json:"id"`
	Subject        string            `json:"subject"`
	Input          string            `json:"input"`
	InputRevision  string            `json:"input_revision"`
	SourceRevision string            `json:"source_revision"`
	RunID          string            `json:"run_id"`
	Package        string            `json:"package"`
	Test           string            `json:"test"`
	StepEvidence   []Anchor          `json:"step_evidence"`
}

ObservationLink refers to a retained native receipt by immutable input path. Its package/name join is exact, and StepEvidence proves only the provider's recorded expected observation, not an independently assessed assertion.

type ParagraphDetails

type ParagraphDetails struct {
	Flow      string `json:"flow"`
	Section   string `json:"section"`
	StableID  string `json:"stable_id"`
	RetiredTo string `json:"retired_to,omitempty"`
}

type Profile

type Profile struct {
	ID       string   `json:"id"`
	Revision string   `json:"revision"`
	Title    string   `json:"title"`
	Format   string   `json:"format"`
	Groups   []string `json:"groups"`
}

type Provider

type Provider struct {
	Shards   []string `json:"shards,omitempty"`
	ID       string   `json:"id"`
	Kind     string   `json:"kind"`
	Version  string   `json:"version"`
	Revision string   `json:"revision"`
	Record   string   `json:"record"`
}

type ProviderRecord

type ProviderRecord struct {
	Details            map[string]RecordDetails `json:"details,omitempty"`
	RestrictedFindings []RestrictedFinding      `json:"restricted_findings,omitempty"`
	BehaviorContracts  *BehaviorRegistry        `json:"behavior_contracts,omitempty"`
	Schema             string                   `json:"schema"`
	ID                 string                   `json:"id"`
	Version            string                   `json:"version"`
	Source             Repository               `json:"source"`
	Subjects           []Subject                `json:"subjects"`
	Claims             []Claim                  `json:"claims"`
	Relations          []Relation               `json:"relations"`
	Journeys           []Journey                `json:"journeys"`
	Observations       []ObservationLink        `json:"observations"`
	Capabilities       []CapabilityDeclaration  `json:"capabilities"`
}

func BuildBehaviorProviderV2

func BuildBehaviorProviderV2(raw []byte) (ProviderRecord, error)

BuildBehaviorProviderV2 emits declarations only. Repository identities and anchors remain caller claims until the corpus boundary checks its inputs.

type QueryIndex

type QueryIndex struct {
	IDs    map[string]RecordRef   `json:"ids"`
	Paths  map[string][]RecordRef `json:"paths"`
	Terms  map[string][]int       `json:"terms"`
	Claims map[string][]int       `json:"claims"`
	Edges  map[string][]int       `json:"edges"`
}

QueryIndex contains only offsets into an immutable validated artifact. It is derived independently on admission; its bytes never establish source truth.

func BuildQueryIndex

func BuildQueryIndex(ctx context.Context, a *Artifact) (*QueryIndex, error)

type Receipt

type Receipt struct {
	Envelope       *TrustEnvelope           `json:"trust_envelope,omitempty"`
	Meaning        string                   `json:"meaning,omitempty"`
	Selection      *TestRecommendation      `json:"test_selection,omitempty"`
	Offset         int                      `json:"offset,omitempty"`
	NextOffset     *int                     `json:"next_offset,omitempty"`
	Details        map[string]RecordDetails `json:"details,omitempty"`
	Schema         string                   `json:"schema"`
	Operation      string                   `json:"operation"`
	ArtifactSHA256 string                   `json:"artifact_sha256"`
	Repository     Repository               `json:"repository"`
	Tree           string                   `json:"tree"`
	Trust          string                   `json:"trust"`
	Freshness      string                   `json:"freshness"`
	State          string                   `json:"state"`
	Miss           string                   `json:"miss"`
	Results        []any                    `json:"results"`
	Citations      []Anchor                 `json:"citations"`
	Capabilities   []Capability             `json:"capabilities"`
	Limitations    []string                 `json:"limitations"`
	Omitted        int                      `json:"omitted"`
}

func Query

func Query(a *Artifact, request Request, freshness string, limitations []string) (Receipt, error)

Query consumes an already validated artifact. Entry points must call Open; pure callers can use the artifact returned by Build in the same operation.

func QueryContext

func QueryContext(ctx context.Context, a *Artifact, request Request, freshness string, limitations []string) (Receipt, error)

func ReadQuery

func ReadQuery(ctx context.Context, root string, data []byte, request Request) (Receipt, error)

type RecordDetails

type RecordDetails struct {
	ClaimKind        string                   `json:"claim_kind,omitempty"`
	Flow             *FlowDetails             `json:"flow,omitempty"`
	Paragraph        *ParagraphDetails        `json:"paragraph,omitempty"`
	TestLink         *TestLinkDetails         `json:"test_link,omitempty"`
	Coverage         *CoverageDetails         `json:"coverage,omitempty"`
	Ticket           *TicketDetails           `json:"ticket,omitempty"`
	IntentComparison *IntentComparisonDetails `json:"intent_comparison,omitempty"`
}

RecordDetails preserves typed provider vocabulary beside normalized records. The normalized record's evidence axes govern every detail; none grants authority.

type RecordRef

type RecordRef struct {
	Kind   string `json:"kind"`
	Offset int    `json:"offset"`
}

type Relation

type Relation struct {
	ID       string   `json:"id"`
	From     string   `json:"from"`
	To       string   `json:"to"`
	Type     string   `json:"type"`
	Provider string   `json:"provider"`
	Evidence Evidence `json:"evidence"`
}

type Rendered

type Rendered struct {
	Schema         string            `json:"schema"`
	ArtifactSHA256 string            `json:"artifact_sha256"`
	ProfileSHA256  string            `json:"profile_sha256"`
	Derivation     string            `json:"derivation"`
	Files          map[string]string `json:"files"`
}

func Render

func Render(a *Artifact) (Rendered, error)

type Repository

type Repository struct {
	ID       string `json:"id"`
	Revision string `json:"revision"`
}

type Request

type Request struct {
	Retirement *RetirementPolicy `json:"retirement,omitempty"`
	Offset     int               `json:"offset,omitempty"`
	Operation  string            `json:"operation"`
	Query      string            `json:"query"`
	ID         string            `json:"id"`
	Path       string            `json:"path"`
	Limit      int               `json:"limit"`
}

type RestrictedFinding

type RestrictedFinding struct {
	ID              string `json:"id"`
	Severity        string `json:"severity"`
	LocalDetailPath string `json:"local_detail_path"`
	Detail          string `json:"detail"`
}

RestrictedFinding exists only in the local input. Its identity, original detail path and body are never admitted to an artifact or diagnostic.

type RestrictedSummary

type RestrictedSummary struct {
	Provider   string         `json:"provider"`
	Total      int            `json:"total"`
	BySeverity map[string]int `json:"by_severity"`
}

type RetirementPolicy

type RetirementPolicy struct {
	EvaluatedAt      string `json:"evaluated_at"`
	MaxAgeSeconds    *int64 `json:"max_age_seconds,omitempty"`
	MaxMergeDistance *int   `json:"max_merge_distance,omitempty"`
	SourceRevision   string `json:"source_revision,omitempty"`
	TargetRevision   string `json:"target_revision,omitempty"`
	MergeDistance    *int   `json:"merge_distance,omitempty"`
}

RetirementPolicy is an operator declaration, never an authenticated review. Distance names both revisions; absent measurements remain unknown.

func ParseRetirement

func ParseRetirement(raw []byte) (*RetirementPolicy, error)

type RetirementStatus

type RetirementStatus struct {
	State         string            `json:"state"`
	AgeSeconds    *int64            `json:"age_seconds,omitempty"`
	MergeDistance *int              `json:"merge_distance,omitempty"`
	Policy        *RetirementPolicy `json:"policy,omitempty"`
	Authority     string            `json:"authority"`
	Reasons       []string          `json:"reasons"`
}

type Scope

type Scope struct {
	Path     string `json:"path"`
	Revision string `json:"revision"`
}

type ShardContribution

type ShardContribution struct {
	Subjects         []Subject                `json:"subjects"`
	Claims           []Claim                  `json:"claims"`
	Relations        []Relation               `json:"relations"`
	Journeys         []Journey                `json:"journeys"`
	Details          map[string]RecordDetails `json:"details"`
	Declarations     []CapabilityDeclaration  `json:"declarations"`
	AdoptionProvider bool                     `json:"adoption_provider"`
	ImportParity     []ImportParity           `json:"import_parity"`
}

type ShardIdentity

type ShardIdentity struct {
	Provider string `json:"provider"`
	Path     string `json:"path"`
}

ShardIdentity is an explicit policy-admitted reuse unit, never inferred scope.

type StabilityAggregate

type StabilityAggregate struct {
	ID             string                  `json:"id"`
	Scope          string                  `json:"scope"`
	PolicyID       string                  `json:"policy_id"`
	Planned        int                     `json:"planned"`
	TestID         string                  `json:"test_id"`
	Project        string                  `json:"project"`
	ContractID     string                  `json:"contract_id"`
	ContractSHA256 string                  `json:"contract_sha256"`
	Contributions  []StabilityContribution `json:"contributions"`
}

type StabilityAttempt

type StabilityAttempt struct {
	Retry        int                              `json:"retry"`
	State        string                           `json:"state"`
	FailureClass string                           `json:"failure_class"`
	Artifacts    []jstestprovider.FailureArtifact `json:"artifacts"`
	Cleanup      string                           `json:"cleanup"`
}

type StabilityContribution

type StabilityContribution struct {
	RunKind     string                   `json:"run_kind"`
	Repetition  int                      `json:"repetition"`
	ManualRunID string                   `json:"manual_run_id,omitempty"`
	Receipt     StabilityReceiptInput    `json:"receipt"`
	SourcePaths map[string]string        `json:"source_paths"`
	Identity    StabilityIdentity        `json:"identity"`
	Topology    StabilityTopologyBinding `json:"topology"`
	Cleanup     string                   `json:"cleanup"`
	Attempts    []StabilityAttempt       `json:"attempts"`
}

type StabilityCounts

type StabilityCounts struct {
	Planned              int `json:"planned"`
	Started              int `json:"started"`
	Completed            int `json:"completed"`
	Passed               int `json:"passed"`
	Failed               int `json:"failed"`
	TimedOut             int `json:"timed_out"`
	Interrupted          int `json:"interrupted"`
	InfrastructureFailed int `json:"infrastructure_failed"`
	Skipped              int `json:"skipped"`
	Flaky                int `json:"flaky"`
	RetryConsumed        int `json:"retry_consumed"`
	CleanupFailed        int `json:"cleanup_failed"`
	ManualReruns         int `json:"manual_reruns"`
}

type StabilityIdentity

type StabilityIdentity struct {
	ApplicationRevision string `json:"application_revision"`
	TestRevision        string `json:"test_revision"`
	ConfigSHA256        string `json:"config_sha256"`
	ContractSHA256      string `json:"contract_sha256"`
	Runner              string `json:"runner"`
	RunnerVersion       string `json:"runner_version"`
	Browser             string `json:"browser"`
	Project             string `json:"project"`
	WorkerPolicy        string `json:"worker_policy"`
	RetryPolicy         string `json:"retry_policy"`
	EnvironmentClass    string `json:"environment_class"`
	EnvironmentSHA256   string `json:"environment_sha256"`
	FixtureSchema       string `json:"fixture_schema"`
	FixtureSHA256       string `json:"fixture_sha256"`
}

type StabilityPolicy

type StabilityPolicy struct {
	ID               string                   `json:"id"`
	SHA256           string                   `json:"sha256"`
	Topology         StabilityTopologyBinding `json:"topology"`
	MatrixDimensions []string                 `json:"matrix_dimensions"`
	Thresholds       []StabilityThreshold     `json:"thresholds"`
}

type StabilityReceiptInput

type StabilityReceiptInput struct {
	Path     string `json:"path"`
	Revision string `json:"revision"`
	SHA256   string `json:"sha256"`
}

type StabilityRegistry

type StabilityRegistry struct {
	Schema     string               `json:"schema"`
	Policy     StabilityPolicy      `json:"policy"`
	Aggregates []StabilityAggregate `json:"aggregates"`
}

type StabilityReport

type StabilityReport struct {
	ID                   string                   `json:"id"`
	Provider             string                   `json:"provider"`
	Scope                string                   `json:"scope"`
	PolicyID             string                   `json:"policy_id"`
	PolicySHA256         string                   `json:"policy_sha256"`
	Topology             StabilityTopologyBinding `json:"topology"`
	MatrixDimensions     []string                 `json:"matrix_dimensions"`
	TestID               string                   `json:"test_id"`
	Project              string                   `json:"project"`
	ContractID           string                   `json:"contract_id"`
	ContractSHA256       string                   `json:"contract_sha256"`
	Counts               StabilityCounts          `json:"counts"`
	Verdict              string                   `json:"verdict"`
	ContributingReceipts []StabilityContribution  `json:"contributing_receipts"`
	Limitations          []string                 `json:"limitations"`
}

type StabilityThreshold

type StabilityThreshold struct {
	Scope                       string `json:"scope"`
	RequiredRepetitions         int    `json:"required_repetitions"`
	MinimumPassed               int    `json:"minimum_passed"`
	MaximumFailed               int    `json:"maximum_failed"`
	MaximumTimedOut             int    `json:"maximum_timed_out"`
	MaximumInterrupted          int    `json:"maximum_interrupted"`
	MaximumInfrastructureFailed int    `json:"maximum_infrastructure_failed"`
	MaximumSkipped              int    `json:"maximum_skipped"`
	MaximumFlaky                int    `json:"maximum_flaky"`
	MaximumRetryConsumed        int    `json:"maximum_retry_consumed"`
}

type StabilityTopology

type StabilityTopology struct {
	CINodes                  int      `json:"ci_nodes"`
	CIShards                 int      `json:"ci_shards"`
	PlaywrightWorkersPerNode int      `json:"playwright_workers_per_node"`
	DatabaseMode             string   `json:"database_mode"`
	Projects                 []string `json:"projects"`
	SplitAlgorithm           string   `json:"split_algorithm"`
	SplitVersion             string   `json:"split_version"`
	ResourceClass            string   `json:"resource_class"`
}

type StabilityTopologyBinding

type StabilityTopologyBinding struct {
	Evidence Anchor            `json:"evidence"`
	Value    StabilityTopology `json:"value"`
}

type StabilityTopologyDocument

type StabilityTopologyDocument struct {
	Schema        string            `json:"schema"`
	Kind          string            `json:"kind"`
	PolicyID      string            `json:"policy_id"`
	ReceiptSHA256 string            `json:"receipt_sha256,omitempty"`
	Topology      StabilityTopology `json:"topology"`
}

type Step

type Step struct {
	ID          string   `json:"id"`
	Action      string   `json:"action"`
	Operation   string   `json:"operation"`
	Expected    string   `json:"expected"`
	Observation string   `json:"observation"`
	Evidence    Evidence `json:"evidence"`
}

type StepObservation

type StepObservation struct {
	ID        string `json:"id"`
	Action    string `json:"action"`
	Operation string `json:"operation"`
	Expected  string `json:"expected"`
	Observed  string `json:"observed"`
	Passed    bool   `json:"passed"`
}

type Subject

type Subject struct {
	ID       string   `json:"id"`
	Kind     string   `json:"kind"`
	Name     string   `json:"name"`
	Provider string   `json:"provider"`
	Evidence Evidence `json:"evidence"`
}

type TestLinkDetails

type TestLinkDetails struct {
	Role           string `json:"role"`
	JoinConfidence string `json:"join_confidence"`
	File           string `json:"file"`
	Title          string `json:"title"`
	Project        string `json:"project"`
}

type TestRecommendation

type TestRecommendation struct {
	State            string   `json:"state"`
	NarrowingAllowed bool     `json:"narrowing_allowed"`
	Required         string   `json:"required"`
	MissingEvidence  []string `json:"missing_evidence"`
	Paths            []string `json:"paths"`
}

type TicketDetails

type TicketDetails struct {
	ExternalID string          `json:"external_id"`
	Status     string          `json:"status"`
	History    []TicketHistory `json:"history"`
}

type TicketHistory

type TicketHistory struct {
	At       string `json:"at"`
	Revision string `json:"revision"`
	Summary  string `json:"summary"`
}

type TrustEnvelope

type TrustEnvelope struct {
	ContentStatus    string           `json:"content_status"`
	SourceRevision   string           `json:"source_revision"`
	CorpusRevision   string           `json:"corpus_revision"`
	Builder          Builder          `json:"builder"`
	Freshness        string           `json:"freshness"`
	SourceValidation string           `json:"source_validation"`
	Retirement       RetirementStatus `json:"retirement"`
	Citations        []Anchor         `json:"citations"`
	Limitations      []string         `json:"limitations"`
}

type VerifiedCorpus

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

VerifiedCorpus carries an immutable result of the complete source-pinned compiler boundary. It is local process evidence, never a wire certificate or producer authentication. Only this package can mint it; the zero value refuses.

func BuildVerified

func BuildVerified(ctx context.Context, root string, m Manifest) (VerifiedCorpus, error)

func OpenVerified

func OpenVerified(ctx context.Context, root string, raw []byte) (VerifiedCorpus, error)

func (VerifiedCorpus) Bytes

func (v VerifiedCorpus) Bytes() ([]byte, error)

Bytes returns a private copy; caller writes cannot change the verified result.

func (VerifiedCorpus) Snapshot

func (v VerifiedCorpus) Snapshot() (*Artifact, error)

Snapshot decodes a fresh copy for a consumer without exposing token storage. Parsing is safe here only because this token was minted at the compiler boundary.

Jump to

Keyboard shortcuts

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