Spectre.Foundation.Conformance (Spectre v0.3.0)

Copy Markdown View Source

Executable compatibility gate for Spectre's durable foundations.

The gate gives applications and satellite libraries one public place to verify legacy checkpoints, the current Definition/Manifest pair, and the schema matrix supported by the running Spectre release. It performs real decode, migration, validation, and current-writer round trips; it does not maintain a second representation of any runtime value.

This module deliberately has no ExUnit dependency, so downstream projects can call it from their own test or release-verification tooling.

Summary

Functions

Returns the executable foundation-conformance contract version.

Returns the reader/writer and public golden-path matrix for this release.

Verifies one canonical Definition and its sealed Manifest.

Verifies a transported Forge Proposal and its complete evidence lineage.

Verifies an Instance checkpoint and rewrites it through the current writer.

Verifies a transported Reflection projection against all of its exact inputs.

Verifies a Run checkpoint and rewrites it through the current Run writer.

Verifies a State payload and rewrites it through the current State writer.

Types

report()

@type report() :: %{
  :contract_version => pos_integer(),
  :format => atom(),
  :digest => String.t(),
  optional(atom()) => term()
}

Functions

contract_version()

@spec contract_version() :: pos_integer()

Returns the executable foundation-conformance contract version.

matrix()

@spec matrix() :: map()

Returns the reader/writer and public golden-path matrix for this release.

Reader lists are normative. A writer always emits only the last version in its corresponding family; older versions are accepted solely at recovery boundaries and are migrated into the current in-memory model.

verify_checkpoint(checkpoint)

@spec verify_checkpoint(binary() | map()) :: {:ok, report()} | {:error, term()}

verify_definition(definition, manifest)

@spec verify_definition(
  Spectre.Definition.Canonical.t() | binary(),
  Spectre.Definition.Manifest.t() | binary()
) :: {:ok, report()} | {:error, term()}

Verifies one canonical Definition and its sealed Manifest.

Each argument may be the validated struct or its canonical encoded bytes. The returned identity is derived from the same canonical model consumed by publication and activation.

verify_forge_proposal(proposal)

@spec verify_forge_proposal(Spectre.Forge.Proposal.t() | map() | binary()) ::
  {:ok, report()} | {:error, term()}

Verifies a transported Forge Proposal and its complete evidence lineage.

verify_instance_checkpoint(checkpoint)

@spec verify_instance_checkpoint(binary() | map()) ::
  {:ok, report()} | {:error, term()}

Verifies an Instance checkpoint and rewrites it through the current writer.

verify_checkpoint/1 is retained as a concise alias for tooling whose only canonical checkpoint family is the Instance checkpoint.

verify_reflection(projection, definition, manifest, activation, snapshot)

Verifies a transported Reflection projection against all of its exact inputs.

This gate regenerates the projection; checking its stored digest alone is insufficient because effective Activation and Experience may have changed.

verify_run(checkpoint)

@spec verify_run(binary()) :: {:ok, report()} | {:error, term()}

Verifies a Run checkpoint and rewrites it through the current Run writer.

verify_state(payload)

@spec verify_state(binary() | map()) :: {:ok, report()} | {:error, term()}

Verifies a State payload and rewrites it through the current State writer.