Help us shape the future of Go! Take the 2026 Go Developer Survey

publication

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package publication builds deterministic, schema-validated publication records.

Index

Constants

View Source
const (
	RequirementsSupportVersion = validation.RequirementsSupportVersion
	RequirementsSupportPath    = validation.RequirementsSupportPath
	RequirementsInputPath      = validation.RequirementsInputPath
	RequirementsSupportSchema  = validation.RequirementsSupportSchema
)

Variables

This section is empty.

Functions

func CommittedPublicationManifestPathFromError

func CommittedPublicationManifestPathFromError(err error) (ports.SafeRelativePath, bool)

CommittedPublicationManifestPathFromError returns the manifest path retained by a post-commit diagnostic failure.

func PrepareFailedRunRecovery added in v0.1.20

func PrepareFailedRunRecovery(ctx context.Context, result review.CoordinatorResult, target domain.TargetIdentity, threshold domain.Severity, snapshotSHA256 string, lineage RunPublicationContext, initial []review.RuntimeArtifactInventory) (recovery.Prepared, error)

PrepareFailedRunRecovery retains complete original inputs and only accepted, evidence-verified role output. Final publication's forbidden classes remain unchanged; security, configuration, and artifact failures also forbid recovery.

Types

type AttemptArtifactInput

type AttemptArtifactInput struct {
	AttemptID          domain.AttemptID
	InvocationSequence uint64
	Artifact           ports.CapturedAttemptArtifact
}

AttemptArtifactInput binds one captured provider stream to an immutable attempt invocation. Rejected streams retain no bytes and are never persisted.

type CommittedRoleReport added in v0.1.4

type CommittedRoleReport struct {
	Role             string
	Path             string
	SHA256           string
	ByteLength       int
	ProviderInstance string
	AttemptID        string
	ContentType      string
	Transport        string
}

CommittedRoleReport is one verified role-report identity from a committed publication manifest. It never invents source_invocation_id. Transport is the provider output transport that carried the accepted content for the role.

func ProjectCommittedRoleReports added in v0.1.4

func ProjectCommittedRoleReports(snapshot ports.CommittedPublicationSnapshot) ([]CommittedRoleReport, error)

ProjectCommittedRoleReports reopens role-report inventory from the already schema/semantic-verified committed manifest and cross-checks each entry against final role outcome and attempt authority. Callers must not invent paths from coordinator summaries.

type FailedRunRecoveryCommitter added in v0.1.20

type FailedRunRecoveryCommitter interface {
	PersistFailedRunRecovery(context.Context, ports.AnchoredRoot, recovery.Prepared, ports.WorkspaceTerminalReceipt) (domain.SourceReference, error)
}

FailedRunRecoveryCommitter seals a separately validated failed-run snapshot only after real workspace cleanup. It does not accept a final-review candidate.

type FailureDiagnostic added in v0.1.4

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

FailureDiagnostic is the redacted machine classification for a publication failure. It deliberately excludes native paths and underlying error text.

func FailureDiagnosticFromError added in v0.1.4

func FailureDiagnosticFromError(err error) (FailureDiagnostic, bool)

FailureDiagnosticFromError returns only the stable, redacted publication classification carried by err.

func (FailureDiagnostic) Cause added in v0.1.4

func (diagnostic FailureDiagnostic) Cause() domain.RuntimeDiagnosticCause

func (FailureDiagnostic) Failure added in v0.1.4

func (diagnostic FailureDiagnostic) Failure() string

func (FailureDiagnostic) Mitigation added in v0.1.4

func (diagnostic FailureDiagnostic) Mitigation() string

func (FailureDiagnostic) Phase added in v0.1.4

func (diagnostic FailureDiagnostic) Phase() domain.RuntimeDiagnosticPhase

func (FailureDiagnostic) Valid added in v0.1.4

func (diagnostic FailureDiagnostic) Valid() bool

type LifecycleEvent

type LifecycleEvent string
const (
	LifecyclePreparationStarted LifecycleEvent = "preparation_started"
	LifecycleStaged             LifecycleEvent = "staged"
	LifecycleInstalled          LifecycleEvent = "installed"
	LifecycleCommitted          LifecycleEvent = "committed"
	LifecycleFailed             LifecycleEvent = "failed"
)

func (LifecycleEvent) Valid

func (event LifecycleEvent) Valid() bool

type LifecycleObservation added in v0.1.4

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

LifecycleObservation carries either a normal publication transition or a redacted failure classification. Failure details are present only for the failed transition.

func (LifecycleObservation) Event added in v0.1.4

func (observation LifecycleObservation) Event() LifecycleEvent

func (LifecycleObservation) FailureDiagnostic added in v0.1.4

func (observation LifecycleObservation) FailureDiagnostic() (FailureDiagnostic, bool)

