acceptance

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package acceptance validates structured specrelay and specrelay flow acceptance contracts.

Package acceptance renders and validates reviewer-facing delivery reports.

Package acceptance rejects renamed text, placeholders, and unreadable artifacts from final evidence.

Package acceptance provides a shared lifecycle diagnostics boundary for acceptance contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvidenceHasProducer

func EvidenceHasProducer(projectRoot string, evidence Evidence, coverage []Coverage, tests map[string]Test) bool

EvidenceHasProducer reports whether an evidence artifact is tied to a required test producer.

func RenderDeliveryReport

func RenderDeliveryReport(contract Contract, changeName string, observations []DeliveryObservation) ([]byte, error)

RenderDeliveryReport creates the canonical human review entry from the sealed contract and final QA observations.

func Validate

func Validate(contract Contract) error

Validate enforces the pre-implementation acceptance contract shape.

func ValidateDeliveryReportFileForChange

func ValidateDeliveryReportFileForChange(projectRoot string, contract Contract, changeName string) error

ValidateDeliveryReportFileForChange ensures the tracked report contains the promised user guidance and evidence links.

func ValidateSubmissionEvidenceContractForChange

func ValidateSubmissionEvidenceContractForChange(contract Contract, changeName string) error

ValidateSubmissionEvidenceContractForChange rejects contracts that cannot produce one complete proposal package.

func ValidateSubmissionEvidenceForChange

func ValidateSubmissionEvidenceForChange(projectRoot string, contract Contract, changeName string) error

ValidateSubmissionEvidenceForChange enforces the archive-time evidence gate for one proposal.

func ValidateUserFacingText

func ValidateUserFacingText(label, text string) error

ValidateUserFacingText rejects placeholders and implementation-only prose that cannot guide a reviewer.

Types

type Contract

type Contract struct {
	Summary            string               `json:"summary"`
	Coverage           []Coverage           `json:"coverage,omitempty"`
	RequiredTests      []Test               `json:"required_tests"`
	RequiredEvidence   []Evidence           `json:"required_evidence"`
	SubmissionEvidence []SubmissionEvidence `json:"submission_evidence,omitempty"`
	DeliveryReport     *DeliveryReport      `json:"delivery_report,omitempty"`
}

Contract is the JSON contract produced before implementation starts.

func Parse

func Parse(data []byte) (Contract, error)

Parse strictly decodes and validates an acceptance JSON document.

func Read

func Read(path string) (Contract, error)

Read loads and validates the acceptance JSON file.

type Coverage

type Coverage struct {
	Spec     string   `json:"spec"`
	Tests    []string `json:"tests"`
	Evidence []string `json:"evidence"`
	Risk     string   `json:"risk"`
}

Coverage links spec scenarios to concrete tests and QA evidence.

type DeliveryComparison

type DeliveryComparison struct {
	Before           string `json:"before"`
	After            string `json:"after"`
	BeforeEvidenceID string `json:"before_evidence_id"`
	AfterEvidenceID  string `json:"after_evidence_id"`
}

DeliveryComparison binds a repair claim to distinct before and after evidence.

type DeliveryObservation

type DeliveryObservation struct {
	ScenarioID string
	Observed   string
}

DeliveryObservation records what final independent QA actually saw for one user scenario.

type DeliveryReport

type DeliveryReport struct {
	UserBenefits  []string           `json:"user_benefits"`
	Prerequisites []string           `json:"prerequisites,omitempty"`
	Scenarios     []DeliveryScenario `json:"scenarios"`
	KnownLimits   []string           `json:"known_limits,omitempty"`
}

DeliveryReport defines the user-facing review guide generated beside final evidence.

type DeliveryScenario

type DeliveryScenario struct {
	ID          string              `json:"id"`
	Title       string              `json:"title"`
	UserValue   string              `json:"user_value"`
	Steps       []DeliveryStep      `json:"steps"`
	EvidenceIDs []string            `json:"evidence_ids"`
	Comparison  *DeliveryComparison `json:"comparison,omitempty"`
}

DeliveryScenario explains one user-visible capability and how a reviewer can verify it.

type DeliveryStep

type DeliveryStep struct {
	Action   string `json:"action"`
	Expected string `json:"expected"`
}

DeliveryStep pairs a reviewer action with the result visible to the user.

type Evidence

type Evidence struct {
	ID      string `json:"id"`
	Kind    string `json:"kind"`
	Path    string `json:"path"`
	Purpose string `json:"purpose"`
}

Evidence records one runtime artifact that QA must collect.

type LifecycleDiagnostic

type LifecycleDiagnostic struct {
	Code       string `json:"code"`
	Severity   string `json:"severity"`
	Message    string `json:"message"`
	TestID     string `json:"test_id,omitempty"`
	EvidenceID string `json:"evidence_id,omitempty"`
	Path       string `json:"path,omitempty"`
}

LifecycleDiagnostic records one machine-readable acceptance lifecycle finding.

type LifecycleResult

type LifecycleResult struct {
	Valid       bool                  `json:"valid"`
	Diagnostics []LifecycleDiagnostic `json:"diagnostics"`
	Required    RequiredItemSet       `json:"required"`
}

LifecycleResult records the shared validation, producer, and coverage view of a contract.

func BuildLifecycle

func BuildLifecycle(projectRoot string, contract Contract) LifecycleResult

BuildLifecycle collects lifecycle diagnostics without mutating the acceptance contract.

func ValidateLifecycle

func ValidateLifecycle(projectRoot string, contract Contract) LifecycleResult

ValidateLifecycle builds and returns shared lifecycle diagnostics for a contract.

type RequiredItemSet

type RequiredItemSet struct {
	Tests    map[string]string `json:"tests"`
	Evidence map[string]string `json:"evidence"`
}

RequiredItemSet exposes acceptance items that later QA stages must cover.

func RequiredItems

func RequiredItems(contract Contract) RequiredItemSet

RequiredItems returns the required test and evidence ids grouped for QA coverage checks.

type SubmissionEvidence

type SubmissionEvidence struct {
	EvidenceID  string `json:"evidence_id"`
	SourcePath  string `json:"source_path"`
	ArchivePath string `json:"archive_path"`
}

SubmissionEvidence maps one temporary required-evidence source to its committed proposal archive. It represents final proposal demonstrations, not repair-only before/after diagnostics.

type Test

type Test struct {
	ID                     string   `json:"id"`
	Source                 string   `json:"source"`
	Path                   string   `json:"path"`
	Command                string   `json:"command"`
	Purpose                string   `json:"purpose"`
	Assertions             []string `json:"assertions,omitempty"`
	ExpectedInitialFailure string   `json:"expected_initial_failure,omitempty"`
}

Test records one executable test command that later stages must pass.

Jump to

Keyboard shortcuts

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