# `Spectre.GAM.Domain.Transaction`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/domain/transaction.ex#L1)

Durable transaction boundary shared by Domain command workflows.

It performs one exact append, classifies an ambiguous result and advances the
disposable projection only from a confirmed durable batch. Conflicts resume
from the verified prefix; full replay remains the cold-start recovery path.
Conflict policy remains with the calling workflow; this module never replies
to callers, schedules work or grants a capability.

Missing derived Duties are repaired through the same append/recovery path so
every workflow observes an equivalent governed prefix.

A physical batch is not a new authority boundary. This workflow changes only
the supplied logical Domain; sharing a Store or supervisor never merges the
identities, Mandates or obligations of independently governed participants.

# `append_exact`

```elixir
@spec append_exact(
  Spectre.GAM.Domain.Sequencer.State.t(),
  String.t(),
  [map()],
  non_neg_integer()
) :: {:ok, Spectre.GAM.GovernedAct.State.t()} | :conflict | {:error, term()}
```

Appends one exact batch and returns the confirmed, Duty-complete projection.

Preparation is pure; only the store acknowledgement/recovery establishes
durability. `:conflict` returns control to the command's CAS policy. Failure
after a write does not prove that the write was absent, so it remains an
error rather than a fabricated previous state or permission to dispatch.
This function never mints a Grant or calls an executor.

# `duties_materialized`

```elixir
@spec duties_materialized(Spectre.GAM.GovernedAct.State.t(), non_neg_integer()) ::
  :ok | {:error, term()}
```

Checks that no derived Duty is waiting to be durably materialized.

# `operational_id`

```elixir
@spec operational_id(Spectre.GAM.Domain.Sequencer.State.t()) ::
  {:ok, String.t()} | {:error, term()}
```

Obtains an opaque operational identifier from the configured source.

# `recover_verified`

```elixir
@spec recover_verified(Spectre.GAM.Domain.Sequencer.State.t()) ::
  {:ok, Spectre.GAM.GovernedAct.State.t()} | {:error, term()}
```

Recovers and verifies the durable projection without adding repair events.

# `recover_with_repair`

```elixir
@spec recover_with_repair(Spectre.GAM.Domain.Sequencer.State.t()) ::
  {:ok, Spectre.GAM.GovernedAct.State.t()} | {:error, term()}
```

Recovers verified state and completes any missing derived-Duty batch.

# `repair_missing_duties`

```elixir
@spec repair_missing_duties(Spectre.GAM.Domain.Sequencer.State.t()) ::
  {:ok, Spectre.GAM.GovernedAct.State.t()} | {:error, term()}
```

Materializes every Duty required by the current prefix, retrying CAS conflicts.

# `trusted_now`

```elixir
@spec trusted_now(module()) :: {:ok, non_neg_integer()} | {:error, term()}
```

Reads trusted host time while containing adapter failures.

# `trusted_recorded_at`

```elixir
@spec trusted_recorded_at(Spectre.GAM.Domain.Sequencer.State.t()) ::
  {:ok, non_neg_integer()} | {:error, term()}
```

Returns monotonic ledger time relative to the recovered prefix.

# `verify_payload_references`

```elixir
@spec verify_payload_references(term(), [map()]) :: :ok | {:error, term()}
```

Checks content references carried by a list of canonical event envelopes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