type LifecycleObserver

type LifecycleObserver interface {
	ObservePublicationLifecycle(context.Context, LifecycleObservation) error
}

type LiveCandidateInput added in v0.1.25

type LiveCandidateInput struct {
	Result            review.CoordinatorResult
	Target            ports.LiveSourceTarget
	SeverityThreshold domain.Severity
	Provenance        LiveProductionProvenance
	AttemptArtifacts  []AttemptArtifactInput
	BinaryEvidence    []evidence.LiveBinaryReceipt
}

LiveCandidateInput contains trusted coordination output and verifier-owned selected evidence. Provider transcripts remain in their attempt locations.

type LiveProductionProvenance added in v0.1.25

type LiveProductionProvenance struct {
	BuildProduct          string
	BuildVersion          string
	BuildCommit           string
	ObjectiveSHA256       string
	HasObjective          bool
	SourceIdentitySHA256  string
	SourceTerminalReceipt string
	Providers             []ProductionProviderProvenance
}

LiveProductionProvenance records source-directory and provider closure. It carries no snapshot, source-content fingerprint, or source replay claim.

type NoChangeProvenance

type NoChangeProvenance struct {
	BuildProduct             string
	BuildVersion             string
	BuildCommit              string
	ObjectiveSHA256          string
	HasObjective             bool
	SnapshotManifestSHA256   string
	WorkspaceTerminalReceipt string
}

type PreparedCandidate

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

PreparedCandidate is a fully semantically validated terminal review result. It deliberately has no ReviewID. A ReviewID is supplied only after this pre-publication validation has completed.

func (PreparedCandidate) Build

func (candidate PreparedCandidate) Build(
	ctx context.Context,
	validator SchemaValidator,
	reviewID domain.ReviewID,
	createdAt time.Time,
	epoch uint64,
) (PublicationBundle, error)

Build assigns the post-validation ReviewID and constructs every deterministic publication member. It validates final-review and manifest bytes against the embedded schema assets before returning any bundle.

func (PreparedCandidate) RunID

func (candidate PreparedCandidate) RunID() domain.RunID

RunID returns the immutable review-run identity bound by validation.

func (PreparedCandidate) SessionID

func (candidate PreparedCandidate) SessionID() domain.SessionID

SessionID returns the immutable review-session identity bound by validation.

func (PreparedCandidate) Valid

func (candidate PreparedCandidate) Valid() bool

Valid reports whether this value is a complete semantic pre-publication candidate. A zero value is never valid.

func (PreparedCandidate) ValidatedCandidateSHA256

func (candidate PreparedCandidate) ValidatedCandidateSHA256() string

ValidatedCandidateSHA256 returns a deterministic, domain-separated identity over every semantic input validated before ReviewID issuance. It returns an empty string for an invalid candidate.

type PreparedLiveCandidate added in v0.1.25

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

PreparedLiveCandidate shares terminal validation and the P2 transaction with captured results while keeping live source authority explicit at admission.

func PrepareLiveCandidate added in v0.1.25

func PrepareLiveCandidate(input LiveCandidateInput) (PreparedLiveCandidate, error)

func PrepareLiveNoChangeCandidate added in v0.1.25

func PrepareLiveNoChangeCandidate(sessionID domain.SessionID, runID domain.RunID, target ports.LiveSourceTarget, selectedRoles []domain.Role, threshold domain.Severity, provenance LiveProductionProvenance) (PreparedLiveCandidate, error)

func WithRequirements added in v0.1.26

WithRequirements binds exact admitted input/results to the v4 producer.

func (PreparedLiveCandidate) Build added in v0.1.25

func (candidate PreparedLiveCandidate) Build(ctx context.Context, validator SchemaValidator, id domain.ReviewID, createdAt time.Time, epoch uint64) (PublicationBundle, error)

func (PreparedLiveCandidate) RunID added in v0.1.25

func (candidate PreparedLiveCandidate) RunID() domain.RunID

func (PreparedLiveCandidate) SessionID added in v0.1.25

func (candidate PreparedLiveCandidate) SessionID() domain.SessionID

func (PreparedLiveCandidate) Valid added in v0.1.25

func (candidate PreparedLiveCandidate) Valid() bool

func (PreparedLiveCandidate) ValidatedCandidateSHA256 added in v0.1.25

func (candidate PreparedLiveCandidate) ValidatedCandidateSHA256() string

type ProductionProviderProvenance

type ProductionProviderProvenance struct {
	Family                    string
	Instance                  string
	Version                   string
	Executable                string
	ExecutableSHA256          string
	Launcher                  string
	LauncherSHA256            string
	ProfileGeneration         string
	AdapterProfile            string
	QualificationReceiptIDs   []string
	PacketTransportReceiptIDs []string
	NamespaceTerminalReceipt  string // Canonical receipt ID.
}

