profilecontract

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 7 Imported by: 2 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 profilecontract owns the v1 read-only machine-local profile protocol. It never creates, repairs, claims, or publishes metadata. The host remains the authority for full portable manifests and all ownership mutations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPath

func CanonicalPath(path string) (string, error)

CanonicalPath resolves symlinks in an existing prefix without creating the missing suffix. Dangling symlinks and non-absence filesystem errors fail closed.

func ReadJSON

func ReadJSON(path string, value any) error

ReadJSON distinguishes an absent file from dangling/redirected metadata. Only a genuinely absent binding permits default selection. It writes nothing.

func ValidateClaims

func ValidateClaims(registry Claims) error

ValidateClaims validates record identity and uniqueness. Filesystem overlap policy remains with each reader; the host additionally detects case aliases.

func ValidateRecord

func ValidateRecord(record Record) error

ValidateRecord requires a canonical nonzero workspace UUID and an absolute, clean state directory. Existing state and container symlinks fail closed; validation never creates the missing directory suffix.

Types

type Claims

type Claims struct {
	SchemaVersion int      `json:"schemaVersion"`
	Claims        []Record `json:"claims"`
}

Claims is the durable v1 registry of custom profile bindings. An empty claim list grants no ownership; readers must apply their own filesystem overlap policy.

type Error

type Error struct {
	Code    string
	Message string
}

Error carries a private, fixed diagnostic and the host's existing error class. Underlying JSON errors must not expose machine-local metadata values.

func (*Error) Error

func (e *Error) Error() string

Error returns the fixed diagnostic without serializing machine-local metadata.

type ManifestIdentity

type ManifestIdentity struct {
	SchemaVersion int    `json:"schemaVersion"`
	WorkspaceID   string `json:"workspaceID"`
	Slug          string `json:"slug"`
	Profile       struct {
		Kind string `json:"kind"`
	} `json:"profile"`
}

ManifestIdentity deliberately excludes repository/link/port policy validation.

type OwnershipJournal

type OwnershipJournal[M any] struct {
	SchemaVersion int    `json:"schemaVersion"`
	WorkspaceID   string `json:"workspaceID"`
	Root          string `json:"root"`
	Phase         string `json:"phase"`
	RenameTo      string `json:"renameTo"`
	Manifest      M      `json:"manifest"`
	Resources     []struct {
		CommonDir string `json:"commonDir"`
	} `json:"resources"`
}

OwnershipJournal projects the same serialized journal into either the SDK's narrow identity view or the host's full manifest, without duplicating schema.

func (*OwnershipJournal[M]) ValidateBoundary

func (j *OwnershipJournal[M]) ValidateBoundary(root, workspaceID string, intent ManifestIdentity) (string, error)

ValidateBoundary accepts only the selected root or the exact interrupted sibling rename. The returned old root must remain protected during recovery. The host must also validate the complete rename manifest before using it.

type Record

type Record struct {
	SchemaVersion int    `json:"schemaVersion"`
	WorkspaceID   string `json:"workspaceID"`
	StateRoot     string `json:"stateRoot"`
}

Record is shared by bindings, durable claims, and external owner markers.

type WorkspaceIdentity

type WorkspaceIdentity struct {
	ManifestIdentity

	Repositories []struct {
		Directory string `json:"directory"`
	} `json:"repositories"`
}

WorkspaceIdentity adds source-directory boundaries to the narrow manifest identity projection; it does not validate the host's complete manifest schema.

Jump to

Keyboard shortcuts

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