release

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package release plans schema-family versions from caller-supplied evidence. It deliberately does not claim to prove schema compatibility.

Index

Constants

View Source
const PublicationLedgerVersion = 1
View Source
const TransactionLockName = ".refine-release.lock"

TransactionLockName is shared by project generation and release promotion. Both mutate owned outputs and must serialize with one another.

Variables

This section is empty.

Functions

func Recover

func Recover(rootPath string) error

Recover rolls back incomplete transactions and removes committed transaction metadata. It refuses malformed journals and only removes destinations that are still hard links to this transaction's staged inode.

func ReservedTransactionPath

func ReservedTransactionPath(path string) bool

ReservedTransactionPath identifies root-level internal transaction state. Callers pass a cleaned relative path. Case folding prevents platform-specific output bundles from claiming the lock or a staging directory.

Types

type Artifact

type Artifact struct {
	Path    string
	Content []byte
}

type ArtifactChange

type ArtifactChange uint8
const (
	ArtifactNoChange ArtifactChange = iota
	ArtifactPatchChange
	ArtifactFeatureChange
	ArtifactBreakingChange
)

type BreakingFix

type BreakingFix struct {
	Comparison    ComparisonRef
	Justification string
}

BreakingFix is separate even when it targets the same comparison.

type ChangeKind

type ChangeKind uint8
const (
	NoChange ChangeKind = iota
	DocumentationOnly
	CompatibleFix
	CompatibleFeature
	BreakingChange
)

type ComparisonRef

type ComparisonRef struct {
	Family           string
	Baseline         Version
	BaselineContent  ContentID
	CandidateContent ContentID
	Direction        Direction
}

ComparisonRef identifies a comparison by both versions' exact content. The candidate is a SNAPSHOT, so its eventual version is deliberately not part of the identity.

type ComparisonResult

type ComparisonResult uint8

ComparisonResult is explicitly three-valued. Unknown is not compatibility.

const (
	ComparisonValid ComparisonResult = iota + 1
	ComparisonInvalid
	ComparisonUnknown
)

func (ComparisonResult) String

func (r ComparisonResult) String() string

type CompatibilityEvidence

type CompatibilityEvidence struct {
	Comparison ComparisonRef
	Result     ComparisonResult
	Detail     string
}

type CompatibilityOverride

type CompatibilityOverride struct {
	Comparison ComparisonRef
	Reason     string
}

CompatibilityOverride acknowledges invalid or unknown evidence. It does not assert that a breaking change is a fix.

type ContentID

type ContentID string

ContentID is the lowercase SHA-256 of the exact bytes being compared.

func Digest

func Digest(content []byte) ContentID

func PublicationInventoryDigest

func PublicationInventoryDigest(record PublicationRecord) ContentID

PublicationInventoryDigest binds an attestation to its schema bytes, exact generated-source inventory, and (for published records) actual JAR entries.

func (ContentID) Valid

func (id ContentID) Valid() bool

type DeletionArtifact

type DeletionArtifact struct {
	Path            string
	ExpectedContent ContentID
}

type Direction

type Direction uint8
const (
	Backward Direction = iota + 1
	Forward
)

func (Direction) String

func (d Direction) String() string

type FilePrecondition

type FilePrecondition struct {
	Path    string
	Content ContentID
}

type GeneratedVersion

type GeneratedVersion struct {
	Family        string
	SchemaVersion Version
	Generated     bool
}

type ImportKind

type ImportKind uint8
const (
	ExactRelease ImportKind = iota + 1
	SnapshotImport
	VersionRangeImport
)

type ImportPin

type ImportPin struct {
	Family          string
	Version         Version
	Content         ContentID
	AffectsContract bool
}

type Issue

type Issue struct {
	Code    string
	Message string
}

type JavaArtifactInventory

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

JavaArtifactInventory is immutable evidence derived from explicitly supplied JAR bytes. It is not evidence that the bytes were published or authentic.

func InspectJavaArtifact

func InspectJavaArtifact(input []byte, requested JavaArtifactLimits) (*JavaArtifactInventory, error)

