Skip to content

Check the public header boundary and bounded span contract - #249

Merged
hyperpolymath merged 6 commits into
mainfrom
codex/heap-boundary-20261125
Nov 27, 2026
Merged

hyperpolymath merged 6 commits into
mainfrom
codex/heap-boundary-20261125

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

The borrowed-loop proof did not cover the public header entry's null refusal, pointer-to-slice forwarding or backend-error mapping. Add an Idris2 bounded-span contract composed with the authoritative header fold, and pure Zig tests importing the unchanged core.headerHasCrlf implementation. The dispatch fixture observes exact pointer/length, all valid subspans, one backend call, null-before-call behaviour and -99/-7 error mapping. The real exported Idris-backed ABI also exercises interior and empty spans, including NUL and high bytes, and checks unchanged input.

The required header bridge gate runs the public-entry fixture in four modes, rejects four compiled source mutants, rejects an invalid Idris span, and refuses a planted zero-exit compiler error with a stale PASS marker. It snapshots and rechecks original and private-copy inputs before PASS.

Hosted header bridge run45591156861/job139125449358 passed at56b75cb45419a4095d4af51c7e3c38133e8ff968. Evidence includes the Idris contract/no-hole audit, native mode campaigns, runtime mutant refusals and the real exported ABI span fixture. Other repository checks and review must also complete before merge. Atoma #34 provides the companion original-source interpretation.

The dispatch double is distinct from real ABI evidence. Readable live memory, pointer/region correspondence, usize representability and synchronous immutable lifetime remain caller premises. Idris2 ABI and pure Zig FFI/API preserved; no heavy local execution.

@gitnotebooks

gitnotebooks Bot commented Nov 25, 2026

Copy link
Copy Markdown

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

@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 31 minutes.

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: 9eedfec2-ed63-4fd6-8956-34feb99e32f3
Commits

Reviewing files that changed from the base of the PR and between 56b75cb and ae69f48.

Files selected for processing: 7

  • ROADMAP.adoc
  • benchmarks/header_boundary.zig
  • docs/adr/2026-11-25-header-public-boundary.adoc
  • ffi/zig/src/header_boundary_tests.zig
  • scripts/bench-header-boundary.sh
  • scripts/test-header-bridge.sh
  • scripts/test-header-export-controls.sh

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded coverage for bounded input spans, including empty spans and interior pointers, while checking that caller data remains unchanged.
    • Added checks for null inputs, backend errors and invalid results, plus regression tests that verify boundary failures are detected across multiple build modes.
  • Documentation
    • Added guidance on input-boundary behavior, validation coverage and remaining requirements for native ABI testing. Hosted qualification remains pending.

The change adds an Idris2 model for bounded spans and boundary results. It adds Zig public-entry tests and a real-ABI subspan test. Qualification scripts check the model, test mutations, and record evidence.

Changes: Header public boundary

Layer / File(s) Summary
Span and result contract
src/Proven/FFI/HeaderBoundary.idr, docs/adr/2026-11-25-header-public-boundary.adoc
The Idris2 module defines bounded spans, backend outcomes, status mappings, and proofs relating the entry to the byte scan. The ADR describes the boundary contract and its premises.
Zig public-entry tests
ffi/zig/src/header_boundary_tests.zig, ffi/zig/build_standalone.zig, tests/ffi/header_borrow.zig
The tests check null handling, bounded-span forwarding, storage preservation, and backend error mappings. The standalone build adds test and build steps. The ABI borrow test checks every contiguous subspan.
Qualification and evidence gate
scripts/test-header-boundary.sh, scripts/test-header-boundary-controls.sh, scripts/test-header-bridge.sh, docs/adr/2026-11-25-header-public-boundary.adoc, ROADMAP.adoc
The scripts validate the Idris2 module, reject an invalid span, run Zig tests across four modes, test four source mutations, and record evidence. The bridge runs the boundary scripts. The ADR and roadmap state the qualification scope and limitations.

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

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant Gate as test-header-boundary.sh
  participant Idris as Idris compiler
  participant Zig as Zig build
  participant Tests as header-boundary-test
  Gate->>Idris: Check HeaderBoundary and invalid BadSpan
  Gate->>Zig: Build and run tests in four modes
  Zig->>Tests: Run public-entry boundary tests
  Gate->>Zig: Build mutated sources
  Zig->>Tests: Run tests against each mutation
  Tests-->>Gate: Return test results
Loading

Possibly related PRs

Merge Risk: Minimal · previous review 56b75

This change adds boundary-contract proofs, tests and qualification scripts for the header check without changing the ABI. No concrete defect was identified. Remote CI is still pending and should pass before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the public header boundary and the bounded span contract, which are the main changes in the changeset: the Idris2 Span/entry contract, the header-boundary test and build steps, and the…
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 related to the changeset. It states that the PR adds an Idris2 bounded-span contract composed with the header fold, and pure Zig tests for the unchanged core.headerHasC…
Full details: Title check

