# `ExGAM.Domain.Command.Durability`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/domain/command/durability.ex#L1)

Shared append and completion policy for a durable Domain command.

Command modules still own planning, conflict re-planning and recovery checks.
This helper owns the mechanical boundary they all share: obtain an operational
batch identity, append once, recover after a CAS conflict, and classify fatal
durability failures. Ordinary adapter errors are returned; exhausted or
ambiguous commits stop the Sequencer so supervision can recover from ledger
truth.

# `command_result`

```elixir
@type command_result(value) ::
  {:ok, ExGAM.Domain.Sequencer.State.t(), value}
  | {:ok, ExGAM.Domain.Sequencer.State.t(), ExGAM.Act.t(), ExGAM.Attempt.t(),
     ExGAM.Secret.CheckoutReceipt.t()}
  | {:error, ExGAM.Domain.Sequencer.State.t(), term()}
```

# `append`

```elixir
@spec append(
  ExGAM.Domain.Sequencer.State.t(),
  [map()],
  non_neg_integer(),
  non_neg_integer(),
  (term() -&gt; command_result(term())),
  (ExGAM.Domain.Sequencer.State.t(), non_neg_integer() -&gt;
     command_result(term()))
) :: command_result(term())
```

Appends payloads and invokes command-specific recovery or re-planning callbacks.

# `preflight`

```elixir
@spec preflight(ExGAM.Domain.Sequencer.State.t()) ::
  {:ok, ExGAM.Domain.Sequencer.State.t()}
  | {:error, ExGAM.Domain.Sequencer.State.t(), term()}
```

Repairs derivable Duties before a command observes or changes Domain state.

---

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