From fff3e95630dbb2b937a6c69e1e301ce8a7df7907 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:05:04 +0000 Subject: [PATCH 1/3] ci(abi): type-check the Idris2 ABI in CI, with totality enforced No workflow ran the Idris2 checker. The ABI-FFI gate compares the ABI and the Zig FFI structurally, in Julia, and runs the Zig tests, so the proofs under src/interface/abi were only checked when someone ran idris2 by hand. PROOF-POLICY expects checker evidence for a verified claim. This adds an idris2-check job to abi-ffi-gate.yml: - builds Idris2 0.8.0 from the commit the upstream v0.8.0 tag names (the same pin ubicity's CI uses); - fails if any .idr file under src/interface/abi is missing from the .ipkg, so a module cannot drop out of the check unnoticed; - runs idris2 --total --typecheck on the package. The job uses only actions/checkout@v7.0.1, which this workflow already uses, so actions.lock does not change. The package listed only Types, Layout, Foreign and Proofs. Semantics, Invariants, FfiSeam and Capstone were never type-checked by a package build; they now are. All eight pass `idris2 --total --typecheck` locally with Idris2 0.8.0 built from the pinned commit. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0132Cdz3iwk2QGKv2sUhhsye --- .github/workflows/abi-ffi-gate.yml | 41 +++++++++++++++++++++++++++ src/interface/abi/mylangiser-abi.ipkg | 4 +++ 2 files changed, 45 insertions(+) diff --git a/.github/workflows/abi-ffi-gate.yml b/.github/workflows/abi-ffi-gate.yml index f8bd0d4..8c1a7db 100644 --- a/.github/workflows/abi-ffi-gate.yml +++ b/.github/workflows/abi-ffi-gate.yml @@ -44,3 +44,44 @@ jobs: echo "/tmp/zig-linux-x86_64-0.14.0" >> "$GITHUB_PATH" - name: zig test FFI run: zig test src/interface/ffi/src/main.zig -lc + + idris2-check: + name: Idris2 ABI type-check (Idris2 0.8.0, total) + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v7.0.1 + - name: Install Idris2 0.8.0 from the pinned upstream commit + env: + # Exact commit referenced by the upstream v0.8.0 tag. + IDRIS2_REVISION: 15a3e4e70843f7a34100f6470c04b791330788df + run: | + set -euo pipefail + sudo apt-get update -qq + sudo apt-get install -y chezscheme make libgmp-dev + git clone --filter=blob:none --no-checkout \ + https://github.com/idris-lang/Idris2.git /tmp/idris2 + git -C /tmp/idris2 checkout --detach "$IDRIS2_REVISION" + make -C /tmp/idris2 bootstrap SCHEME=scheme + make -C /tmp/idris2 install PREFIX="$HOME/.idris2" + echo "$HOME/.idris2/bin" >> "$GITHUB_PATH" + - name: Every ABI module is listed in the package + working-directory: src/interface/abi + run: | + set -euo pipefail + # A module missing from the .ipkg is never type-checked here. + files=$(find . -name '*.idr' -not -path './build/*' \ + | sed 's|^\./||; s|\.idr$||; s|/|.|g' | sort) + listed=$(sed -n '/^modules/,/^[a-z]/p' mylangiser-abi.ipkg \ + | grep -oE '[A-Z][A-Za-z0-9_.]+' | sort -u) + missing=$(comm -23 <(echo "$files") <(echo "$listed")) + if [ -n "$missing" ]; then + echo "::error::Idris2 modules not listed in mylangiser-abi.ipkg: $missing" + exit 1 + fi + - name: Type-check with totality enforced + working-directory: src/interface/abi + run: | + set -euo pipefail + idris2 --version + idris2 --total --typecheck mylangiser-abi.ipkg diff --git a/src/interface/abi/mylangiser-abi.ipkg b/src/interface/abi/mylangiser-abi.ipkg index 7bbc742..95011a1 100644 --- a/src/interface/abi/mylangiser-abi.ipkg +++ b/src/interface/abi/mylangiser-abi.ipkg @@ -7,3 +7,7 @@ modules = Mylangiser.ABI.Types , Mylangiser.ABI.Layout , Mylangiser.ABI.Foreign , Mylangiser.ABI.Proofs + , Mylangiser.ABI.Semantics + , Mylangiser.ABI.Invariants + , Mylangiser.ABI.FfiSeam + , Mylangiser.ABI.Capstone From 0511dcf3567ce1eaf8f69db6a27fda6772f58ff9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:16:05 +0000 Subject: [PATCH 2/3] fix(ci): set totality in the .ipkg so the Idris2 check actually runs Idris2 0.8.0 does not accept --total as a command-line override for a package command: `idris2 --total --typecheck X.ipkg` prints an options error, checks no module and exits 0, so the job passed without checking anything. Totality now comes from `opts = "--total"` in the package, the job fails if that line is missing, and it runs `idris2 --typecheck`. The module-list guard also drops `--` comments first, so a module named only in a comment no longer counts as listed. Checked locally with the pinned compiler: all 8 modules build total, a planted non-terminating function fails the check, and a module commented out of the list is reported by the guard. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0132Cdz3iwk2QGKv2sUhhsye --- .github/workflows/abi-ffi-gate.yml | 8 +++++++- src/interface/abi/mylangiser-abi.ipkg | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/abi-ffi-gate.yml b/.github/workflows/abi-ffi-gate.yml index 8c1a7db..dcc8f32 100644 --- a/.github/workflows/abi-ffi-gate.yml +++ b/.github/workflows/abi-ffi-gate.yml @@ -72,7 +72,9 @@ jobs: # A module missing from the .ipkg is never type-checked here. files=$(find . -name '*.idr' -not -path './build/*' \ | sed 's|^\./||; s|\.idr$||; s|/|.|g' | sort) + # Comments are dropped first: a module named only after -- is not built. listed=$(sed -n '/^modules/,/^[a-z]/p' mylangiser-abi.ipkg \ + | sed 's/--.*$//' \ | grep -oE '[A-Z][A-Za-z0-9_.]+' | sort -u) missing=$(comm -23 <(echo "$files") <(echo "$listed")) if [ -n "$missing" ]; then @@ -84,4 +86,8 @@ jobs: run: | set -euo pipefail idris2 --version - idris2 --total --typecheck mylangiser-abi.ipkg + # Totality comes from opts in the .ipkg. Given --total here, Idris2 + # 0.8.0 prints an options error, checks nothing and exits 0. + grep -Eq '^opts[[:space:]]*=[[:space:]]*".*--total' mylangiser-abi.ipkg \ + || { echo "::error::mylangiser-abi.ipkg must set opts = \"--total\""; exit 1; } + idris2 --typecheck mylangiser-abi.ipkg diff --git a/src/interface/abi/mylangiser-abi.ipkg b/src/interface/abi/mylangiser-abi.ipkg index 95011a1..05367b3 100644 --- a/src/interface/abi/mylangiser-abi.ipkg +++ b/src/interface/abi/mylangiser-abi.ipkg @@ -11,3 +11,7 @@ modules = Mylangiser.ABI.Types , Mylangiser.ABI.Invariants , Mylangiser.ABI.FfiSeam , Mylangiser.ABI.Capstone + +-- Totality is set here: Idris2 0.8.0 refuses --total as a command-line +-- override for package commands and then checks nothing. +opts = "--total" From cfc8cc0a1abd10f84d29bd313f4af84fb5d60f77 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:19:23 +0000 Subject: [PATCH 3/3] ci: refuse holes and escape hatches before the Idris2 type-check Idris2 0.8.0 accepts `x = ?todo`, `believe_me`, `assert_total` and the like even with totality on, so a green type-check alone does not show that the ABI proofs are complete. This step fails on any of them (outside comments) before the type-check runs. It passes on the current sources and fails on a planted hole and a planted believe_me. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0132Cdz3iwk2QGKv2sUhhsye --- .github/workflows/abi-ffi-gate.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/abi-ffi-gate.yml b/.github/workflows/abi-ffi-gate.yml index dcc8f32..64be656 100644 --- a/.github/workflows/abi-ffi-gate.yml +++ b/.github/workflows/abi-ffi-gate.yml @@ -81,6 +81,22 @@ jobs: echo "::error::Idris2 modules not listed in mylangiser-abi.ipkg: $missing" exit 1 fi + - name: No holes or escape hatches in the ABI proofs + working-directory: src/interface/abi + run: | + set -euo pipefail + # Idris2 accepts a ?hole and these escape hatches even under + # --total, so a green type-check alone would not show the proofs + # are complete. + pattern='(^|[^A-Za-z0-9_])\?[a-z_][A-Za-z0-9_]*|believe_me|assert_total|assert_smaller|idris_crash|%default[[:space:]]+(partial|covering)|^[[:space:]]*(partial|covering)[[:space:]]' + hits=$(find . -name '*.idr' -not -path './build/*' -print0 \ + | xargs -0 grep -nE "$pattern" \ + | grep -vE '^[^:]+:[0-9]+:[[:space:]]*(--|\|\|\|)' || true) + if [ -n "$hits" ]; then + echo "::error::Holes or escape hatches in the ABI proofs:" + echo "$hits" + exit 1 + fi - name: Type-check with totality enforced working-directory: src/interface/abi run: |