workspace

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package workspace atomically projects committed catalogs into the optional human-editable provider YAML workspace.

Index

Constants

View Source
const (

	// IssueDirty identifies a workspace whose semantic contents differ from the
	// last successfully projected generation.
	IssueDirty = "workspace_modified"
)

Variables

This section is empty.

Functions

func EncodeEndpointProjection

func EncodeEndpointProjection(catalog *catalogs.Catalog, identity Identity) ([]byte, error)

EncodeEndpointProjection renders the deterministic, generation-bound author/model to provider-offering projection used by workspace tooling.

func ValidateHumanLayout

func ValidateHumanLayout(path, migrationTarget string) error

ValidateHumanLayout verifies that path is absent or is not a pre-plan immutable generation store. It is read-only and safe to call before construction, repair, or publication.

func ValidateMachineSeparation

func ValidateMachineSeparation(humanPath, machinePath, machineKind string) error

ValidateMachineSeparation verifies that a machine-owned lifecycle root does not equal, contain, or sit beneath the human provider-YAML workspace.

Types

type Identity

type Identity struct {
	GenerationID    string
	PayloadChecksum string
}

Identity binds a workspace projection to one committed immutable generation.

func (Identity) Validate

func (i Identity) Validate() error

Validate verifies that the committed generation identity is complete.

type InputExpectation

type InputExpectation struct {
	Path             string
	Exists           bool
	Checksum         string
	EndpointChecksum string
}

InputExpectation records workspace presence and, once loaded, its semantic digest before candidate construction. Projection rejects a different input.

func BindInputCatalog

func BindInputCatalog(input InputExpectation, catalog *catalogs.Catalog) (InputExpectation, error)

BindInputCatalog records the semantic digest of the human catalog loaded from an existing workspace before candidate construction.

func ObserveInput

func ObserveInput(path string) (InputExpectation, error)

ObserveInput records the selected workspace's presence without creating or modifying it.

func (InputExpectation) RequiresSeed

func (i InputExpectation) RequiresSeed() bool

RequiresSeed reports whether an explicit operation selected an absent human workspace that must be materialized even when catalog facts are unchanged.

type LegacyLayoutMigrationResult

type LegacyLayoutMigrationResult struct {
	WorkspacePath     string
	StatePath         string
	GenerationID      string
	PayloadChecksum   string
	WorkspaceChecksum string
	RetainedCount     int
}

LegacyLayoutMigrationResult describes one completed machine-store relocation and human-workspace projection.

func MigrateLegacyLayout

func MigrateLegacyLayout(
	ctx context.Context,
	legacyPath string,
	statePath string,
) (LegacyLayoutMigrationResult, error)

MigrateLegacyLayout explicitly relocates the pre-plan filesystem generation store and projects its current generation back to the vacated human workspace path. Validation and both advisory locks complete before the first rename.

type Receipt

type Receipt struct {
	GenerationID      string
	WorkspaceChecksum string
	EndpointChecksum  string
}

Receipt records the exact semantic workspace projection that became visible.

func Project

func Project(ctx context.Context, path string, catalog *catalogs.Catalog, identity Identity) (Receipt, error)

Project stages, validates, syncs, and atomically publishes one workspace.

func ProjectExpected

func ProjectExpected(
	ctx context.Context,
	path string,
	catalog *catalogs.Catalog,
	identity Identity,
	input InputExpectation,
) (Receipt, error)

ProjectExpected projects one workspace only if its presence still matches the state observed before candidate construction.

type RepairResult

type RepairResult struct {
	Status    RepairStatus
	IssueCode string
}

RepairResult reports startup projection reconciliation.

func Repair

func Repair(ctx context.Context, path string, current *catalogs.Catalog, identity Identity) (RepairResult, error)

Repair compares a workspace and its durable marker with current. It repairs only a missing workspace or an unchanged prior projection.

type RepairStatus

type RepairStatus string

RepairStatus describes startup reconciliation between the durable current generation and its optional YAML projection.

const (
	// RepairStatusCurrent means workspace contents and marker already match.
	RepairStatusCurrent RepairStatus = "current"
	// RepairStatusRepaired means startup safely restored or acknowledged the
	// current committed generation without publishing another generation.
	RepairStatusRepaired RepairStatus = "repaired"
	// RepairStatusSkippedDirty means semantic human edits prevented automatic
	// replacement.
	RepairStatusSkippedDirty RepairStatus = "skipped_dirty"
)

Jump to

Keyboard shortcuts

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