From 5f3d0613f2250133f627822ba14e24110bece231 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 18:12:28 +0000 Subject: [PATCH 1/2] fix(abi): correct the Cap'n Proto schema id mirror and gate it against the schema EchidnaABI.CapnSchemas.echidnaSchemaId held 15242516543891767314 (0xd3884c09d1af0012). schemas/echidna.capnp declares 0xd3b45f8ae1c79012, which is 15254922887908790290. The non-zero proof passed because it only rules out 0. The constant is now the same hex literal the schema file declares. The idris2-abi-ci workflow gets a step that compares the two textually on every event and fails if they differ. A change to schemas/echidna.capnp now also triggers the workflow's full run. Reported by review on #472 after merge. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3 --- .github/workflows/idris2-abi-ci.yml | 19 ++++++++++++++++++- src/abi/EchidnaABI/CapnSchemas.idr | 6 ++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/idris2-abi-ci.yml b/.github/workflows/idris2-abi-ci.yml index a2ef75e5..114e1164 100644 --- a/.github/workflows/idris2-abi-ci.yml +++ b/.github/workflows/idris2-abi-ci.yml @@ -13,6 +13,7 @@ on: - 'src/idris/**' - 'tests/abi/**' - 'scripts/abi-fixtures.sh' + - 'schemas/echidna.capnp' - '.github/workflows/idris2-abi-ci.yml' # No paths-filter on pull_request: this job is a REQUIRED status check, so it # must report on every PR (a path-filtered required check deadlocks PRs that @@ -46,7 +47,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | set -euo pipefail - PATTERN='^(src/abi/|src/idris/|tests/abi/|scripts/abi-fixtures\.sh$)' + PATTERN='^(src/abi/|src/idris/|tests/abi/|scripts/abi-fixtures\.sh$|schemas/echidna\.capnp$)' if [ "${{ github.event_name }}" = "pull_request" ]; then FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \ --paginate --jq '.[].filename') @@ -134,6 +135,22 @@ jobs: exit 1 fi + - name: Cap'n Proto schema id matches its Idris mirror + run: | + # EchidnaABI.CapnSchemas.echidnaSchemaId mirrors the file id of + # schemas/echidna.capnp. Its non-zero proof cannot catch a wrong value, + # so compare the two hex literals directly. Runs on every event: it is + # cheap, and a schema-only change must not skip it. + set -euo pipefail + schema=$(grep -oE '^@0x[0-9a-fA-F]+;' schemas/echidna.capnp | head -n1 | tr -d '@;' | tr 'A-F' 'a-f') + mirror=$(grep -oE '^echidnaSchemaId = 0x[0-9a-fA-F]+' src/abi/EchidnaABI/CapnSchemas.idr | awk '{print $3}' | tr 'A-F' 'a-f') + echo "schemas/echidna.capnp: ${schema:-}" + echo "CapnSchemas.idr: ${mirror:-}" + if [ -z "$schema" ] || [ -z "$mirror" ] || [ "$schema" != "$mirror" ]; then + echo "::error file=src/abi/EchidnaABI/CapnSchemas.idr::echidnaSchemaId does not match the id in schemas/echidna.capnp" + exit 1 + fi + - name: Count modules and report if: steps.detect.outputs.relevant == 'true' run: | diff --git a/src/abi/EchidnaABI/CapnSchemas.idr b/src/abi/EchidnaABI/CapnSchemas.idr index 6b992f21..4a997e28 100644 --- a/src/abi/EchidnaABI/CapnSchemas.idr +++ b/src/abi/EchidnaABI/CapnSchemas.idr @@ -31,10 +31,12 @@ import Data.Fin ------------------------------------------------------------------------ ||| The Cap'n Proto schema unique identifier for echidna.capnp. -||| Hex: 0xd3b45f8ae1c79012 = 15,242,516,543,891,767,314 (decimal). +||| Written as the hex literal that `schemas/echidna.capnp` declares (`@0xd3b45f8ae1c79012`, +||| decimal 15254922887908790290), so the two can be compared textually. +||| `idris2-abi-ci.yml` fails if they differ. public export echidnaSchemaId : Nat -echidnaSchemaId = 15242516543891767314 +echidnaSchemaId = 0xd3b45f8ae1c79012 ||| Proof: the schema identifier is non-zero. ||| Cap'n Proto uses 0 as the "no schema" sentinel; a zero schema ID From e4ff3cd83e3b3d0ac2e4080d6b373d8afe28d1a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 00:41:01 +0000 Subject: [PATCH 2/2] fix(abi-ci): report a missing schema id; give R2 a current ABI receipt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The schema-id step runs under `set -euo pipefail`. When either grep matched nothing, the pipeline failed and the step exited before it printed the ::error line, so the failure carried no message. Both greps are now wrapped in `{ … || true; }`, so an empty result reaches the -z check and the error is printed. Checked both ways: the real tree passes, and a schema with no `@0x…;` line prints the error and exits 1. PROOF-STATUS R2 cited only the 2026-11-09 receipts on a2a8643, whose src/abi/ tree matched 2ab7574. #511, #512 and this PR have changed src/abi/ since then. R2 now says so and cites this PR's own Type-check Idris2 ABI definitions run. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3 --- .github/workflows/idris2-abi-ci.yml | 4 ++-- docs/PROOF-STATUS.adoc | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/idris2-abi-ci.yml b/.github/workflows/idris2-abi-ci.yml index 114e1164..f4a55765 100644 --- a/.github/workflows/idris2-abi-ci.yml +++ b/.github/workflows/idris2-abi-ci.yml @@ -142,8 +142,8 @@ jobs: # so compare the two hex literals directly. Runs on every event: it is # cheap, and a schema-only change must not skip it. set -euo pipefail - schema=$(grep -oE '^@0x[0-9a-fA-F]+;' schemas/echidna.capnp | head -n1 | tr -d '@;' | tr 'A-F' 'a-f') - mirror=$(grep -oE '^echidnaSchemaId = 0x[0-9a-fA-F]+' src/abi/EchidnaABI/CapnSchemas.idr | awk '{print $3}' | tr 'A-F' 'a-f') + schema=$({ grep -oE '^@0x[0-9a-fA-F]+;' schemas/echidna.capnp || true; } | head -n1 | tr -d '@;' | tr 'A-F' 'a-f') + mirror=$({ grep -oE '^echidnaSchemaId = 0x[0-9a-fA-F]+' src/abi/EchidnaABI/CapnSchemas.idr || true; } | awk '{print $3}' | tr 'A-F' 'a-f') echo "schemas/echidna.capnp: ${schema:-}" echo "CapnSchemas.idr: ${mirror:-}" if [ -z "$schema" ] || [ -z "$mirror" ] || [ "$schema" != "$mirror" ]; then diff --git a/docs/PROOF-STATUS.adoc b/docs/PROOF-STATUS.adoc index 65ced1b3..028e1883 100644 --- a/docs/PROOF-STATUS.adoc +++ b/docs/PROOF-STATUS.adoc @@ -229,6 +229,14 @@ https://github.com/hyperpolymath/echidna/actions/runs/42624461538/job/1291845356 builds `+verification/proofs/idris2/echidna-verif-proofs.ipkg+` and https://github.com/hyperpolymath/echidna/actions/runs/42624461712/job/129184533713[Type-check Idris2 ABI definitions] builds `+src/abi/echidnaabi.ipkg+`, both on Idris 2 0.8.0, both success. +Those receipts cover the trees at `+2ab7574+` only. `+src/abi/+` has changed since: +hyperpolymath/echidna#511 deleted the seven shadow copies, +hyperpolymath/echidna#512 moved `+Coprocessor.Foreign+` into the package, and +hyperpolymath/echidna#508 changed `+EchidnaABI.CapnSchemas+`. The ABI package as +it stands after #508 checks in +https://github.com/hyperpolymath/echidna/actions/runs/43986065115/job/133714398981[Type-check Idris2 ABI definitions], +success, a pull-request run on head `+7edf44f+`, whose `+src/abi/+` tree is the +one #508 merges. At that receipt `+NatLte.idr+` lacked `+%default total+`, so its totality was not checked. It now declares the directive, and the `+verif-idris+` job fails if any module in `+verification/proofs/idris2/+` does not. A fresh receipt is