Commit 86319db
verisimiser: make ABI/FFI/codegen provably-real + honest docs (#167)
## What this does
Turns VeriSimiser's non-Rust claims from prose into machine-checked
facts, and adds a CI gate (`provable.yml`) so they stay checked. This is
the verisimiser slice of the "-iser family → provably-real + honest"
effort (after chapeliser and typedqliser).
Everything below was **verified locally** with a full toolchain (idris2
0.7.0, zig 0.14.0, cargo), not just asserted.
### Idris2 ABI — full, hole-free proofs
`src/interface/abi/Verisimiser/ABI/{Types,Layout,Foreign}.idr` all
`idris2 --check` clean (no holes, no warnings).
- **Layout.idr** completed: each of the four C-struct layouts
(`OctadRecord`, `ProvenanceEntry`, `DriftMeasurement`,
`TemporalSnapshot`) carries machine-checked size/alignment
(`CABICompliant`) and per-field-offset (`FieldsAligned`) witnesses.
`alignUp` is redefined as `ceilDiv size align * align` so
`alignUpCorrect` becomes unconditional.
- Removed generic helpers that **cannot** be proven honestly —
`checkCABI`, `offsetInBounds` (false for an arbitrary field),
`verifyLayout`, `calcStructSize`, `PlatformLayout`/`verifyAllPlatforms`
— each with a NOTE explaining why. The concrete, checkable `*Valid`
instances remain.
### Zig FFI — builds + tests green
`cd src/interface/ffi && zig build test` → **43/43 tests pass** (8 unit
+ 35 C-ABI integration through the compiled `libverisimiser.so`); `zig
build` produces `.so` + `.a`.
- Fixed `build.zig` for Zig 0.14 (dropped the `lib.version` panic + the
missing `addInstallHeader`; added `linkLibC` since the impl uses
`std.heap.c_allocator`; wired integration tests into `zig build test`).
- `Handle`/`DbConnection`: `extern struct` → `struct` (they hold a
`std.mem.Allocator`, which has no C layout; C only ever sees them behind
a pointer).
- Fixed a pointless-discard compile error and the integration test's
per-declaration `?*opaque {}` (now one shared opaque `Handle` type).
### Codegen golden + CI
- `examples/golden/`: frozen manifest + schema + committed generated
overlay (deterministic — regenerates byte-identically).
- `.github/workflows/provable.yml` (4 jobs, SHA-pinned actions, timeouts
on all):
1. `idris2-proofs` — `idris2 --check` the ABI
2. `zig-ffi` — `zig build test` + `zig build`
3. `codegen-drift` — regenerate golden and diff
4. `sql-golden` — apply the generated overlay to a real SQLite DB;
assert every sidecar table + enrichment view builds and is queryable
(the views use `ROW_NUMBER() OVER (…)`, so this is a real validity
check)
The Rust CLI stays covered by the existing `rust-ci.yml`; `cargo test`
is green locally too.
### Honesty docs
- Rewrote `docs/developer/ABI-FFI-README.adoc` — it was an **unrendered
RSR template** full of `{{project}}` placeholders, wrong paths,
banned-language bindings, and fictional Idris commands (`%runElab
verifyABI`, `idris2 --cg c-header`). Now describes the real, proven
contract.
- `README` / `ROADMAP` / `EXPLAINME` / `STATE.a2ml`: mark what is
machine-checked vs aspirational and point to `provable.yml`. ROADMAP's
two relevant Phase-1 items are annotated as *partial* (sidecar-isolation
+ layout proofs done; hash-chain/version/lineage proofs and live DB
interception still TODO) rather than over-ticked.
## 🚩 Flag for owner (no action taken)
`.claude/CLAUDE.md` declares this repo **PMPL-1.0-or-later**, but every
actual file (Cargo.toml `license-file`, all SPDX headers, `LICENSE`) is
**MPL-2.0**, and verisimiser is **not** one of the three PMPL carve-out
repos (palimpsest-license / palimpsest-plasma / consent-aware-http). Per
the estate license policy this sole-owner repo should be MPL-2.0, so the
`CLAUDE.md` line looks like the drift. **I changed nothing
license-related** — new files I authored carry MPL-2.0 to match the
repo's actual classification. Surfacing only; your call.
## Verification summary
| Gate | Result (local) |
|---|---|
| `idris2 --check` Types/Layout/Foreign | ✅ clean, 0 holes/warnings |
| `zig build test` | ✅ 43/43 |
| codegen determinism (regen + diff) | ✅ byte-identical |
| generated SQL → SQLite apply | ✅ all tables + views build & query |
| `cargo test` | ✅ pass |
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Mbq6yKF9RhFai6EQ7WqKhQ
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Mbq6yKF9RhFai6EQ7WqKhQ)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent f4ea008 commit 86319db
8 files changed
Lines changed: 531 additions & 59 deletions
File tree
- .github/workflows
- examples/golden
- generated
- src/interface/ffi
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
0 commit comments