Skip to content

docs(design): the E0 receipt, design and ruling packet (E0-08) - #1149

Merged
hyperpolymath merged 2 commits into
mainfrom
docs/e0-08-receipt-design
Nov 14, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
docs/e0-08-receipt-design

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Work order E0-08. docs/design/e0-receipt.adoc (status PROPOSED) defines the E0 receipt: its 13 fields in one table, the identity of an event, the 3 entry points, the start record, the storage, the failure rule and the revision rule, plus the 5 properties for the Idris2 model of E0-10. This pull request changes no code, schema or test.

Why

Issue 984, step 10 ("Receipt") and acceptance A7 (#984). The issue's limit: "Do not create a grand new data model before fixing the actual false-learning path", so the receipt is an index into the logs that exist.

Ruling packet: 8 decisions for the owner

Each has a recommended option, labelled as the most correct in the long term. The document gives the consequence of each option and the reason for each rejection (section 7).

# Decision Options Recommended
D1 The unit of a receipt A. one for each learning update (the credit of one qualified event); B. one for each event chain; C. one for each recomputation of a recipe A. B forces a rewrite of an unfinished chain; C names a count, not rows.
D2 Where a receipt is written A. at each of the 3 entry points; B. in persist_outcome/6 (local and imported rows) and at the neural call; C. a repair sweep only B. A can double a receipt, because import and the confidence update both reach persist_outcome/6. E0-09's text then reads "2 places", not "3".
D3 The identity of an event A. ADR-008 v8 profile T, minted by the producer before the fix runs (uuid-v8 t), by Hypatia for a local row; B. profile C from the row content; C. keep the (file, line) identity A. B makes identical attempts collide (issue 984, step 6); C lets a different row take the same identity after rotation.
D4 The start record A. a separate file fix-attempts.jsonl, never imported as outcomes; B. a "kind":"start" line in fix-outcomes.jsonl; C. none A. B means one reader that forgets to skip it stores a start as an outcome.
D5 Storage and canonical form A. flat files receipts/YYYY-MM.jsonl in the profile of the proof ledger (sorted keys, ASCII, no JSON numbers) with receipt_sha256 over all other fields; B. in the outcome log; C. VeriSimDB A. C is not deployed and is not needed.
D6 The failure rule A. row, then receipt, then derived updates; repair writes a missing receipt by event_id and reports a receipt with no row as corrupt; no back-fill; B. receipt first; C. one transaction; D. derived update first A. B can leave a receipt for evidence that does not exist; C is not available on flat files.
D7 Revision and withdrawal A. a revision is a new receipt linked by parent_event_ids; a fill never overwrites a present field; a withdrawal has verdict withdrawn; B. edit in place; C. only the withdrawal store of E0-07 A. B loses history; C leaves the receipt silent.
D8 head_sha and subject_id before a stable finding identity exists A. leave them in missing_evidence; B. fill head_sha from git rev-parse in the local rescan only; C. fill subject_id with no registered domain A. B makes local and fleet evidence differ in kind; C breaches ADR-008.

Questions inside the packet that only the owner can answer:

  1. D3: does the gitbot-fleet runner have uuid-v8 (the Rust command from tools/uuid-v8 in metadatastician/standards) or Bun for scripts/uuid-v8.js? If neither, E0-12 stops. This is not a gap in ADR-008: the format and the profile are given.
  2. D8: do you want a profile C domain registered for subject_id? That is an edit of docs/decisions/ADR-008-profile-c-domains.json in metadatastician/standards, which this repository cannot do.
  3. D6: the repair scan reads the log for rows with no receipt, bounded by the recipes that a learning cycle recomputes. No cost was measured.

Evidence

  • Head commit: ea42e423c419379546dbb511edfd7b9fdbeefdf5
  • Facts re-measured at main (c3e0f283): grep -rn 'chain_version\|parent_event_ids\|subject_id\|missing_evidence' lib schema src finds nothing; head_sha occurs only in lib/merge_orchestration/ and 3 rule modules (baseline_health, pr_automerge, research_extensions); the identity comments are at LearningScheduler.local_source_id/2 and fleet_source_id/2; the conventions schema/findings.ncl, Verdict.idr, Retraction.idr, ci_changed.ex and verification/proof-ledger.jsonl exist and are read in the document. ADR-008 and tools/uuid-v8/README.adoc were read from metadatastician/standards (fca1289e) and issue 984 from GitHub.
  • asciidoctor -o /tmp/e0-receipt.html --failure-level=INFO docs/design/e0-receipt.adoc: exit 0, no output (no warning, no info).
  • The 13 fields (head_sha, subject_id, event_id, parent_event_ids, source, provenance, assertion, observations, proof_or_test_ref, qualification, verdict, missing_evidence, chain_version) are rows of one table (section 3). The 2 fields added by the owner ruling of 2026-11-14 (pattern_id, match_kind) are in a second, short table.
  • The document names the 3 entry points (section 5.1), the start record (5.2) and the failure rule (5.3).
  • git diff --stat origin/main: 1 file, docs/design/e0-receipt.adoc; nothing under lib/, schema/, src/ or test/.
  • bash scripts/check-readme-claims.sh: exit 0.
  • CI: not run yet.

Not done

  • Nothing is ruled. The document is PROPOSED. E0-09, E0-10, E0-11 and E0-12 wait for your rulings.
  • Not run: no prover was run (the theory inputs are read from the second recon and the Agda is not re-checked; a use in Hypatia is a transcription that is assumed, not proved). The Nickel contract, the emitter and the Idris2 model are the work of E0-09 and E0-10.
  • Seen, not changed: FleetDispatcher.ingest_fix_outcome/1 writes to a fixed path under ~/Documents/hyperpolymath-repos/gitbot-fleet/, and its row has no recipe_id and no verification. E0-05 covers the qualification; neither it nor this document changes the path.
  • Stop conditions of the work order: none was met. ADR-008 gives the format (profile T, no domain registration), and flat files are enough.
  • Dependencies between my own PRs: D7 depends on E0-07, which I stopped (it needs a stable id for local rows; D3 answers this for new rows). E0-04's open question (does the rescan compare the file) is not in this document.
  • Model. The work order names e0-supervisor with Opus at high effort. I could not switch models inside the session that I ran in, so it was written in that session and not at the model that the work order names. Please read the decisions with that in mind.
  • estate-gates checklist read in part only.
  • Seen, not changed: mix deps.get needed HEX_CACERTS_PATH=/etc/ssl/certs/ca-certificates.crt in this container.

Cost

  • Work order E0-08, cap $10. Cost unknown: the launch script was not run for real, so there is no ledger line and the agent cannot see its own spend. Check the Console.

PROPOSED design of the E0 receipt: the 13 fields of issue 984 step 10 in one
table, the identity of an event under ADR-008 (profile T), the 3 entry
points, the start record, the storage and canonical form, the failure rule,
the revision rule, and the 5 properties for the Idris2 model. The 8
decisions for the owner are in the pull request body. No code changes.

Co-Authored-By: Claude <[email protected]>
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 14, 2026 23:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T23:39:47.410064Z b7c4432 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-14T23:37:06.687521Z b7c4432 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqubecloud

Copy link
Copy Markdown

Repository owner deleted a comment from coderabbitai Bot Nov 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7c443203d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +77
Two rules apply to every row. First, a receipt has no JSON numbers: a count or a
hit number is a decimal string. That keeps the profile of the proof ledger, in
which `jq -cS` is canonical. Second, a field that E0 cannot fill is not omitted
and is not guessed: its name goes into `missing_evidence`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define how unavailable fields are represented

For every fleet receipt, head_sha is explicitly unavailable, but these lines require the field to be neither omitted nor guessed while its declared type only permits a 40-character hash. Adding its name to missing_evidence does not provide a valid value, and P5 later assumes missing fields are actually absent, so E0-09 cannot build a schema or receipt satisfying all of these rules. Permit omission or a defined null/option representation when the field is listed in missing_evidence.

Useful? React with 👍 / 👎.

Comment on lines +119 to +121
|`assertion`
|object `{claimed_outcome, file, recipe_id, repo}`
|The row. `claimed_outcome` is what the producer said (`success` or `failure`). The legacy fleet outcome `success` means only that the fixer exited zero.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include false positives in claimed outcomes

When a qualified row has outcome: "false_positive", OutcomeTracker.qualified_outcome_counts/1 credits it and the receipt vocabulary even provides credited_false_positive, but this assertion definition permits only success or failure. Such a learning update therefore cannot be represented without lying or violating the eventual schema; add false_positive to claimed_outcome.

Useful? React with 👍 / 👎.

Comment on lines +268 to +270
* *Repair.* At the start of a learning cycle, for each recipe that the cycle
recomputes, every qualified row that has an `event_id` and no receipt gets one
(a lookup by `event_id`, so it cannot write twice). A receipt whose `event_id`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make receipt deduplication atomic

When two writers or a writer and repair pass handle the same event concurrently, both can observe that no receipt exists and then append it, because the described lookup and File.write(..., [:append]) are separate operations. Append mode only protects an individual write; it does not make the check-and-append atomic, so the design's exactly-one receipt guarantee and P1 can be violated. Specify locking, a single writer, or another atomic uniqueness mechanism.

Useful? React with 👍 / 👎.

Comment on lines +328 to +329
|B. In `persist_outcome/6` (covers the local rows and the imported rows) and at the neural call. The caller passes the context that only it has.
|2 call sites. One row, one receipt. `E0-09` says "one place for each of the 3 learning paths", so its text changes to 2 places.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Emit only one receipt across the neural and import paths

FleetDispatcher.ingest_fix_outcome/1 both sends the qualified event to the neural coordinator and appends its outcome to fix-outcomes.jsonl, which LearningScheduler later imports through persist_outcome/6. Emitting at both call sites therefore handles the same event twice: with the shared producer event_id, the second receipt either violates P1 or is refused after the outcome row has already committed. Define one call site as the owner of the event receipt, or explicitly coordinate the two learner updates under one receipt.

Useful? React with 👍 / 👎.

Comment on lines +261 to +264
* If (2) fails, the event is committed and the derived updates do not run. The
caller gets an error. For the import it is `{:error, {:receipt_failed, line, reason}}`,
and the source signature does not advance, as for `write_failed`. The next run
finds a qualified row with no receipt (see below) and writes it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve import context needed to repair a receipt

If a fleet receipt write fails after the destination outcome row is committed, the next run only has that stored row, while the design says the source line, source-row digest, and producer are context available only during import. E0-11 stores event_id, but the existing destination record does not retain those other required values, so the repair pass cannot reconstruct the promised source, provenance, and row_sha256 fields. Persist the repair inputs with the event row or define a durable lookup of the original source before claiming the next run can write an equivalent receipt.

Useful? React with 👍 / 👎.

Comment on lines +95 to +98
|`event_id`
|string, ADR-008 v8, *profile T*
|Minted by the producer before the fix runs (`E0-12`). For a local row, minted by Hypatia when it writes the row (<<d3>>).
|Yes for a row that has one. A legacy row has none.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mint local event IDs before the fix starts

For local attempts this says Hypatia mints the ID when it writes the outcome row, but the identity rule later requires the producer to mint it before the fix runs. Outcome writing happens after the attempt, so an interrupted local attempt has no durable ID and the local path does not meet the provenance-before-execution guarantee that motivates the start record. Introduce the ID at local attempt creation and carry it into the outcome row instead of generating it during persistence.

Useful? React with 👍 / 👎.

Comment on lines +137 to +145
|`qualification`
|string, one of `verified`, `failed`, `incomplete`, `still_present`, `rollback_requested`, `unqualified`
|The `verification` value of the row, as `OutcomeTracker.qualified_outcome_counts/1` reads it.
|Yes.
|(never missing)

|`verdict`
|string, one of `credited_success`, `credited_failure`, `credited_false_positive`, `audit_only`, `withdrawn`
|What the single gate did with the event. The receipt records the gate's answer and does not compute its own (see property P2).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain the evidence required for rollback qualification

qualified_outcome_counts/1 accepts rollback_requested only for a false_positive row whose caused_by is batch_rollback and whose batch_id is nonempty, but neither of those values appears in the receipt fields. Consequently a receipt cannot demonstrate why that event qualified, and P2's verdict function over only qualification and claimed_outcome would treat an otherwise unqualified rollback row identically. Include these gate inputs in the assertion or observations so the receipt can reproduce the actual qualification decision.

Useful? React with 👍 / 👎.

Comment on lines +107 to +110
|`source`
|object `{kind, log, line}`. `kind` is one of `fleet_import`, `local_rescan`, `local_caller`, `neural_path`. `log` is a path relative to the data root. `line` is a decimal string.
|The reader that credited the event.
|Yes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Define the root used by fleet source paths

For a fleet import, the evidence log is under the separately configured Paths.fleet() tree, not under the verisim-data root where receipts and outcomes live. Requiring source.log to be relative to an unspecified singular data root therefore cannot identify the fleet source without an absolute path or .. traversal, despite this field being mandatory. Add a root discriminator or define log relative to the root selected by source.kind.

Useful? React with 👍 / 👎.

Comment on lines +281 to +284
* One receipt on each line. Canonical form: keys sorted, no insignificant
whitespace, one final LF, ASCII only, no JSON numbers. This is the profile of
`scripts/proof-ledger.sh`, in which `jq -cS` output is JCS. An encoder that
meets it is a sort of the keys and a refusal of any non-ASCII byte or number.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Support non-ASCII evidence identifiers

A qualified outcome can legitimately contain a non-ASCII repository, file path, or producer name, but the mandated encoder refuses every non-ASCII byte. In that case the outcome row commits, every receipt attempt fails, and the failure rule prevents derived learning indefinitely; the repair pass cannot change the input. Use a canonical encoder that supports Unicode rather than restricting receipt data to ASCII.

Useful? React with 👍 / 👎.

Comment on lines +469 to +470
|P1 |*No two receipts share an `event_id`.* Appending to a ledger that already holds an `event_id` is refused.
|P2 |*A receipt cannot claim more than its evidence.* A receipt with `qualification` `verified` cannot be built unless `proof_or_test_ref` and `observations` are present, and its `verdict` is a function of `qualification` and `claimed_outcome`, as `qualified_outcome_counts/1` computes it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define a verdict rule for withdrawal receipts

D7 requires a revision receipt with verdict: "withdrawn", but P2 requires every verdict to be a function of qualification and claimed_outcome exactly as qualified_outcome_counts/1 computes it. That gate has no withdrawal input or result, so no withdrawal receipt can satisfy the stated property and E0-10 cannot prove it. Model withdrawal as an explicit receipt variant or define a separate verdict transition for it.

Useful? React with 👍 / 👎.

@hyperpolymath
hyperpolymath merged commit 0eae4aa into main Nov 14, 2026
87 checks passed
@hyperpolymath
hyperpolymath deleted the docs/e0-08-receipt-design branch November 14, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants