Optional host checks and incident handling around verified Domain recovery.
Configure recovery_policy: {MyPolicy, options} when starting a Domain.
check/2 receives only its identity and the recovered head, after canonical,
semantic, Genesis and payload checks. A nil head means no ledger was found:
the host can reject bootstrap of a Domain which must already exist.
The host may compare this information against an independently retained witness. A hash chain alone cannot detect a coherently rewritten history or rollback. Checking an older witness against a newer head requires verifying their relationship; merely comparing revision numbers is not sufficient. This callback does not make the host or database tamper-proof.
Optional failed/2 receives startup failures and fatal runtime incidents.
Enqueue application-owned quarantine, backup recovery or operator review
there. Its result cannot authorize work, replace a projection or suppress the
original error. After repair, restart the Domain and run verification again.
Never blindly retry an external effect whose Outcome remains ambiguous.
Callbacks run in isolated, monitored processes with recovery_timeout
(default 5 seconds). Do not perform a long repair in the callback: arrange it
in the application's supervision tree. Notifications are best effort, may be
repeated on restart, and are not a durable incident log. Callback failure or
timeout cannot turn a failed verification into success.
Managed GAM also supports optional recover/2: return :wait (the default),
{:retry, milliseconds} or :memory. Retry re-verifies the existing Domain;
memory starts a distinct RAM Domain, never replacing facts in the old one.
The host chooses whether losing continuity is acceptable. See the Domain
storage guide for AgentServer checkpoint and consent handling.
This is a recovery boundary, not continuous storage monitoring. A running Domain uses its verified prefix and checks new suffixes; it does not reread all historical bytes before every decision. Independent audits and external witness publication remain host responsibilities.
Summary
Functions
Dispatches a bounded incident notification without delaying a failing Domain.
Optional host lifecycle decision; it never replaces or authorizes GAM facts.
Types
Callbacks
Functions
@spec notify_failed(config(), incident(), pos_integer()) :: :ok
Dispatches a bounded incident notification without delaying a failing Domain.
Optional host lifecycle decision; it never replaces or authorizes GAM facts.