Skip to content

Slice 2: make chapeliser provably-real — CI machine-checks proofs/FFI/Chapel + honest status#27

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/sharp-cannon-038nwu
Jun 18, 2026
Merged

Slice 2: make chapeliser provably-real — CI machine-checks proofs/FFI/Chapel + honest status#27
hyperpolymath merged 2 commits into
mainfrom
claude/sharp-cannon-038nwu

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Follow-on to base camp (#26, merged). Goal of this slice: move chapeliser from
"asserted in prose" to machine-verified, and make the docs honest about what
is and isn't checked today.

Provable-real — .github/workflows/provable.yml

The Rust CLI/codegen is already green (63 tests via rust-ci.yml). This adds a
new workflow that verifies everything outside Rust:

Job What it proves
idris2-proofs idris2 --check type-checks Types.idr, Layout.idr, Foreign.idr (the dependent-type ABI proofs)
zig-ffi zig build test compiles + runs the Zig FFI reference impl (Zig 0.14)
codegen-drift regenerates the golden sample and diffs against the committed tree (fails on drift)
chapel-golden compiles and runs the generated Chapel via real chpl, asserting 8/8 items conserved

Golden sample — examples/golden/

A minimal end-to-end fixture that closes the STATE.a2ml action "generate +
compile + run"
:

  • echo.toml — deliberately per-item/merge so the generated Chapel pulls in
    no optional modules (no BlockDist/DynamicIters/AtomicObjects) → small,
    stable compile surface.
  • generated/ — committed codegen output (reviewable + drift-checked).
  • ffi_stub.c — ~60-line C echo implementation of the 12 c_* functions so the
    Chapel can be linked and run without user code.

Honest status — stop claiming what isn't checked yet

  • ROADMAP.adoc: Phase 1 (COMPLETE)(IMPLEMENTED — verification gated in CI); new Phase 1b tracks the four CI jobs (each flips [x] only when green); dropped "compilable" from the bare codegen bullet.
  • Test-count fix: the old 15 tests (6 unit + 8 integration + 1 doc) was wrong — actual is 63 (22 + 40 + 1).
  • README.adoc: Idris2 "Formal proofs that…""proof obligations, machine-checked in CI"; corrected source paths (src/interface/abi, src/interface/ffi); honest pre-alpha Status paragraph.
  • STATE.a2ml: blockers / next-actions / maintenance now reflect CI-gated verification (last-result = warn until provable.yml is green).

Why CI is the verifier (not local)

The idris2 / zig / chpl toolchains aren't installable in the dev sandbox
(ziglang.org and the GitHub releases API are network-blocked here; building
idris2 from source is sandbox-restricted). So GitHub runners are the verifier.
Until provable.yml is green, these artifacts are "written", not "verified"
and the docs now say exactly that. Kept as a draft for that reason: driving
the four jobs to green is the acceptance gate, and a first run may surface real
fixes (e.g. Idris2 DecEq totality, Chapel Time/reduce API specifics) — that
iteration is the "make it real" work.

Follow-up (not blocking): pin action/image refs (actions/checkout,
mlugg/setup-zig, chapel/chapel, idris2-pack) to SHAs per estate policy
once the tags are confirmed working.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mbq6yKF9RhFai6EQ7WqKhQ


Generated by Claude Code

Slice 2 — make chapeliser provably-real and honest.

Provable-real: add .github/workflows/provable.yml with four jobs that
verify everything outside the (already-green) Rust layer:
  - idris2-proofs: `idris2 --check` Types/Layout/Foreign.idr
  - zig-ffi:       `zig build test` the FFI reference impl (Zig 0.14)
  - codegen-drift: regenerate the golden sample and diff vs committed
  - chapel-golden: compile + RUN the generated Chapel via `chpl`

Add examples/golden/ end-to-end fixture: a minimal per-item/merge "echo"
manifest, its committed codegen output, and a ~60-line C FFI stub so CI
can compile and run the generated Chapel (asserts 8/8 items conserved).
This closes the STATE.a2ml action "generate + compile + run".

Honest status — stop asserting what isn't machine-checked yet:
  - ROADMAP: Phase 1 "(COMPLETE)" -> "(IMPLEMENTED — verification gated
    in CI)"; add Phase 1b tracking the four CI jobs; drop "compilable"
    from the bare codegen bullet.
  - Fix the test-count claim: "15 tests (6+8+1)" -> actual "63 (22+40+1)".
  - README: Idris2 "Formal proofs that" -> "proof obligations,
    machine-checked in CI"; correct src paths; honest Status paragraph.
  - STATE.a2ml: blockers/next-actions/maintenance reflect CI-gated
    verification; last-result=warn until provable.yml is green.