Explanation

The title names the public header boundary and the bounded span contract, which are the main changes in the changeset: the Idris2 Span/entry contract, the header-boundary test and build steps, and the gate scripts. It is specific and single-sentence, and it does not describe anything absent from the changeset.

Full details: Description check

Explanation

The description is specific and related to the changeset. It states that the PR adds an Idris2 bounded-span contract composed with the header fold, and pure Zig tests for the unchanged core.headerHasCrlf implementation. It also describes the header bridge gate (four Zig optimisation modes, four compiled source mutants, rejection of an invalid Idris span, and refusal of a planted zero-exit compiler error), which matches the scripts and test files in the summary. It names the real exported ABI span fixture and the input snapshot and recheck behaviour. It gives the hosted run reference and states what is not yet proven (caller premises and pending review). The check passes.

  • 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: 68c78586-c35c-4f21-bf57-f1e1a4c125a9
Commits

Reviewing files that changed from the base of the PR and between d5eb0bf and 56b75cb.

Files selected for processing: 9

  • ROADMAP.adoc
  • docs/adr/2026-11-25-header-public-boundary.adoc
  • ffi/zig/build_standalone.zig
  • ffi/zig/src/header_boundary_tests.zig
  • scripts/test-header-boundary-controls.sh
  • scripts/test-header-boundary.sh
  • scripts/test-header-bridge.sh
  • src/Proven/FFI/HeaderBoundary.idr
  • tests/ffi/header_borrow.zig

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: 43

  • GitHub Check: chapel-build
  • GitHub Check: d-build
  • GitHub Check: ocaml-build
  • GitHub Check: CodeRabbit
  • GitHub Check: Idris -> RefC -> Zig
  • GitHub Check: verify-idris-build
  • GitHub Check: proof-check (0.8.0)
  • GitHub Check: build (0.8.0)
  • GitHub Check: build-cross (0.15.2, aarch64-linux-gnu)
  • GitHub Check: build-cross (0.15.2, x86_64-windows-gnu)
  • GitHub Check: build-cross (0.15.2, wasm32-wasi)
  • GitHub Check: build-cross (0.15.2, x86_64-linux-gnu)
  • GitHub Check: build-cross (0.15.2, x86_64-linux-musl)
  • GitHub Check: build-cross (0.15.2, aarch64-linux-musl)
  • GitHub Check: wasm-browser
  • GitHub Check: Agda Cubical Lean Rocq replay
  • GitHub Check: analyze (cpp, none)
  • GitHub Check: pr-fuzzing
  • GitHub Check: Real Idris header ABI
  • GitHub Check: governance / Live Actions policy (credentialed advisory)
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Exemption ratchet
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Actions lockfile verify
  • GitHub Check: governance / Touched deeds pass deed_lint
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Debt ratchet
  • GitHub Check: governance / JS runtimes — bun
  • GitHub Check: governance / UUID v8 conformance
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / JS runtimes — deno
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Existing A2ML (advisory)
  • GitHub Check: governance / UUID v7 conformance
  • GitHub Check: governance / JS runtimes — pnpm
  • GitHub Check: governance / Guix packaging policy (Nix retired)
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: governance / JS runtimes — environment provisions Bun first
  • GitHub Check: governance / Allowlist Preflight
  • GitHub Check: governance / No new A2ML
  • GitHub Check: PR (address)
Additional context used

GitHub Check: SonarCloud Code Analysis

scripts/test-header-boundary.sh

[failure] 56-56: Add a default case (*) to handle unexpected values.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_bulletproof-core&issues=AaISHTgk6r9mRQzExUDA&open=AaISHTgk6r9mRQzExUDA&pullRequest=249

Shellcheck (0.11.0)

scripts/test-header-boundary-controls.sh

[warning] 5-5: Remove space after = if trying to assign a value (for empty string, use var='' ... ).

(SC1007)

scripts/test-header-boundary.sh

[warning] 5-5: Remove space after = if trying to assign a value (for empty string, use var='' ... ).

(SC1007)

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 25, 2026 10:01
@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 ✅ Completed 2026-11-26T11:38:57.951514Z ae69f48 New commits
🔒 Security Review ❌ Failed 2026-11-26T11:36:59.184065Z
We couldn’t complete this review. Comment @codex security review to try again.
ae69f48 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c18bdc4f8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ffi/zig/src/header_boundary_tests.zig Resolved
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 25, 2026
The fixture drives core.headerHasCrlf directly, so a change to ptr or len in
the exported entries was invisible. Assert that each exported entry is a single
delegation of its own ptr and len; a mutated main_refc.zig entry now fails.
@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.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 7c726bf into main Nov 27, 2026
91 checks passed
@hyperpolymath
hyperpolymath deleted the codex/heap-boundary-20261125 branch November 27, 2026 11: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