Repository navigation
fix(receipt): the writer refuses a duplicate event_id and an unevidenced verified receipt (E0-29) - #1170
Conversation
…ced verified receipt (E0-29)
Two differences between the running writer and the Idris2 model of E0-10 are
closed, by owner rulings 1A and 2A of 2026-11-15.
* Receipt.write/3 returns {:error, :duplicate_event_id} for an event_id that
already has a receipt, and writes nothing. Before, it returned :ok. (P1: the
model's `Left DuplicateEventId`.)
* Receipt.check/1 refuses a verified receipt that has no observation or no row
digest, and write/3 calls it: {:error, :verified_without_evidence}. build/2 is
still not a smart constructor; check/1 is what refuses. (P2: the model cannot
build one, and schema/receipt.ncl refuses it.)
* A refusal is logged as receipt_refused (the row is stored, no receipt is
written), through one helper, in the three callers; any other failure stays
receipt_pending. A producer event_id that collides with an existing receipt is
now loud instead of silently getting no receipt.
The neural path's evidence has no observation, so a verified neural receipt is
now refused until its trusted source brings one; the update still reaches the
coordinator. No trusted source exists yet (trusted_verification/1 is nil).
Adds work order E0-29 and its index row. The mirror test, the header comment of
Receipt.idr and the trust boundary of the P1 and P2 ledger rows say that the two
differences are gone.
Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|



What
Receipt.write/3now refuses what the Idris2 model of E0-10 refuses. These are the twodifferences that I reported on #1164, closed by your rulings of 2026-11-15: 1A (a
duplicate receipt write is an error) and 2A (add the guard in
Receipt.write).Work order: E0-29, added here with its index row (
docs/operations/e0-closeout/).The change
Receipt.write/3returns{:error, :duplicate_event_id}for anevent_idthat alreadyhas a receipt, and writes nothing (the model's
Left DuplicateEventId). It used to return:ok.Receipt.check/1: averifiedreceipt must have at least one observation and a 64-hex rowdigest, else
{:error, :verified_without_evidence}.write/3calls it.build/2isunchanged and still not a smart constructor;
check/1is what refuses.receipt_refused event_id=... reason=...(the row is stored, noreceipt is written), through one helper,
Receipt.report_failure/2, used byOutcomeTracker,Receipt.repair/2and the neural path. Any other failure staysreceipt_pending.Receipt.idrand the trust boundary of the P1 and P2ledger rows now say that the two differences are gone.
Evidence
behaviour). After:
mix test3544 tests, 0 failures (246 excluded).check-verdicts.sh(11 / 21),proof-ledger.sh check,render --checkandclaims:pass. Only the 2 intended ledger rows changed; every other row is byte-identical.
mix format --check-formatted,check-readme-claims.sh, strict UUID gate on a clean export: pass.write/3(2);
check/1never refuses (4); observations not required (4); refusals logged as pending(2). My first attempt at the last one did nothing:
mix formathad re-wrapped the linethat my pattern matched, so it reported 0 failures. I noticed, checked that the mutation had
not applied, and reran it properly.
Stop-and-ask findings (please read)
path" wrote a
verifiedreceipt with no observation, because the neural evidence is a bareclaim. Under ruling 2A that receipt is refused. I changed the test to say so: the update
still reaches the coordinator, its receipt is refused and logged. I did not invent an
observation for it. It is not reachable in production today, because
FleetDispatcher.trusted_verification/1returnsnil, so no neural outcome is qualified.But when a trusted source exists it must bring an observation, or its receipts stay refused.
event_idequals anexisting receipt's id (flagged on fix(import): a producer's event_id is the identity of a fleet row (E0-11) #1165) is stored, and its receipt is now refused with
receipt_refused ... duplicate_event_id, instead of silently getting none. Test (d) covers it.verifiedrow is retried every cycle.Receipt.repair/2skips ids that have areceipt, but a row whose receipt the guard refuses has none, so each learning cycle tries it
again and logs
receipt_refusedagain. That is loud on purpose (the row is a data defect),but it is noise until the row is fixed. No production path makes such a row.
:ok? None:persist_outcomemints a fresh id for each row,the import skips by its seen set before it writes, and
repair/2checks first.Not done
nickelis absent (the CI step is a separate PR).build/2is not a smart constructor. Making it one would change its return type for everycaller; I did not.
Process notes
scripts/api-agents/run-work-order.sh E0-29 --dry-runexits 0 (Sonnet, medium effort, cap USD 8).This session was switched to Opus 5.5 at high effort; I did not choose that.