The Idris2/Zig/Chapel toolchains are not installable in the dev sandbox,
so CI (GitHub runners) is the verifier. Until provable.yml is green these
artifacts are "written", not "verified" — and the docs now say exactly that.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mbq6yKF9RhFai6EQ7WqKhQ
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 62 issues detected

Severity Count
🔴 Critical 1
🟠 High 9
🟡 Medium 52

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action mlugg/setup-zig@v1 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/checkout@v4 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in boj-build.yml",
    "type": "missing_timeout_minutes",
    "file": "boj-build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "missing_timeout_minutes",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

First provable.yml run surfaced real bugs (all toolchains installed and
ran — the failures were genuine, not infra). Fix each:

- Chapel: codegen emitted `return` inside `on Locales[0]` (load-phase
  error path), which `chpl` rejects. Restructure to set a `loadFailed`
  flag + `break`, then `return` after the `on` block. Regenerate golden.
- Idris2: idris2 0.8 requires the source file path to match the dotted
  module name; nest Types/Layout/Foreign under Chapeliser/ABI/ and point
  the CI check paths there.
- Zig: build.zig panicked installing a *versioned* shared library
  (major_only_filename null in Zig 0.14) — drop `lib.version`; also
  linkLibC() on libs + tests (main.zig uses std.heap.c_allocator).

Also address the advisory Hypatia comment on provable.yml: pin
actions/checkout to the estate SHA and add timeout-minutes to every job
(mlugg/setup-zig SHA-pin left as a noted follow-up — advisory medium).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mbq6yKF9RhFai6EQ7WqKhQ
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 54 issues detected

Severity Count
🔴 Critical 1
🟠 High 9
🟡 Medium 44

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action mlugg/setup-zig@v1 needs attention",
    "type": "unpinned_action",
    "file": "provable.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in boj-build.yml",
    "type": "missing_timeout_minutes",
    "file": "boj-build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "missing_timeout_minutes",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath marked this pull request as ready for review June 18, 2026 11:46
@hyperpolymath hyperpolymath merged commit d2b3a3d into main Jun 18, 2026
24 of 28 checks passed
@hyperpolymath hyperpolymath deleted the claude/sharp-cannon-038nwu branch June 18, 2026 11:47
hyperpolymath added a commit that referenced this pull request Jun 18, 2026
…obs (#28)

Follow-up to #27 (merged). #27 landed the `provable.yml` workflow and
got **Zig + codegen-drift green**, but merged while two jobs were still
failing — this greens them:

### `idris2-proofs`
Removed the three auxiliary `DecEq` instances (`Result`,
`PartitionStrategy`, `GatherStrategy`). They are **not used by any of
the load-bearing proofs** (completeness / disjointness / conservation /
round-trip / layout) and relied on a `decEq _ _ = No absurd` catch-all,
which Idris2 rejects — `No absurd` needs *explicit* off-diagonal
constructor pairs (as the base library's `DecEq Bool` does). The
invariant proofs are untouched; a comment notes they can be re-added via
elaborator-reflection derivation if decidable equality is ever needed.

### `chapel-golden`
`chpl` reported `Could not find C function for c_process_item` — the
`c_*` externs are called inside the `coforall … on loc`
(potentially-remote) block, which Chapel requires to have a real C
prototype. The generated `<name>_chapeliser.h` only declares the
`echo_*` *user* contract, not the `c_*` bridge ABI. Fix (a proper
codegen improvement, not a golden-only hack):
- `header.rs` now also emits **`<name>_abi.h`** with the 12 `c_*`
prototypes.
- `chapel.rs` emits **`require "<name>_abi.h";`** in the wrapper module.
- the `chapel-golden` job passes **`-I …/include`** so the `require`
resolves.
- golden fixtures regenerated (adds `echo_abi.h` + the `require` line).

### Verified locally
Rust layer still **63 tests green**, codegen **drift-free**. The
idris2/chapel toolchains aren't installable in the dev sandbox, so — as
with #27 — CI is the verifier; turning these two jobs green is the
acceptance gate, and I'll drive it.

🤖 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>
hyperpolymath added a commit that referenced this pull request Jun 18, 2026
Pins the last unpinned action in `provable.yml` to its commit SHA,
clearing the one remaining advisory Hypatia `unpinned_action` finding
(medium) introduced in #27/#28.

`mlugg/setup-zig@v1` →
`mlugg/setup-zig@53fc45b17fe98b52f92ee5ea08ff48a85a3e7eb7 # v1.2.2`

SHA resolved via `git ls-remote https://github.com/mlugg/setup-zig` (the
`v1` tag points to the same commit as `v1.2.2`). No behaviour change —
same action, same `version: 0.14.0`.

🤖 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>
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