type ProductionReviewProvenance

type ProductionReviewProvenance struct {
	BuildProduct             string
	BuildVersion             string
	BuildCommit              string
	ObjectiveSHA256          string
	HasObjective             bool
	SnapshotManifestSHA256   string
	Providers                []ProductionProviderProvenance
	WorkspaceTerminalReceipt string
}

ProductionReviewProvenance is the immutable closure authority for a changed root review. It retains canonical receipt IDs rather than credentials, settings, or mutable workspace paths.

type PublicationBundle

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

PublicationBundle is the defensive publication payload for one P2 composite. Its authority is represented solely by serialized records; this Go value has no authority flag or authorization accessor.

func (PublicationBundle) Epoch

func (bundle PublicationBundle) Epoch() ports.PublicationEpoch

Epoch returns the positive immutable epoch record.

func (PublicationBundle) Excerpts

Excerpts returns caller-owned immutable excerpt artifact values.

func (PublicationBundle) Final

Final returns the final review artifact with defensive byte accessors.

func (PublicationBundle) Journal

func (bundle PublicationBundle) Journal() PublicationDocument

Journal returns the exact mutable journal replacement.

func (PublicationBundle) LineageEdge

LineageEdge returns the immutable publication lineage edge.

func (PublicationBundle) Manifest

Manifest returns the immutable committed manifest.

func (PublicationBundle) StagedFinal

StagedFinal returns final bytes at their required staged temporary identity.

func (PublicationBundle) Status

func (bundle PublicationBundle) Status() PublicationDocument

Status returns the exact mutable status replacement.

func (PublicationBundle) SupportArtifacts

func (bundle PublicationBundle) SupportArtifacts() []ports.ImmutablePublicationArtifact

SupportArtifacts returns caller-owned immutable excerpts and attempt-capture artifacts. Their paths are validated against the closed run-support grammar by the persistence boundary.

func (PublicationBundle) Valid

func (bundle PublicationBundle) Valid() bool

Valid reports whether every bundle member remains self-consistent. It does not assert reader authority; only the serialized P2 records can do that.

type PublicationDocument

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

PublicationDocument is an exact mutable publication record. Bytes returns a caller-owned copy; its path and digest identify the complete replacement.

func (PublicationDocument) Bytes

func (document PublicationDocument) Bytes() []byte

Bytes returns a caller-owned copy of the exact record bytes.

func (PublicationDocument) Path

func (document PublicationDocument) Path() ports.SafeRelativePath

Path returns the canonical mutable record path.

func (PublicationDocument) SHA256

func (document PublicationDocument) SHA256() string

SHA256 returns the canonical exact-byte digest.

func (PublicationDocument) Valid

func (document PublicationDocument) Valid() bool

Valid reports whether this document has a coherent immutable identity.

type PublicationResult

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

PublicationResult is a defensive result of a completed P2 publication or a recovery observation that must resume collection. Snapshot is present only when P2 is authoritative.

func (PublicationResult) Decision

func (result PublicationResult) Decision() domain.PublicationDecision

Decision returns the app-owned durable classification.

func (PublicationResult) Exit

Exit returns the optional exact domain-reduced terminal exit decision. A nonterminal P0/P1 recovery result has no exit, so it cannot project a zero-value committed-pass outcome.

func (PublicationResult) Final

func (result PublicationResult) Final() (ports.FinalReviewIdentity, bool)

Final returns the immutable final identity when it is known.

func (PublicationResult) IssuedReviewID

func (result PublicationResult) IssuedReviewID() (ports.IssuedReviewID, bool)

IssuedReviewID returns the post-validation issued ID when this invocation created one. Recovery never invents an ID.

func (PublicationResult) PersistedRunSupportArtifacts

func (result PublicationResult) PersistedRunSupportArtifacts() []RunSupportArtifactIdentity

PersistedRunSupportArtifacts returns defensive copies of the exact support artifact identities persisted and re-read by this invocation before P2.

func (PublicationResult) PromptManifestArtifact

func (result PublicationResult) PromptManifestArtifact(
	attemptID domain.AttemptID,
	invocationSequence uint64,
) (RunSupportArtifactIdentity, bool)

PromptManifestArtifact returns the exact persisted prompt-manifest identity for one attempt invocation. It fails closed when this result has no verified support view, or the attempt/invocation is absent or ambiguous.

func (PublicationResult) Snapshot

Snapshot returns the exact P2 snapshot with defensive byte accessors.

func (PublicationResult) TerminalExit

func (result PublicationResult) TerminalExit() (domain.OperationalExitDecision, bool)

