AgentBlueprintProtocol.Conformance.Corpus (Agent Blueprint Protocol v0.1.1)

Copy Markdown View Source

The pure conformance-corpus loader and integrity verifier: load/1 takes %{path => binary} and performs no I/O — only the CLI touches the filesystem.

Every failure is a typed %Error{} from the conformance-corpus group, value-free (subjects name the corpus's own members, never offending content). The check→code mapping is total over the pipeline:

checkcode
index absent/undecodable/bad structure/non-canonical bytes/corpus_digest or registry_digest mismatch:corpus_index_invalid
case file undecodable/wrong shape; case-level structure incl. malformed tamper, missing base, verbatim ≠ derived, lying raw_file reference:corpus_case_invalid
per-file SHA-256 ≠ index:corpus_hash_mismatch
file-set inequality (either direction):corpus_file_set_mismatch
case-id repeat or non-binary:corpus_case_id_duplicate
per-file or total count disagreement:corpus_count_mismatch
applicability shape / required-cell / observed-count failure:corpus_applicability_incomplete
zero cases total:corpus_empty

Applicability totality is enforced against the COMPILED-IN floor (floor/0, the protocol's pinned 16×29 table), not merely the index's self-consistency — an all-n_a corpus cannot load. A required cell's declared count must EQUAL the observed executed count (over-counting reds too); an n_a cell carries {"n_a" => reason} with a non-empty reason and zero executed cases.

Corpus identity is corpus_digest ( Digest.hash(:corpus_index, JCS(index minus corpus_digest))), recomputed at load and compared — a carried-but-unverified digest would be decorative. The index file itself must BE canonical bytes. registry_digest binds the corpus to the extension-registry state: extension verdicts depend on WHAT is registered, so corpus-registry drift must red, not silently flip cases.

.raw sidecars are hash-bound (per-file SHA in the index + the referring case's own reference hash) and carried as opaque binaries — never parsed. Corpus loading and integrity are facts about test data — the loader carries no authority. Corpus loading and integrity are facts about test data — the loader carries no authority.

Summary

Functions

The 29 case classes.

The compiled-in floor: per surface, the required-class list and the falsifiable n_a reason covering its complement. The loader enforces the index against THIS table — totality is falsifiable against the design commitment, not merely self-consistent.

Loads and integrity-verifies a %{path => binary} corpus map.

The 16 floor surfaces (the protocol's pinned applicability floor).

Types

t()

@type t() :: %AgentBlueprintProtocol.Conformance.Corpus{
  case_ids: MapSet.t(binary()),
  cases: [{binary(), [map()]}],
  data: %{required(binary()) => term()},
  identity: binary(),
  index: map(),
  index_bytes: binary(),
  raws: %{required(binary()) => binary()}
}

Functions

classes()

@spec classes() :: [binary()]

The 29 case classes.

floor()

@spec floor() :: %{required(binary()) => %{required: [binary()], n_a: binary()}}

The compiled-in floor: per surface, the required-class list and the falsifiable n_a reason covering its complement. The loader enforces the index against THIS table — totality is falsifiable against the design commitment, not merely self-consistent.

load(map)

@spec load(%{required(binary()) => binary()}) ::
  {:ok, t()} | {:error, AgentBlueprintProtocol.Error.t()}

Loads and integrity-verifies a %{path => binary} corpus map.

surfaces()

@spec surfaces() :: [binary()]

The 16 floor surfaces (the protocol's pinned applicability floor).