Spectre.GAM.Audit (Spectre v0.4.0)

Copy Markdown View Source

Independent driver for semantic verification of a Domain ledger export.

The driver verifies the exported hash chain itself and never consumes a live Domain projection. It then invokes the same pure Governed Act fold used by recovery, followed by whole-history checks at the trusted capture time. A later observation time may expose additional obligations, but cannot make an immutable export acquire new Duty or dispatch-cancellation records. Sharing the pure semantics prevents runtime/auditor drift without sharing runtime state or trusting the sequencer.

Genesis and host attestations remain visible trust anchors: a successful report does not claim to prove deployment isolation or an attestation scheme external to the ledger.

Summary

Functions

Verifies a complete ledger snapshot against its pinned Constitution.

Verifies completeness at captured_at and observes that prefix at audited_at.

Types

report()

@type report() :: Spectre.GAM.Audit.Report.t()

Functions

verify(snapshot, constitution, audited_at)

@spec verify(Spectre.GAM.Ledger.snapshot() | map(), map(), non_neg_integer()) ::
  {:ok, report()} | {:error, term()}

Verifies a complete ledger snapshot against its pinned Constitution.

This strict form treats audited_at as both capture and observation time: every obligation required by then must be materialized. Use verify/4 for an export captured earlier. Neither time can precede the newest durable acquisition time. Structural, transition and whole-history failures remain distinct in the returned error so callers can diagnose the failed boundary.

verify(snapshot, constitution, captured_at, audited_at)

@spec verify(
  Spectre.GAM.Ledger.snapshot() | map(),
  map(),
  non_neg_integer(),
  non_neg_integer()
) ::
  {:ok, report()} | {:error, term()}

Verifies completeness at captured_at and observes that prefix at audited_at.

Both times are supplied by a trusted host; audited_at >= captured_at. Missing Duties or cancellations already required at capture remain errors. Later obligations are reported separately as pending_duty_causes and expired_dispatches, never inserted into the ledger or counted as recorded open Duties. The report says nothing about events outside this prefix.