Receipt index and replay
Linear DRA-167. Status: proposed on branch feat/dra-167-receipt-index as a draft pull request.
It changes the layout of this repository, so under AGENTS.md ("Safety and approvals") it needs
explicit maintainer approval and a change to the ADR 0033 doctrine in aien-architecture.
Drake Stapleton has delegated merge judgment to Queen, the Completion Hive coordinator (DRA-162,
59767dce); Queen's approval of this pull request is the maintainer approval. The ADR 0033
amendment is drafted below and lands in aien-architecture
before this pull request merges. Neither has happened yet.
index/receipt_index.json lists receipts that may be cited as evidence. For each one it pins
where the bytes live, what they hash to, which correction applies and what verdict follows.
tools/replay_receipt.py rebuilds every entry from the pinned commits, checks the shelf HEAD
for a later correction, and refuses an entry whose recomputed fields differ from the file or
that carries a field the tool does not check.
What an entry records
| Field | Meaning |
|---|---|
id | Entry name (no :). |
issue_or_gate | The issue or gate the receipt evidences: value, basis and verified. Derived from the receipt where it names one: for signed bundles the repository and the gate of every required check, for Omega receipts milestone and contract_id. A receipt that names neither carries operator text with verified: false, and replay prints it as UNVERIFIED. |
kind | signed-bundle (this shelf) or omega-qualification-receipt (aien-dev/omega-evidence). |
shelf | Repository, commit, path, SHA-256 and byte length of the receipt bytes at that commit. |
source | The verified repository and commit. For Omega receipts also: the field that named the commit, whether it resolves upstream, and the result for every artifact digest (match, mismatch, absent, commit-unresolved, not-recoverable (build output)). |
trust_anchor | Signed bundles: the first parent of the source commit, with its .aien/verify.pub and .aien/always. |
correction | The adjacent <basename>.correction.json at the shelf commit, which must be byte-identical at the shelf HEAD: path, SHA-256, id, supersedes_historical_status_for_admission, qualification_claim. null when none exists at either. |
historical_verdict, effective_verdict, effective_basis | The status the receipt states, the verdict after the admission check, and which rule decided it. |
replay | The command that replays the entry: exactly python3 tools/replay_receipt.py replay <id>. |
Any other field, in an entry or at the top level of the index, is REJECTED (UNKNOWN_FIELD):
a claim the tool does not check cannot sit in the index. The descriptive top-level fields
(issue, generated_by, independence, admission_check, precedence, exit_codes, scope,
excluded, generated_utc) are known but not recomputed; see "Values taken on trust".
The admission check
Applied in this order. The first rule that decides wins.
- Bytes. The file at
shelf.repository@shelf.commit:shelf.pathmust hash toshelf.sha256. Otherwise the entry is REJECTED (DIGEST_MISMATCH). - Correction. The adjacent
<basename>.correction.jsonmust be byte-identical at the shelf commit and at the current HEAD of the shelf repository; a correction added or changed after the indexed commit is REJECTED (STALE_CORRECTION) until the entry is re-admitted at the HEAD. If the correction exists, itscorrectsmember must name this repository, path and SHA-256. Otherwise REJECTED (CORRECTION_UNBOUND). When it setssupersedes_historical_status_for_admission, itsqualification_claimis the effective verdict. The receipt bytes are never changed. Signed bundles have no correction rule yet, so abundle.correction.jsonis REJECTED (CORRECTION_UNSUPPORTED) rather than ignored. Each kind lives on one shelf (signed-bundlein this repository,omega-qualification-receiptinaien-dev/omega-evidence); any other shelf is REJECTED (SHELF_REPOSITORY). - Signed bundles. The key must equal
.aien/verify.pubfrom the first parent of the source commit, never a key found only in the bundle. The Ed25519 signature must verify over the canonical bytes withoutsignature. The repository and commit must match the shelf path,executor.idmust be the SHA-256 of the key, every gate in.aien/alwaysmust be present and required, and the declared verdict must equal the computed one (FAIL if any required check failed; PASS if every required check ran or was cached with PASS; NOT_RUN otherwise). Any failure is REJECTED with theaien-testreason code. Otherwise the bundle verdict stands. - Omega receipts without a superseding correction. The named implementation commit
(
qualified_implementation_commit, elsegit_commit) must exist in the source repository, and every recoverable source artifact must hash to its recorded digest at that commit. Otherwise the effective verdict isREFUSED_SOURCE_PROVENANCE.build/outputs cannot be recovered and are not counted. Thereceipt_commitfield is recorded but does not decide. - Index drift. Every field except
idandreplayis recomputed,issue_or_gateincluded, andreplaymust be the exact command for theid. Any difference from the index is REJECTED (INDEX_DRIFT); an unknown field is REJECTED (UNKNOWN_FIELD). An index whose entry was edited to claim, say, "hardware qualified on GB10" fails here.
The shelf HEAD is printed on every replay but not stored, so a new publish on the shelf does not change the index unless it touches a correction.
A historical QUALIFIED / PASS is therefore never admitted on its own text.
Replaying
Needs network access to GitHub, Python 3, Git and OpenSSL 3. Each run uses a fresh temporary Git
cache unless --cache DIR is given.
python3 tools/replay_receipt.py replay spark-rsi@f72209e6 # one entry
python3 tools/replay_receipt.py replay --all # the whole index
python3 tools/replay_receipt.py replay spark-rsi@f72209e6 --bytes /tmp/copy.json # control
The last line is the result, for example REPLAY omega-evidence/M8: REFUSED_UNSUPPORTED_PROVENANCE rc=4.
| Exit | Meaning |
|---|---|
| 0 | PASS |
| 1 | FAIL: an authenticated FAIL verdict |
| 2 | NOT_RUN: an input could not be reached, or a usage error |
| 3 | REJECTED: bytes, signature, binding, correction binding, stale correction, unknown field or index drift |
| 4 | REFUSED: by a shelf correction or by the source-provenance check |
replay --all exits 0 only when every entry reproduces exactly as indexed, whatever its verdict.
Never treat a nonzero exit of a single replay as a pass.
Keep negative controls outside this checkout. --bytes replays a local copy instead of the
fetched file, so a byte-corrupted copy must end in REJECTED DIGEST_MISMATCH with exit 3.
The offline tests build disposable repositories and serve them over file://:
python3 -m unittest discover -s tests -v
Admitting a new receipt
Every later receipt goes through the same check. admit computes the entry from pinned commits
and prints it; it exits 3 instead when rule 1, 2 or 3 rejects the receipt. Admit at the shelf
HEAD: an older commit fails rule 2 whenever a correction has landed since.
python3 tools/replay_receipt.py admit --kind signed-bundle \
--shelf aien-dev/aien-receipts@<shelf-commit>:<repo>/<sha>/bundle.json --id <repo>@<short-sha>
python3 tools/replay_receipt.py admit --kind omega-qualification-receipt \
--shelf aien-dev/omega-evidence@<shelf-commit>:<receipt>.json --source-repo aien-dev/omega-mv \
--id omega-evidence/<milestone>
--issue-or-gate "<text>" is accepted only for a receipt that names no issue or gate; the text
is recorded with verified: false. For a receipt that names one, the option is a usage error
(exit 2).
Append the printed object to entries, increase index_version when the schema changes, and run
replay --all. Never write an entry by hand: a hand-typed digest, verdict or issue fails rule 5.
Values taken on trust
The tool cannot recompute these from the pinned bytes. A reader relies on them as stated:
source.repositoryof an Omega receipt. The receipts do not name their implementation repository, so it comes from the index (--source-repoat admission). The tool checks only that it is anaien-dev/<name>repository and that the named commit and artifact digests hold there. A wrong repository shows asREFUSED_SOURCE_PROVENANCE, but the index cannot prove that the receipt meant that repository.- The signed-bundle basis "this shelf has no correction records".
effective_basisof a signed bundle readsauthenticated bundle verdict (this shelf has no correction records). The tool checks the part it can see: nobundle.correction.jsonbeside the bundle at the pinned commit or at the shelf HEAD. It cannot see corrections recorded anywhere else, such as issues, ADRs oraudit/stamps. - Descriptive top-level fields (
issue,generated_by,independence,precedence,exit_codes,scope,excluded,generated_utc). They describe the index and are not recomputed;precedenceandexit_codesrestate this document. - An
issue_or_gatemarkedverified: false. Operator text. Version 2 has none.
Version 2 contents
Version 1 was generated on 2026-11-06 by Receipts167. Version 2 was regenerated by admit at
the same pinned shelf commits; only issue_or_gate changed, every digest and verdict is
identical. Replayed on the Spark on 2026-11-06: replay --all 16/16 entries reproduce, and
every issue_or_gate is derived from its receipt.
| Entry | Effective verdict | Basis |
|---|---|---|
spark-rsi@68528eca | FAIL | Signed bundle; RSI-TEST FAIL. DRA-167 source anchor (recorded here, not in the index). |
spark-rsi@f72209e6, aien-architecture@1a359434 | PASS | Signed bundles. |
omega-evidence/M4, M10, M11, M12, M13, M14, M15, M17 | PASS | Named commit resolves; source digests match. |
omega-evidence/M8, M9 | REFUSED_UNSUPPORTED_PROVENANCE | Shelf corrections recorded 2026-10-26. |
omega-evidence/M5 | REFUSED_SOURCE_PROVENANCE | git_commit does not exist in aien-dev/omega-mv. No shelf correction yet. |
omega-evidence/M6 | REFUSED_SOURCE_PROVENANCE | At the named commit, src/omega_self_host.c is absent and both AArch64 sources differ. No shelf correction yet. |
omega-evidence/M7 | REFUSED_SOURCE_PROVENANCE | At the named commit, src/omega_verify.c is absent and src/omega_validate.c differs. No shelf correction yet. |
Also recorded, not deciding:
- M12's
receipt_commitdoes not resolve, as its non-superseding correction says. - M14's
receipt_commitdoes not resolve either, and no correction says so yet. - M10, M11 and M13 carry the placeholder
pending-receipt-commit.
index.excluded lists the omega-evidence receipts in other layouts, which are not yet covered.
Limits
- Not independent. The author of the index and the author of the tool are the same agent. An
independent replay needs a different operator, or
aien-test verify-bundlefor signed bundles as indocs/verify-one-bundle.md. - Not
aien-test. The signature check uses OpenSSL Ed25519, noted25519-dalekverify_strict. The canonical encoder is a Python port ofevidence::canonical(aien-sovereign-core@c26f4d7ac3156088469b27462390f5b08ef4f436); the tests use that file's golden cases. - Omega PASS is narrow. Omega receipts carry no signature. PASS here means the pinned bytes, a resolving named commit and matching source digests. The binary and the run were not recovered, and nothing here is hardware qualification.
- Signed PASS is narrow. A valid signature authenticates the recorded statement, not the
sufficiency of the tests behind it. All three bundles in version 2 ran on the
hostbackend. - Host dependencies. Observed on the Spark: Python 3.12.3, Git 2.43.0, OpenSSL 3.0.13.
They fetch commits, compute SHA-256 and verify Ed25519. No Omega replacement exists; porting
the check to seeded Omega is an open proposal, in line with
audit/tools, which is also Python.
ADR 0033 amendment (draft)
To be added to docs/adr/0033-aien-verification-pipeline.md in aien-dev/aien-architecture
(drafted against ad8d1eb), after the 2026-10-26 amendment and before "Not decided here":
Amendment 2026-11-06 (receipt index on the receipts shelf)
Approved for the maintainer by Queen, the Completion Hive coordinator, under Drake Stapleton's delegation of merge judgment (DRA-162, 59767dce), with aien-dev/aien-receipts#12 (DRA-167). Nothing in Decisions 1 to 14 or in the earlier amendments changes, and published
<repo>/<sha>/bundle.jsonfiles keep their bytes, layout and meaning.
- A receipt index on the same shelf.
aien-dev/aien-receiptsgainsindex/receipt_index.json, the replay tooltools/replay_receipt.py, its offline teststests/test_replay.pyand the descriptiondocs/receipt-index.md. The index lists the receipts that may be cited: signed bundles from this shelf and Omega qualification receipts fromaien-dev/omega-evidence, each with the pinned shelf commit, SHA-256, the correction that applies and the effective verdict.- Written only by the tool. Entries are written only by
tools/replay_receipt.py admit. Replay recomputes every entry except its name and command, and rejects any difference, any field it does not check, and any correction that differs between the indexed commit and the shelf HEAD.- Corrections outrank historical status. A
.correction.jsonthat supersedes a receipt's historical status decides the effective verdict; a historicalQUALIFIED / PASSis never admitted on its own text. Omega receipts without a superseding correction must also match their named source commit.- Bundles unchanged. Signed bundles are checked as in Decision 6 (key from the source commit's first parent, verdict algebra of Decision 7). The index does not re-sign or move them, and a bundle correction file is refused until a rule for it is decided.
- Not a gate. The index is a citation aid. It is not an input to `aien-test verify-bundle`, the AIEN Alpha job or any merge gate, and a replay by the index's author is not an independent review.