InspectJavaArtifact reads every entry through archive/zip's CRC checker. It never extracts files and inventories only exact .class entry bytes.

func (*JavaArtifactInventory) ArtifactSHA256

func (i *JavaArtifactInventory) ArtifactSHA256() ContentID

func (*JavaArtifactInventory) Classes

func (i *JavaArtifactInventory) Classes() []PublicationFile

func (*JavaArtifactInventory) EntryCount

func (i *JavaArtifactInventory) EntryCount() int

func (*JavaArtifactInventory) ExpandedBytes

func (i *JavaArtifactInventory) ExpandedBytes() int64

type JavaArtifactLimits

type JavaArtifactLimits struct {
	InputBytes    int64
	Entries       int
	ExpandedBytes int64
	EntryBytes    int64
	NameBytes     int
}

JavaArtifactLimits bounds both ZIP metadata and streamed decompression. Zero fields select defaults; nonzero fields may only tighten hard limits.

func DefaultJavaArtifactLimits

func DefaultJavaArtifactLimits() JavaArtifactLimits

type JavaArtifactVerification

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

JavaArtifactVerification checks a ledger's historical byte claims. It makes no Java ABI compatibility or publication-authenticity conclusion.

func VerifyPublishedArtifact

func VerifyPublishedArtifact(ledger *PublicationLedger, inventory *JavaArtifactInventory) JavaArtifactVerification

VerifyPublishedArtifact compares a valid publication ledger with inventory obtained from explicitly supplied JAR bytes. Nil evidence is Unknown.

func (JavaArtifactVerification) Issues

func (v JavaArtifactVerification) Issues() []Issue

func (JavaArtifactVerification) Ready

func (v JavaArtifactVerification) Ready() bool

func (JavaArtifactVerification) Unknown

func (v JavaArtifactVerification) Unknown() bool

type MavenCoordinates

type MavenCoordinates struct {
	GroupID    string `json:"groupId"`
	ArtifactID string `json:"artifactId"`
	Version    string `json:"version"`
}

MavenCoordinates are values from Maven's effective model, not a raw pom.xml.

type MavenPlan

type MavenPlan struct {
	Ready            bool
	NoPendingVersion bool
	Suggested        Version
	Accepted         *Version
	RequiredChange   ArtifactChange
	Removed          []GeneratedVersion
	Issues           []Issue
}

func PlanMavenVersion

func PlanMavenVersion(input MavenPlanningInput) MavenPlan

PlanMavenVersion applies the explicitly schema-family-major-based no-codegen policy. It does not inspect Java bytecode or claim general API compatibility.

type MavenPlanningInput

type MavenPlanningInput struct {
	Current             Version
	Intended            *Version
	PreviouslyPublished []GeneratedVersion
	Next                []GeneratedVersion
	OtherChange         ArtifactChange
}

type PlanResult

type PlanResult struct {
	Ready            bool
	NoPendingVersion bool
	Suggested        *Version
	Accepted         *Version
	Issues           []Issue
}

func Plan

func Plan(input PlanningInput) PlanResult

Plan validates evidence and computes exactly the minimum permitted version. Policy rejection is returned as issues rather than an opaque error so a CLI can display the suggestion and every failed comparison together.

type PlanningInput

type PlanningInput struct {
	Family          string
	SnapshotContent ContentID
	SnapshotImports []ImportPin
	Intended        *Version
	Change          ChangeKind
	Releases        []ReleaseBaseline
	Comparisons     []CompatibilityEvidence
	Overrides       []CompatibilityOverride
	BreakingFixes   []BreakingFix
	EnforceForward  bool
}

type PromotionFamily

type PromotionFamily struct {
	Family       string
	Version      Version
	SnapshotPath string
	// SnapshotFileContent protects the editable file against a plan/apply race.
	// It differs from ReleaseContent when promotion materializes exact pins.
	SnapshotFileContent ContentID
	ReleasePath         string
	ReleaseContent      []byte
	Imports             []PromotionImport
	Generated           []Artifact
}

