Skip to content

Bind guarded RefC decoding to its Idris2 contract and source replay - #245

Merged
hyperpolymath merged 10 commits into
mainfrom
codex/source-binding-20261125
Nov 25, 2026
Merged

hyperpolymath merged 10 commits into
mainfrom
codex/source-binding-20261125

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

The real RefC byte wrapper now calls a guarded pure Zig decoder with an authoritative Idris2 word contract. The decoder checks range before narrowing and requires exact re-encoding through its imported encoder; Atoma interprets both original modules and proves universal canonical acceptance and absence of a narrowing trap.

Adds a fresh total/no-holes Idris2 decoder oracle, 1,026 native witnesses in all four Zig optimisation modes, and a compiled wrong-decoder rejection control. The actual header ABI suite remains required.

CI repairs:

  • Weekly ECHIDNA verification now calls Proven's real reusable header proof and ABI gates, with a fail-closed summary.
  • Pages uses a pinned upload action and Casket commit, build-only PR validation, a non-deploying manual default, and sufficient cold-build time.
  • Four exact historical fixture fingerprints are classified without broad secret suppression.
  • The existing MPL-2.0 header in core.zig is moved into the scanner's leading-header position; no licence terms change.

Evidence:

The whole foreign boundary remains INCOMPLETE: compiler and pointer-carrier correspondence are not discharged. Idris2 defines ABIs; FFI/API implementation is pure Zig. All heavy validation runs remotely. Deprecated TypeScript publishing and external mirror configuration remain separate outstanding failures; they are not represented as repaired here.

@gitnotebooks

gitnotebooks Bot commented Nov 25, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/hyperpolymath/proven/pull/245

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: cacdc718-d5b4-4333-85d9-45cc4466e18d
Commits

Reviewing files that changed from the base of the PR and between c0b2247 and a388500.

Files selected for processing: 10

  • .github/workflows/casket-pages.yml
  • .github/workflows/echidna-verify.yml
  • .github/workflows/header-refc.yml
  • .github/workflows/header-theory.yml
  • .github/workflows/secret-scanner.yml
  • .gitleaksignore
  • ffi/zig/src/core.zig
  • scripts/test-refc-decoder.sh
  • verification/header/DECODER-SOURCE.adoc
  • verification/header/decoder_runner.zig

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added consistent decoding of 8-bit values from 64-bit words. Values outside the supported range, or words that do not match the canonical encoding, are rejected.
  • Documentation
    • Added details on the decoding contract, validation checks and remaining verification work.
    • Added a finite set of decoder examples covering encoded values and invalid inputs.

The change adds matching Bits8 word decoders in Zig and Idris2. The Zig RefC wrapper delegates decoding to the Zig helper. New verification documentation and an Idris2 oracle describe and exercise the decoder contract.

Changes: Bits8 word decoder

Layer / File(s) Summary
Word decoder implementations
ffi/zig/src/refc/bits8_decode_word.zig, src/Proven/FFI/RefCBits8.idr
Both implementations reject payloads above 255 and words that do not exactly match the encoding of the decoded byte.
Zig wrapper integration
ffi/zig/src/refc/bits8.zig
The wrapper delegates decoding of the pointer's integer value to decoder.decodeWord.
Oracle and decoder contract
verification/header/DecoderOracle.idr, verification/header/DECODER-SOURCE.adoc
The oracle emits results for encoded indices and selected word variants. The document describes decoder checks, ABI bindings, proof and oracle requirements, and pending validation work.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · previous review c0b22

This change moves the Bits8 word decoding into a separate helper and adds a matching Idris2 contract, an oracle and documentation. I found no concrete behavioral risk. The source proof and hosted validation are still pending, as the PR states.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: guarded RefC decoding is bound to its Idris2 contract and source replay. The changeset adds a pure Zig decodeWord, an Idris2 decodeWord with a contract, a DecoderOracl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is specific and relevant to the changeset. It states that the RefC byte wrapper now calls a guarded pure Zig decoder with an Idris2 word contract. It also names the new decoder oracle,…
Full details: Title check

Explanation

The title names the main change: guarded RefC decoding is bound to its Idris2 contract and source replay. The changeset adds a pure Zig decodeWord, an Idris2 decodeWord with a contract, a DecoderOracle replay program, and documentation for the contract. The title is specific and matches the primary change. The title is 67 characters, which is acceptable for a single-sentence title.

Full details: Description check

Explanation

The description is specific and relevant to the changeset. It states that the RefC byte wrapper now calls a guarded pure Zig decoder with an Idris2 word contract. It also names the new decoder oracle, the 1,026 native witnesses, and the wrong-decoder rejection control. These match the added decodeWord functions, the DecoderOracle.idr file, and the DECODER-SOURCE.adoc documentation. It also covers CI workflow repairs, which fall outside the file summaries but do not make the description off-topic.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c6a770ef-b596-4aa3-95af-deb35deb4c78
Commits

Reviewing files that changed from the base of the PR and between 222010b and c0b2247.

Files selected for processing: 5

  • ffi/zig/src/refc/bits8.zig
  • ffi/zig/src/refc/bits8_decode_word.zig
  • src/Proven/FFI/RefCBits8.idr
  • verification/header/DECODER-SOURCE.adoc
  • verification/header/DecoderOracle.idr

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 14

  • GitHub Check: d-symbol-audit
  • GitHub Check: d-detachable-build
  • GitHub Check: d-tests
  • GitHub Check: d-smoke
  • GitHub Check: CodeRabbit
  • GitHub Check: chapel-build
  • GitHub Check: ocaml-build
  • GitHub Check: verify-idris-build
  • GitHub Check: build (0.8.0)
  • GitHub Check: pr-fuzzing
  • GitHub Check: Agda Cubical Lean Rocq replay
  • GitHub Check: proof-check (0.8.0)
  • GitHub Check: PR (address)
  • GitHub Check: semgrep-cloud-platform/scan
Additional comments: 5

src/Proven/FFI/RefCBits8.idr: 1

13-21: LGTM!

ffi/zig/src/refc/bits8_decode_word.zig: 1

3-12: LGTM!

ffi/zig/src/refc/bits8.zig: 1

7-7: LGTM!

Also applies to: 22-22

verification/header/DECODER-SOURCE.adoc: 1

5-22: LGTM!

verification/header/DecoderOracle.idr: 1

3-26: LGTM!

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 25, 2026
@linear-code
linear-code Bot marked this pull request as ready for review November 25, 2026 01:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 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 ❌ Failed 2026-11-25T01:17:11.663160Z
We couldn’t complete this review. Comment @codex review to try again.
c0b2247 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.

Comment thread .github/workflows/casket-pages.yml Fixed
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 1657cdd into main Nov 25, 2026
93 checks passed
@hyperpolymath
hyperpolymath deleted the codex/source-binding-20261125 branch November 25, 2026 02:22
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