Spectre.GAM.Definition (Spectre v0.4.0)

Copy Markdown View Source

Immutable, portable definition used by the governed surface.

Definitions contain declarative data only. They do not embed evaluator functions, modules or callbacks capable of granting authority. Revisions form an explicit content-addressed chain and become active only through a governance Act recorded by the Domain.

Summary

Functions

Returns the plain, string-keyed ledger representation.

Returns the reference derived from immutable Definition content.

Returns the stable digest of the complete Definition.

Restores a Definition and verifies its content reference.

Returns the stable logical key shared by all revisions.

Builds and validates a declarative Definition.

Prepares the next immutable revision without activating it.

Types

t()

@type t() :: %Spectre.GAM.Definition{
  body: map(),
  declared_at: integer(),
  name: String.t(),
  namespace: String.t(),
  previous_ref: String.t() | nil,
  ref: String.t(),
  revision: pos_integer(),
  schema_version: 1
}

Functions

canonical(definition)

@spec canonical(t()) :: map()

Returns the plain, string-keyed ledger representation.

content_ref(definition)

@spec content_ref(t()) :: String.t()

Returns the reference derived from immutable Definition content.

digest(definition)

@spec digest(t()) :: String.t()

Returns the stable digest of the complete Definition.

from_canonical(value)

@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}

Restores a Definition and verifies its content reference.

key(definition)

@spec key(t()) :: {String.t(), String.t()}

Returns the stable logical key shared by all revisions.

new(definition)

@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}

Builds and validates a declarative Definition.

revise(current, body, declared_at)

@spec revise(t(), map(), integer()) :: {:ok, t()} | {:error, term()}

Prepares the next immutable revision without activating it.

This is the data operation behind Morph: the application supplies a new body (from a DSL, transformation function or planner) and an explicit declaration time. Identity, predecessor and revision are derived from the exact current record, not chosen by the transformation. Submit the result through Spectre.GAM.revise_definition/4; a stale predecessor is rejected by governance. No process state, Mandate, open Duty or active code changes here.