TerminalExit returns the terminal exit decision only when this result can project one. Normal content exits 0, 1, and 4 are available only from P2.

type ReplayMode

type ReplayMode string

ReplayMode describes how a rerun obtains its prompt material.

const (
	ReplayModeExact     ReplayMode = "exact"
	ReplayModeRecompose ReplayMode = "recompose"
)

type RequirementContentReference added in v0.1.26

type RequirementContentReference = validation.RequirementContentReference

func DecodeRequirementsSupport added in v0.1.26

func DecodeRequirementsSupport(ctx context.Context, validator SchemaValidator, raw, input []byte, requirements []domain.Requirement, noChange bool) (domain.RequirementEvaluation, []RequirementContentReference, error)

DecodeRequirementsSupport validates bounded metadata against admitted input and selected-source no-change state. It performs no storage or publication. Callers must also verify every referenced content body and its source claims.

type RoleReportURI added in v0.1.4

type RoleReportURI struct {
	Role       string
	URI        string
	SHA256     string
	ByteLength int
}

RoleReportURI is one project-relative role-report identity projected from a committed publication snapshot and its verified support inventory.

func ProjectRoleReportURIs added in v0.1.4

func ProjectRoleReportURIs(result PublicationResult) ([]RoleReportURI, error)

ProjectRoleReportURIs projects canonical project-relative role-report URIs from a P2 PublicationResult. Each URI is bound to the committed manifest inventory and the exact support artifact identities re-read before commit. Callers must not query the live directory or invent paths.

type RunPublicationContext

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

RunPublicationContext binds a candidate to its immutable run lineage. The zero value is the byte-compatible root review context.

func NewChildPublicationContext

func NewChildPublicationContext(
	runType domain.RunType,
	parentRunID domain.RunID,
	sourceRunID domain.RunID,
	sourceReviewID domain.ReviewID,
	sourceAttemptID *domain.AttemptID,
	sourceFindingRef *string,
	replayMode *ReplayMode,
) (RunPublicationContext, error)

NewChildPublicationContext validates the complete immutable lineage for a followup, delta, or rerun publication.

func NewProductionPublicationContext

func NewProductionPublicationContext(provenance ProductionReviewProvenance) (RunPublicationContext, error)

NewProductionPublicationContext creates the root-only context for a normal production review and defensively owns every caller-provided slice.

func NewRecoveryRerunPublicationContext added in v0.1.20

func NewRecoveryRerunPublicationContext(parent domain.RunID, source domain.SourceReference, attempt domain.AttemptID, mode ReplayMode) (RunPublicationContext, error)

NewRecoveryRerunPublicationContext binds a child to a sealed recovery source without inventing a review identity for the failed source run.

type RunSupportArtifactIdentity

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

RunSupportArtifactIdentity is the exact immutable identity of one run-support artifact re-read by publication before P2. It has no public constructor so callers cannot present synthesized support identities as persisted evidence.

func (RunSupportArtifactIdentity) Path

Path returns the exact persisted support-artifact path.

func (RunSupportArtifactIdentity) SHA256

func (identity RunSupportArtifactIdentity) SHA256() string

SHA256 returns the exact persisted support-artifact hash.

type SchemaValidator

type SchemaValidator interface {
	Validate(context.Context, ports.AssetID, []byte) error
}

SchemaValidator validates bytes against one embedded schema asset. It is consumer-owned because publication owns byte construction, not schema lookup.

type Service

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

Service owns publication ordering and recovery policy. PublicationStore owns only mechanics and durable observation.

func NewService

func NewService(
	store ports.PublicationStore,
	validator SchemaValidator,
	clock ports.Clock,
	maxBytes int64,
) (*Service, error)

NewService constructs a publication state-machine service.

func (*Service) PersistFailedRunRecovery added in v0.1.20

func (service *Service) PersistFailedRunRecovery(ctx context.Context, root ports.AnchoredRoot, prepared recovery.Prepared, receipt ports.WorkspaceTerminalReceipt) (domain.SourceReference, error)

func (*Service) PublishLiveNext added in v0.1.25

func (service *Service) PublishLiveNext(ctx context.Context, root ports.AnchoredRoot, candidate PreparedLiveCandidate) (PublicationResult, error)

func (*Service) PublishLiveNextObserved added in v0.1.25

func (service *Service) PublishLiveNextObserved(ctx context.Context, root ports.AnchoredRoot, candidate PreparedLiveCandidate, observer LifecycleObserver) (PublicationResult, error)

func (*Service) Recover

func (service *Service) Recover(ctx context.Context, run ports.PublicationRun) (PublicationResult, error)

Recover applies only the action selected by a fresh domain classification. It never adopts ambiguous files, regenerates final/composite bytes, or downgrades P2 authority.

Jump to

Keyboard shortcuts

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