type PromotionImport

type PromotionImport struct {
	Family  string
	Kind    ImportKind
	Version Version
	Content ContentID
}

PromotionImport is typed so callers cannot accidentally erase whether the source used an exact version, SNAPSHOT, or a floating range.

type PromotionInput

type PromotionInput struct {
	Root          string
	Families      []PromotionFamily
	Available     []PublishedRelease
	Replacements  []ReplacementArtifact
	Deletions     []DeletionArtifact
	Preconditions []FilePrecondition
}

type PromotionResult

type PromotionResult struct {
	Released        []PublishedRelease
	SnapshotPending map[string]bool
}

func Promote

func Promote(input PromotionInput) (PromotionResult, error)

Promote validates and stages the whole batch before installing any output. Installation uses hard links, which fail rather than overwrite a colliding immutable destination. Returned errors are rolled back. A process crash is recovered by Recover, using inode identity so unrelated files are untouched.

type PublicationFile

type PublicationFile struct {
	Path   string    `json:"path"`
	SHA256 ContentID `json:"sha256"`
}

type PublicationLedger

type PublicationLedger struct {
	Version    int                 `json:"version"`
	GroupID    string              `json:"groupId"`
	ArtifactID string              `json:"artifactId"`
	Records    []PublicationRecord `json:"records"`
}

type PublicationPlan

type PublicationPlan struct {
	Applicable bool
	Ready      bool
	Unknown    bool
	Maven      *MavenPlan
	Removed    []GeneratedVersion
	Issues     []Issue
}

func PlanPublication

func PlanPublication(input PublicationPlanningInput) PublicationPlan

PlanPublication is the shared fail-closed no-codegen/removal gate. It proves only checked-in publication inventory and the required artifact version; it is not a general Java ABI comparison.

type PublicationPlanningInput

type PublicationPlanningInput struct {
	Ledger         *PublicationLedger
	Available      []PublicationTarget
	Excluded       []PublicationTarget
	DeletedSources []PublicationFile
	Next           []GeneratedVersion
	Maven          *MavenPlanningInput
	Effective      MavenCoordinates
}

type PublicationRecord

type PublicationRecord struct {
	State            PublicationState  `json:"state"`
	Family           string            `json:"family"`
	SchemaVersion    string            `json:"schemaVersion"`
	SchemaSHA256     ContentID         `json:"schemaSha256"`
	GeneratedSources []PublicationFile `json:"generatedSources"`
	ArtifactVersion  string            `json:"artifactVersion,omitempty"`
	ArtifactSHA256   ContentID         `json:"artifactSha256,omitempty"`
	Classes          []PublicationFile `json:"classes,omitempty"`
	InventorySHA256  ContentID         `json:"inventorySha256"`
	Reason           string            `json:"reason"`
}

type PublicationState

type PublicationState string
const (
	PublicationPublished   PublicationState = "published"
	PublicationUnpublished PublicationState = "unpublished"
)

type PublicationTarget

type PublicationTarget struct {
	Family        string
	SchemaVersion Version
	SchemaSHA256  ContentID
}

type PublishedRelease

type PublishedRelease struct {
	Family  string
	Version Version
	Content ContentID
}

type ReleaseBaseline

type ReleaseBaseline struct {
	Version Version
	Content ContentID
	Imports []ImportPin
}

type ReplacementArtifact

type ReplacementArtifact struct {
	Path            string
	ExpectedContent ContentID
	Content         []byte
}

ReplacementArtifact is the narrowly scoped mutable part of a promotion. ExpectedContent binds replacement to the exact regular file observed while planning; recovery retains an inode-owned backup until commit.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version is a stable semantic version. Prerelease/build syntax is intentionally excluded: released schema identities are exact x.y.z versions.

func ParseVersion

func ParseVersion(text string) (Version, error)

func (Version) Compare

func (v Version) Compare(other Version) int

func (Version) String

func (v Version) String() string

func (Version) Valid

func (v Version) Valid() bool

Jump to

Keyboard shortcuts

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