mesh: a cut journal is caught by the receipts the steward handed out, and the receipt chain survives a restart #306

Merged
dcharlot merged 1 commit from feat/mesh-journal-witness into main 2026-10-18 00:42:33 -04:00

2026-10-17

Transaction Science
mesh: a cut journal is caught by the receipts the steward handed out, and the receipt chain survives a restart
All checks were successful
wai-quantum tensor-engine member / does this change touch it (pull_request) Successful in 4s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been skipped
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been skipped
wai-quantum portable tensor program / does this change touch it (pull_request) Successful in 4s
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · GPUs (jetson-hub) (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Has been skipped
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been skipped
wai-quantum CPU vector units / does this change touch it (pull_request) Successful in 4s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Has been skipped
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been skipped
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 4s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been skipped
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been skipped
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been skipped
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been skipped
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Has been skipped
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been skipped
WAI mbt2018_mean integer decode (regenerated vectors) / does this change touch it (pull_request) Successful in 4s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Has been skipped
wai-web wasm32 / does this change touch it (pull_request) Successful in 4s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Has been skipped
standards workspaces build + test / mesh-rs (mesh/mesh-rs, -p mesh-engine-gguf -p mesh-openai --features mesh-engine-gguf/gguf,mesh-openai/server, mesh-rs, linux-arm64) (pull_request) Successful in 1m1s
standards workspaces build + test / joulehook-rs (joulehook/joulehook-rs, joulehook-rs, linux) (pull_request) Successful in 1m14s
After #301 the journal re-established spend on restart, but nothing could
tell whether records had been cut from its end. Removing a serve's
records restored the grant's spend and unspent its presentation, so the
captured presentation could be replayed. Separately, a restarted steward
began a new receipt chain at sequence 0.

- The journal is one chain of records `{seq, prev, entry}`, `prev` being
  the BLAKE3 hash of the previous record's encoding. A record removed from
  the middle, edited or moved fails the replay. Only a cut from the end
  leaves a whole chain.
- Every receipt, granted or not, gets a `Sealed` record (its sequence and
  envelope id), written before the receipt is handed out.
  `ReceiptLog::seal_next` / `advance` split sealing from advancing, so a
  receipt that cannot be recorded is not handed out and the chain does not
  pass it.
- On restart the receipt chain continues from the last `Sealed` record
  (`ReceiptLog::resume`) instead of starting over at 0.
- `Mesh::witness(receipt, envelope)`: anyone holding a receipt the
  steward sealed can show it. If the journal does not hold that receipt,
  records were cut after it left, so the steward returns `JournalCut` and
  refuses every grant from then on. A witness that is not the steward's
  own unaltered receipt is `WitnessInvalid`.
- SPEC §2.2, §6.3, §7 and §8 describe it. That includes what remains:
  a cut that removes only an in-flight serve, which produced no receipt,
  leaves no evidence outside the steward.

Checked on the build host:
- mesh-rs: 77 tests pass, four of them new. They cover a receipt proving
  a cut, chain continuity across a restart, a record removed from the
  middle or edited, and a foreign or altered witness. The existing journal
  tests now count seal records.
- Every `mesh/1` vector is byte-identical, every Cargo.lock is current,
  and clippy is clean.
- Mutations each fail tests: a witness that always passes, a detected cut
  that is ignored, seals not recorded, no chain check, and a chain not
  resumed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 17:13:58 -04:00