Spectre.GAM.Surface (Spectre v0.4.0)

Copy Markdown View Source

Versioned declaration of the consequence classes governed by a domain.

Classification is a lookup, not an authority decision. Missing classes are reported as :unknown_class; callers must never turn that result into an executable empty row. Application classes remain open and contract-driven; Spectre.GAM.GovernedAct.Class fixes metadata only for the small set of runtime transitions whose semantics must replay identically everywhere.

Summary

Types

Authoring report pinned to the two immutable declarations; never an admission.

t()

Static fields submitted to checks, fields still deferred, and detected errors.

Functions

Returns the plain, string-keyed ledger representation.

Looks up the declared row for a class.

Returns the content-derived reference, independent of an assigned ref.

Returns the stable digest of the complete surface.

Returns the declared refusal policy, defaulting to explicit silence.

Restores a surface from its canonical map.

Builds and validates a governed surface.

Returns whether the declared class requires materially bound consent.

Validates one Candidate against the class's closed consequence contract.

Validates projection- and time-dependent facts through the active Surface table.

Validates an admitted intrinsic transition before it can enter a Domain batch.

Reports that checking executable authoring requires an explicit diagnostic adapter. The extracted kernel does not depend on an Agent DSL grammar.

Checks an authoring Definition through an explicit diagnostic adapter.

Types

class()

@type class() :: String.t()

definition_report()

@type definition_report() :: %{
  definition_ref: String.t(),
  surface_ref: String.t(),
  templates: %{required(String.t()) => template_check()}
}

Authoring report pinned to the two immutable declarations; never an admission.

t()

@type t() :: %Spectre.GAM.Surface{
  consequence_contracts: %{
    optional(class()) => Spectre.GAM.Consequence.Contract.t()
  },
  consequence_validators: %{
    optional(class()) => Spectre.GAM.Consequence.Validator.id()
  },
  declarations: %{required(class()) => Spectre.GAM.Row.t()},
  fallbacks: %{optional(class()) => Spectre.GAM.Fallback.Policy.t()},
  presentation_required_classes: [class()],
  ref: String.t(),
  revision: pos_integer(),
  schema_version: 1
}

template_check()

@type template_check() :: %{checked: [atom()], deferred: [atom()], errors: [term()]}

Static fields submitted to checks, fields still deferred, and detected errors.

Functions

canonical(surface)

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

Returns the plain, string-keyed ledger representation.

classify(surface, class)

@spec classify(t(), class()) :: {:ok, Spectre.GAM.Row.t()} | {:error, :unknown_class}

Looks up the declared row for a class.

content_ref(surface)

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

Returns the content-derived reference, independent of an assigned ref.

digest(surface)

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

Returns the stable digest of the complete surface.

fallback(surface, class)

@spec fallback(t(), class()) ::
  {:ok, Spectre.GAM.Fallback.Policy.t()} | {:error, :unknown_class}

Returns the declared refusal policy, defaulting to explicit silence.

from_canonical(value)

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

Restores a surface from its canonical map.

new(surface)

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

Builds and validates a governed surface.

presentation_required?(surface, class)

@spec presentation_required?(t(), class()) :: boolean()

Returns whether the declared class requires materially bound consent.

validate_consequence(surface, candidate)

@spec validate_consequence(t(), Spectre.GAM.Candidate.t()) :: :ok | {:error, term()}

Validates one Candidate against the class's closed consequence contract.

validate_facts(surface, candidate, projection, time)

@spec validate_facts(t(), Spectre.GAM.Candidate.t(), map(), integer()) ::
  :ok | {:error, term()}

Validates projection- and time-dependent facts through the active Surface table.

validate_transition(surface, candidate, decision, act, projection)

@spec validate_transition(
  t(),
  Spectre.GAM.Candidate.t(),
  Spectre.GAM.Decision.t(),
  Spectre.GAM.Act.t(),
  map()
) :: :ok | {:error, term()}

Validates an admitted intrinsic transition before it can enter a Domain batch.

verify_definition(surface, definition)

@spec verify_definition(t(), Spectre.GAM.Definition.t()) ::
  {:ok, definition_report()} | {:error, term()}

Reports that checking executable authoring requires an explicit diagnostic adapter. The extracted kernel does not depend on an Agent DSL grammar.

Use verify_definition/3 with the verifier for the application's authoring format. This static diagnostic never admits a Candidate, proves consent, activates a Definition, or checks live authority and available resources.

verify_definition(surface, definition, verifier)

@spec verify_definition(t(), Spectre.GAM.Definition.t(), module()) ::
  {:ok, definition_report()} | {:error, term()}

Checks an authoring Definition through an explicit diagnostic adapter.

The verifier implements Spectre.GAM.Definition.Verifier and receives validated immutable records. Reports should pin both refs and distinguish checked, deferred and invalid template fields. Missing occurrence facts stay deferred; they must not be invented to make a static check pass. Admission and replay never call this adapter and never treat its report as authority.