Skip to content

fix(abi): package Coprocessor.Foreign at its module path (A5, 2/3) - #512

Merged
hyperpolymath merged 1 commit into
claude/new-session-th4e9w-a5-shadowsfrom
claude/new-session-th4e9w-a5-coprocessor
Nov 16, 2026
Merged

hyperpolymath merged 1 commit into
claude/new-session-th4e9w-a5-shadowsfrom
claude/new-session-th4e9w-a5-coprocessor

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Why

src/abi/CoprocessorForeign.idr declared module Coprocessor.Foreign. Its module name did not match its path, so the package could not list it, and nothing type-checked it. Owner ruling on A5: put it in the package if it type-checks.

What

  • git mv to src/abi/Coprocessor/Foreign.idr. The contents are unchanged. The module declares %default total and uses no believe_me, assert_total or postulate.
  • echidnaabi.ipkg lists Coprocessor.Foreign. This PR's ABI type-check job is the test. If it fails, the module comes out again; it is not forced through.
  • scripts/gates/w0.sh check 07b now looks for Coprocessor/Foreign.idr. At the old path the check would skip the moved file and pass vacuously. The self-test is updated: bash scripts/gates/w0.selftest.sh gives 68 cases, 0 failed.
  • The SPARK spec comments (coprocessor_safety.ads) and PROOF-STATUS R2 name the new path.

idris2 is not available in this session, so the type-check is left to CI.

Stacked on the A5 PR 1/3 branch (claude/new-session-th4e9w-a5-shadows).


Generated by Claude Code

src/abi/CoprocessorForeign.idr declared `module Coprocessor.Foreign`, so its
module name did not match its path and the package could not list it.
Nothing type-checked it. Owner ruling on A5: salvage it into the package if
it type-checks.

- git mv to src/abi/Coprocessor/Foreign.idr (contents unchanged; the
  module declares %default total and uses no believe_me, assert_total or
  postulate).
- echidnaabi.ipkg lists Coprocessor.Foreign, so idris2-abi-ci type-checks
  it. This PR's ABI job is the type-check. If it fails, the module comes
  out again rather than being forced through.
- w0.sh check 07b now looks for Coprocessor/Foreign.idr. At the old path
  the check would skip the moved file and pass vacuously. The selftest is
  updated (68 cases, 0 failed).
- The SPARK spec comments and PROOF-STATUS R2 name the new path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 16, 2026 19:40
@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

Repository owner deleted a comment from coderabbitai Bot Nov 16, 2026
@hyperpolymath
hyperpolymath merged commit b961411 into claude/new-session-th4e9w-a5-shadows Nov 16, 2026
30 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T19:43:47.278781Z 0bf4a02 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-16T19:40:14.716406Z
We couldn’t complete this review. Comment @codex security review to try again.
0bf4a02 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hyperpolymath
hyperpolymath deleted the claude/new-session-th4e9w-a5-coprocessor branch November 16, 2026 19:40
hyperpolymath pushed a commit that referenced this pull request Nov 16, 2026
Packaging Coprocessor.Foreign (#512) made it the checked coprocessor ABI,
but its CoprocessorKind stopped at Fpga = 10. The Rust enum in
src/rust/coprocessor/types.rs also declares the live Phase 2b subprocess
backends PariGp, Maxima, Singular, Gap and Macaulay2 (constructed by
CoprocessorFactory in coprocessor/mod.rs), with implicit discriminants
11 to 15. Add them in that order: constructors, the u8 encoding and
decoding, the round-trip lemma kindEncodeDecodeId, and
coprocessorHealthOf (Unhealthy, as for the other subprocess kind, Fpga).
Found by Codex on #511.

PROOF-STATUS R2 named "that job's first green run after the move" as the
receipt, which identified no run (also Codex on #511). It now links the
ABI job's green run on dc36ee9 for the eleven-kind module, and says the
extended module has no receipt until that job is recorded for this
commit.

Idris 2 is not available in this session; the ABI job on this PR's head
is the check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3
hyperpolymath pushed a commit that referenced this pull request Nov 17, 2026
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3
hyperpolymath added a commit that referenced this pull request Nov 17, 2026
… in CI (#521)

## Summary

This follows up on #512 (and the #511 batch). `Coprocessor.Foreign` maps
each `CoprocessorKind` to a u8 tag from 0 to 15. The Rust enum in
`src/rust/coprocessor/types.rs` had no discriminants. The tags therefore
matched Rust only by declaration order, and reordering or inserting a
Rust variant would have shifted the Rust side without any error.

## Changes

- **Rust `CoprocessorKind`:** now `#[repr(u8)]` with explicit
discriminants 0 to 15. Nothing in Rust casts the kind today, so
behaviour does not change.
- **New `scripts/ci/check-coprocessor-tags.sh`:** compares the Rust and
Idris lists as `Name=tag` pairs. It fails on any difference, on a Rust
variant with no explicit discriminant, or when either list is empty.
- **`idris2-abi-ci.yml`:** runs that check on every event. On pushes to
`main`, it also runs when `types.rs` or the script changes.
- **`Coprocessor/Foreign.idr`:**
- The header said "Phase 0 declares the Math kind only". It now says the
module declares all sixteen kinds.
  - The tag doc comment no longer says Rust has no discriminants.

## RSR Quality Checklist

### Required

- [x] Tests pass: the check passes on the tree and fails on both broken
copies (see Testing).
- [x] Code is formatted: `cargo fmt --all -- --check` passes.
- [ ] Linter is clean: `cargo check --locked --lib` passes. Clippy and
actionlint were not run in this session; CI runs both.
- [x] No banned language patterns
- [x] No `unsafe` blocks without `// SAFETY:` comments
- [x] No banned functions
- [x] SPDX license headers present on all new files
- [x] No secrets, credentials, or `.env` files included

### As Applicable

- [x] ABI/FFI changes validated: the Rust and Idris tags agree, and the
check enforces it.

## Testing

- `bash scripts/ci/check-coprocessor-tags.sh` on the tree prints
`coprocessor tags agree: 16 kinds` and exits 0.
- Copy with the Idris tag for `Gap` changed to 13: the script prints
`::error … disagrees`, shows the diff `rust Gap=14` / `idris Gap=13`,
and exits 1.
- Copy with the Rust variant `Gap` left without a discriminant: the
script prints `::error … variants without an explicit discriminant` and
exits 1.

---
_Generated by [Claude
Code](https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3)_

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants