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 ¶
CanonicalPath resolves symlinks in an existing prefix without creating the missing suffix. Dangling symlinks and non-absence filesystem errors fail closed.
func ReadJSON ¶
ReadJSON distinguishes an absent file from dangling/redirected metadata. Only a genuinely absent binding permits default selection. It writes nothing.
func ValidateClaims ¶
ValidateClaims validates record identity and uniqueness. Filesystem overlap policy remains with each reader; the host additionally detects case aliases.
func ValidateRecord ¶
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 ¶
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 ¶
Error carries a private, fixed diagnostic and the host's existing error class. Underlying JSON errors must not expose machine-local metadata values.
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.