Spectre.GAM.Act (Spectre v0.4.0)

Copy Markdown View Source

Immutable, durable exercise of authority.

An Act freezes the admitted consequence and its complete authority-side context. It intentionally has no mutable status, result or error field; attempts and outcomes are separate world-side records.

requested_mandate_ref preserves the Candidate's exact selection separately from mandate_ref, which records the Mandate actually resolved by admission. Keeping both removes guesswork when the Candidate is rebuilt during replay. Condition refs and the Evidence actually used to recognize them remain separate in recognition_refs and recognition_evidence_refs.

Summary

Functions

Returns the plain, string-keyed ledger representation.

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

Returns the stable digest of the complete Act.

Restores an Act from its canonical map.

Builds and validates an immutable Act.

Returns whether the Act commits any Meter reservation.

Checks the Act's exact declared effect-row dimensions.

Checks that every required reference is frozen in the Act targets.

Types

t()

@type t() :: %Spectre.GAM.Act{
  accountable_ref: String.t(),
  authenticated_principal_ref: String.t(),
  authentication_ref: String.t(),
  authorizer_ref: String.t(),
  candidate_identity_key: String.t(),
  class: String.t(),
  committed_at: integer(),
  consent: Spectre.GAM.Consent.t() | nil,
  consequence: term(),
  decision_ref: String.t(),
  disclosure: Spectre.GAM.Disclosure.t() | nil,
  evidence_refs: [String.t()],
  executor_contract_ref: String.t(),
  executor_ref: String.t(),
  host_generation: non_neg_integer(),
  host_profile_ref: String.t(),
  ingress_ref: String.t(),
  mandate_ref: String.t(),
  mandate_revision: pos_integer(),
  material_digest: String.t(),
  observation_window_ms: non_neg_integer(),
  presentation_ref: String.t() | nil,
  proposer_ref: String.t(),
  purpose_params: map(),
  purpose_ref: String.t(),
  recognition_evidence_refs: [String.t()],
  recognition_refs: [String.t()],
  ref: String.t(),
  requested_mandate_ref: String.t() | nil,
  reservations: Spectre.GAM.Kernel.Meter.Amounts.t(),
  row: Spectre.GAM.Row.t(),
  schema_version: 1,
  scope_ref: String.t(),
  subject_refs: [String.t()],
  submission_context_ref: String.t(),
  surface_revision: non_neg_integer(),
  target_refs: [String.t()]
}

Functions

canonical(act)

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

Returns the plain, string-keyed ledger representation.

content_ref(act)

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

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

digest(act)

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

Returns the stable digest of the complete Act.

from_canonical(value)

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

Restores an Act from its canonical map.

new(act)

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

Builds and validates an immutable Act.

reservations?(act)

@spec reservations?(t()) :: boolean()

Returns whether the Act commits any Meter reservation.

row?(act, dimensions)

@spec row?(t(), [Spectre.GAM.Row.dimension()]) :: boolean()

Checks the Act's exact declared effect-row dimensions.

targets?(act, required_refs)

@spec targets?(t(), [String.t()]) :: boolean()

Checks that every required reference is frozen in the Act targets.