Pure governed-act history fold.
This is the single semantic reducer shared by the live Domain projection and the independent audit driver. It receives verified ledger entries or decoded provisional events and derives disposable state; it never performs I/O, grants authority, or talks to an executor.
Keeping transition semantics here is important: runtime replay and offline audit may have different inputs and error presentation, but they must not maintain separate copies of the Governed Act Model.
Summary
Functions
Applies one complete, exactly addressed entry batch to a verified prefix.
Applies and validates one timestamped payload batch to disposable governed state.
Creates empty disposable state; Genesis and external recognition are still required.
Validates a complete proposed batch against an already verified prefix.
Folds an already ledger-verified sequence of Domain entries.
Validates whole-prefix relationships after all events have been folded.
Types
@type dispatch_cancellation() :: Spectre.GAM.GovernedAct.State.dispatch_cancellation()
@type meter_recontainment() :: Spectre.GAM.GovernedAct.State.meter_recontainment()
@type reservation_status() :: Spectre.GAM.GovernedAct.State.reservation_status()
@type t() :: Spectre.GAM.GovernedAct.State.t()
Functions
@spec append_batch(t(), [Spectre.GAM.Ledger.Entry.t()]) :: {:ok, t()} | {:error, term()}
Applies one complete, exactly addressed entry batch to a verified prefix.
This is the same transition path as replay, not a second live semantics. The fold checks the exact Domain, predecessor digest, revisions, acquisition time and atomic batch coordinates; an in-memory result alone is never authority to release a capability.
Recovery uses committed entries; Spectre.GAM.GovernedAct.Commit.prepare/4 also
uses this function on proposed entries before the write. The fold cannot
distinguish physical persistence and does not try to: the transaction driver
must confirm the exact receipt before publishing the prepared State.
@spec apply_payloads(t(), [map()], non_neg_integer()) :: {:ok, t()} | {:error, term()}
Applies and validates one timestamped payload batch to disposable governed state.
Creates empty disposable state; Genesis and external recognition are still required.
@spec prepare_batch(t(), [map()], non_neg_integer()) :: {:ok, t()} | {:error, term()}
Validates a complete proposed batch against an already verified prefix.
@spec replay_verified(String.t(), [Spectre.GAM.Ledger.Entry.t()], map()) :: {:ok, t()} | {:error, term()}
Folds an already ledger-verified sequence of Domain entries.
Structural snapshot verification, including complete non-interleaved batch
topology, belongs to the caller (Domain.Projection or Audit). This
function owns only canonical event decoding and governed transition
semantics, which keeps the two drivers independent at their I/O boundaries
without introducing another implementation of the transition rules.
Validates whole-prefix relationships after all events have been folded.