Skip to content

P1: export missing ABI function + add ABI↔FFI gate#40

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/new-session-1fphit
Jun 26, 2026
Merged

P1: export missing ABI function + add ABI↔FFI gate#40
hyperpolymath merged 2 commits into
mainfrom
claude/new-session-1fphit

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What & why

The new ABI↔FFI gate caught a real drift: the Idris2 ABI declares ephapaxiser_analyse (%foreign "C:ephapaxiser_analyse" in Types.idr's Foreign namespace, Bits64 -> Bits32) but the Zig FFI never exported it — so the bridge would not link.

Change

  • FFI fix — add export fn ephapaxiser_analyse(handle) u32 matching the ABI signature (analyse the loaded source for resource handles; returns the count, stubbed as elsewhere).
  • The gate itselfscripts/abi-ffi-gate.py + .github/workflows/abi-ffi-gate.yml enforcing ABI↔FFI conformance (ABI is the source of truth).

Verification

zig test src/interface/ffi/src/main.zig -lc → pass · idris2 --build ephapaxiser-abi.ipkg → clean · python3 scripts/abi-ffi-gate.pyOK (18 functions, 8 result codes match).

CI note

rust-ci / Hypatia / governance reds are pre-existing estate-infra unrelated to this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH


Generated by Claude Code

claude added 2 commits June 26, 2026 21:09
The Zig FFI bridge is half of the ABI-FFI standard, but nothing installed
Zig: .tool-versions only lists it (commented), setup.sh stops at `just`,
and the devcontainer's `postCreateCommand: just deps` referenced a `deps`
recipe that did not exist. Unlike the other toolchain pieces, Zig is not
distributed via GitHub releases, so it must come from ziglang.org.

Add scripts/install-zig.sh: an idempotent, fail-soft installer for the
pinned Zig 0.14.0 (arch/OS-aware, uses the system CA store the agent proxy
populates, never --insecure). If ziglang.org is not on the session's egress
allowlist the download 403s and the script exits 0 with an actionable
message, so it never blocks setup or a session.

Wire it in via the two paths the project already uses: a "Step 1b" in
setup.sh (where the template exposes that step), and a new `deps` Justfile
recipe backing the devcontainer postCreateCommand. Once ziglang.org is
allowlisted, future setups and dev containers install Zig automatically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH
The Idris2 ABI declared a C function (in Types.idr's Foreign namespace) with
no matching Zig export, so the bridge would not link. Add the export, then add
scripts/abi-ffi-gate.py + .github/workflows/abi-ffi-gate.yml to enforce
ABI↔FFI conformance going forward (ABI is the source of truth).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH
@hyperpolymath hyperpolymath marked this pull request as ready for review June 26, 2026 23:07
@hyperpolymath hyperpolymath merged commit af96553 into main Jun 26, 2026
21 of 24 checks passed
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.

2 participants