Repository navigation
Proofs (jcs): first-party key ordering and escaping with Pearlite contracts and a Verus model, not yet run - #53
Conversation
…ts (not yet run) Move UTF-16 key ordering and string escaping out of str::encode_utf16 and serde_json::to_string into src/jcs_core.rs, a dependency-free byte-level module, so both properties can be proved on shipped code. - cmp_utf16: lexicographic byte order after one permutation of EE..F4, which is UTF-16 code-unit order on well-formed UTF-8. - write_string_literal: RFC 8785 section 3.2.2.2 escaping, per byte. - Pearlite contracts behind cfg(creusot), written against creusot-std 0.15.0. No verifier has been run; every proof row is OPEN. - verification/creusot: harness that includes the production file by path, with true and false controls, and a pearlite-syn syntax check. - verification/verus/jcs_model.rs: a model of the same definitions, not run. - Differential tests: exhaustive over all scalar values for escaping and against a boundary set for ordering; counted tests for the new lines. - verification/PROOF-STATUS.adoc: ledger section for the canonical writer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4QvDfneftEg71bUadt3v3
|
Review these changes at https://app.gitnotebooks.com/hyperpolymath/ijson-jcs/pull/53 |
|
Warning Review limit reachedYou'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 44 minutes. View limit details
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. |
… the beta gate definition (#54) Stacked on #53 (base branch `claude/beta-proof-jcs`), because the gate runs the harness that PR adds. Review #53 first. **No prover has run.** This PR adds the gate that will run one, tests the gate's own logic, and defines the beta gate. The proof gate is deliberately not wired to a workflow: no Creusot or Verus image exists in `hyperpolymath/prover-images` (Agda and Lean only, read at `c972dc9`). ## What is in the PR | Path | Content | |---|---| | `scripts/proofs/gate.sh` | The proof gate | | `verification/creusot/SCOPE` | The production files the harness must include by path | | `scripts/tests/proof-gate-test.sh` | Fixtures for the gate, against stub verifiers | | `.github/workflows/ci.yml` | Two steps: contract syntax check, gate self-test. Both named as not evidence | | `docs/RELEASING.adoc` | "What beta means" and the beta gates, beside the preview gates | | `verification/PROOF-STATUS.adoc` | Owner ruling, verifier state on 2026-12-01, Kani statement | ## What the gate requires 1. `PROVER_IMAGE` pinned as `NAME[:TAG]@sha256:<64 hex>`. 2. A non-empty production scope: every file in `SCOPE` exists and is included by path in the harness. 3. Inputs identical to the commit. 4. True control: the verifier accepts the production scope and the true controls. 5. False control: with `--features false-control` the verifier refuses, and its output names every false control. It then writes a receipt (canonical I-JSON, checked with this repository's own `ijson-jcs check --profile library`) holding the commit, the image, the invocation and the sha256 of each input. A stub run writes `"verifier":"stub"` and the beta gate rejects that. ## Evidence (executed here) `bash scripts/tests/proof-gate-test.sh`: 11 of 11 cases behave as required. | Case | Expected | Result | |---|---|---| | honest stub | pass, receipt has commit, input digest, both refused controls | ok | | stub accepts everything | fail: false controls accepted | ok | | stub refuses everything | fail: production scope refused | ok | | refusal that names no control | fail | ok | | refusal that names one of two controls | fail | ok | | image by tag only | fail | ok | | no image | fail | ok | | empty `SCOPE` | fail | ok | | harness no longer includes the production file | fail | ok | | input edited after the commit | fail | ok | | false controls removed | fail | ok | Also: `cargo test --locked --all-features` 166 passed, 0 failed; harness syntax check 2 passed. `shellcheck` is not installed here, so the two scripts were not linted. ## Not done, stated plainly - The verifier invocation (`PROOF_VERIFIER_CMD`, default `cargo creusot prove`) is a guess until an image exists. The gate has only ever run against stubs. - The check that a refusal "names the false control" greps the verifier's output. The real output format is unknown; it may need tightening so a control named in a passing line does not count. - No Verus gate yet; it follows the same shape once an image exists. - No workflow runs the real gate. Unwired is not done. ## Row census Denominator: the 9 obligations J-1 to J-9 from #53. This PR changes none: `PROVEN` 0, `TESTED` 3, `OPEN` 6. It adds no proof evidence. ## For the owner The beta gate text in `docs/RELEASING.adoc` is a proposal: in particular which rows must be `PROVEN` for beta (I named J-1, J-2, J-4, J-6, J-7 and the reader's termination, panic-freedom and duplicate rejection), and that an `OPEN` row blocks the tag unless ruled out of scope in writing. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…ng: new error variant) (#57) Owner ruling of 2026-12-01 (hardening a): prove member order instead of trusting `sort_by`. Stacked on #55 (base `claude/beta-proof-reader`), the top of the #53 → #54 → #55 stack. ## Breaking change `CanonicalizationError` gains a variant, `MemberOrder`. The enum is not `#[non_exhaustive]`, so downstream code that matches it without a wildcard arm stops compiling. This lands before any 0.1 tag, as ruled, and is recorded in a new `CHANGELOG.adoc`. ## Change `write_object_jcs` still sorts with `slice::sort_by`, but then calls `jcs_core::strictly_increasing` and returns `MemberOrder` unless every adjacent pair of keys is in strict UTF-16 order. Under a strict total order, a strictly increasing sequence is the one sorted arrangement of its keys, so anything written is in canonical order. What is trusted of the sort shrinks from "sorted" to "a permutation of its input" (assumption A-3, reworded). Members are collected once as `(key bytes, value)` pairs, which removes the per-key map lookup. No input is known to trigger the new error. ## Evidence (rustc 1.99.1) | Check | Result | |---|---| | `cargo test --locked --all-features` | 170 passed, 0 failed | | Must-fail controls: `strictly_increasing_refuses_disorder_and_repeats`, `test_member_order_is_certified_not_trusted` | 9 disordered or repeated key sequences refused, including a pair sorted as UTF-8 but not as UTF-16 | | Planted mutants of the check | 2 of 2 fail the tests | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 6 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | two new `unreachable` exclusions (the refusal and the `return false`), each named with the unit test that executes it; no other new uncovered line | | `cargo bench --locked`, `canonical-object-v1`, median of 9 | 858,880 ns (997,985 ns on #53; one local run each, not a baseline) | One thing the tests cannot show: deleting the call to `certify_member_order` would not fail any test, because the standard sort never returns disorder. That call is three lines read by eye; the check it calls is what carries the contract. No verifier has been run. ## Ledger `J-6` (members written in strictly increasing order): status stays `OPEN`; scope now names `strictly_increasing` and its contract, and says which three lines are outside Creusot's scope. `A-3` narrowed to "permutation". Census unchanged: 16 obligations, `PROVEN` 0, `TESTED` 8, `OPEN` 8; 7 `ASSUMED` boundaries. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ndering evidence (not yet run) (#58) Stacked on #57 (base `claude/beta-member-order`), the top of the #53 → #54 → #55 → #57 stack. Follows the owner rulings of 2026-12-02: beta covers every ledger surface; keep the integer fast path and prove it; specify tests, do not prove them. **No verifier has been run.** Nothing here is `PROVEN`. ## What is in the PR | Path | Content | |---|---| | `src/framing_core.rs` | `matches_canonical` (the canonical bytes, optionally plus one line feed) and `line_end` (where a line stops), dependency-free, with Pearlite contracts behind `cfg(creusot)` | | `src/profile.rs`, `src/records.rs` | call the core; behaviour unchanged | | `verification/creusot/` | includes the new file by path; one more true control and one more false control; `SCOPE` and the gate self-test follow | | `tests/integer_rendering.rs` | J-9 evidence: integer fast path against the ryu-js path | | `verification/PROOF-STATUS.adoc` | new sections: profiles and framing (F-1 to F-6), command-line tool (C-1 to C-5, boundary A-8), and a table giving each test file's oracle, inputs and what a pass shows | Not written, by agreement with the hub until the first Creusot run: contracts on `classify`, `Records::parse`, `canonicalize_records`, the JSON-LD entry point and the whole CLI, and the `std::fs` / `std::io` boundary specification (A-8). Their rows exist and say so. ## Evidence (executed here, rustc 1.99.1) | Check | Result | |---|---| | `cargo test --locked --all-features` | 177 passed, 0 failed | | `matches_canonical` against the previous rule | all pairs of 364 short byte strings, both settings, equal | | `line_end` and the record splitter against the previous splitter | every start in those strings; 3,280 inputs; equal | | Planted mutants of `src/framing_core.rs` | 4 of 4 fail the tests | | `tests/integer_rendering.rs` | exhaustive for magnitudes up to 2^17, ±8 around powers of two and ten, 200,000 sampled: fast path and ryu-js path give the same bytes | | Wider run of the same comparison (scratch program, not committed; ryu-js 1.0.3) | 134,217,729 exhaustive, 18,448 boundary and 200,000,000 sampled values, all equal; fast path 26.0 vs 43.8 ns per value on large integers, 17.3 vs 53.6 on small ones (one machine, one run) | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 13 + 8 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | no new uncovered line; one counted test added to reach the mismatch branch through `classify` | While writing `matches_canonical` I introduced and caught a subtraction that would have underflowed on an empty input; the test for it (`matches_canonical(b"", b"{}", true)`) is in the file. ## Row census Denominator: 27 obligations across the four sections (J 9, R 7, F 6, C 5). | Token | Count | |---|---| | `PROVEN` | 0 | | `PROVEN-WITH-AXIOMS` | 0 | | `TESTED` | 19 | | `ASSUMED` | 0 | | `OPEN` | 8 | Trust boundaries: 8, all `ASSUMED`; A-8 (`std::fs`, `std::io`) has no written specification yet. Under the beta gate, `TESTED` blocks a tag exactly as `OPEN` does, so all 27 remain to be proved. Engineering proofs are not PWG-graded. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
|
❌ The last analysis has failed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 789685b34c
ℹ️ 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".
| "$engine" run --rm --network none -v "$root:/work:ro" -w "/work/$harness" "$image" \ | ||
| sh -c "$verifier_cmd ${features[*]}" |
There was a problem hiding this comment.
Provide a writable Cargo target directory
The real-verifier path mounts the entire repository at /work read-only and then runs Cargo from /work/verification/creusot, so a default cargo creusot prove cannot create its target directory or other build artifacts and the true-control run fails before verification. I checked cargo build --help, which describes --target-dir as the “Directory for all generated artifacts”; set that directory to writable container storage or mount a writable target volume while keeping the source read-only.
Useful? React with 👍 / 👎.
| for control in "${false_controls[@]}"; do | ||
| grep -qF "$control" target/proofs/false-control.log \ | ||
| || fail "verifier refused, but not because of $control" |
There was a problem hiding this comment.
Require proof-failure diagnostics for false controls
Any nonzero exit passes this check as long as both function names occur somewhere in the log; for example, a verifier stub that prints both names, then reports a missing solver and exits 1 is accepted. Thus an infrastructure, compilation, or type-checking failure can produce a successful proof receipt without demonstrating that the verifier rejected either false proposition, contrary to the gate's stated negative-control guarantee. Validate structured verifier goal failures, including the absence of unrelated fatal errors, rather than matching name substrings.
Useful? React with 👍 / 👎.
| # 3. One revision. | ||
| inputs=("${scope[@]}" "$harness/Cargo.toml" "$harness/Cargo.lock" "$harness/src/lib.rs" "$harness/src/controls.rs" "$harness/SCOPE") | ||
| commit=$(git rev-parse HEAD) || fail "not a git checkout" | ||
| [[ -z $(git status --porcelain -- "${inputs[@]}") ]] || fail "inputs differ from commit $commit" |
There was a problem hiding this comment.
Bind the proof gate implementation to the receipt
The cleanliness check and receipt inputs omit scripts/proofs/gate.sh itself, so running a locally modified gate still records the unmodified HEAD commit and can emit a receipt that appears to describe that committed revision. This also contradicts the script's claim that the tracked tree is clean for the result. Include the gate script among the checked and hashed inputs, or reject all tracked modifications before invoking the verifier.
Useful? React with 👍 / 👎.
| grep -qF "#[path = \"../../../$file\"]" "$harness/src/lib.rs" \ | ||
| || fail "harness does not include $file by path" |
There was a problem hiding this comment.
Verify that scope paths are active Rust modules
This substring check also accepts a path attribute inside a comment or string, so the harness can stop compiling a file listed in SCOPE while the gate still claims that file was verified and includes its digest in the receipt. For example, replacing the active module declaration with // #[path = "../../../src/jcs_core.rs"] satisfies this test; if the controls are adjusted to compile independently, the real verifier can pass without reading the production file. Parse the harness or otherwise validate an active path-qualified module declaration rather than grepping its text.
Useful? React with 👍 / 👎.
| for file in $(printf '%s\n' "${inputs[@]}" | LC_ALL=C sort); do | ||
| printf '%s"%s":"%s"' "$sep" "$file" "$(sha256sum "$file" | cut -d' ' -f1)"; sep=, | ||
| done | ||
| printf '},"invocation":"%s","verifier":"%s"}' "$verifier_cmd" "$([[ -n $stub ]] && echo stub || echo creusot)" |
There was a problem hiding this comment.
Escape configurable values when writing the JSON receipt
PROOF_VERIFIER_CMD is an arbitrary shell command, but it is interpolated directly into a quoted JSON string. A legitimate invocation containing a double quote or backslash, such as one with a quoted argument, therefore makes the supposedly successful receipt invalid JSON even though verification passed. Generate the receipt through a JSON serializer, or correctly escape every interpolated string before writing it.
Useful? React with 👍 / 👎.
| receipt=target/proofs/creusot-receipt.json | ||
| image=${PROVER_IMAGE:-} | ||
| engine=${ENGINE:-podman} | ||
| verifier_cmd=${PROOF_VERIFIER_CMD:-cargo creusot prove} |
There was a problem hiding this comment.
Report the verifier that was actually executed
PROOF_VERIFIER_CMD may name any command, yet every non-stub receipt unconditionally records "verifier":"creusot". A wrapper or different executable that returns success for the true run and a name-bearing failure for the false run therefore produces a receipt satisfying the beta check that verifier is not stub, even though Creusot never ran. Restrict the override to an audited Creusot invocation or derive and validate the verifier identity recorded in the receipt from the executable actually launched.
Useful? React with 👍 / 👎.
…ng: new error variant) (#57) Owner ruling of 2026-12-01 (hardening a): prove member order instead of trusting `sort_by`. Stacked on #55 (base `claude/beta-proof-reader`), the top of the #53 → #54 → #55 stack. `CanonicalizationError` gains a variant, `MemberOrder`. The enum is not `#[non_exhaustive]`, so downstream code that matches it without a wildcard arm stops compiling. This lands before any 0.1 tag, as ruled, and is recorded in a new `CHANGELOG.adoc`. `write_object_jcs` still sorts with `slice::sort_by`, but then calls `jcs_core::strictly_increasing` and returns `MemberOrder` unless every adjacent pair of keys is in strict UTF-16 order. Under a strict total order, a strictly increasing sequence is the one sorted arrangement of its keys, so anything written is in canonical order. What is trusted of the sort shrinks from "sorted" to "a permutation of its input" (assumption A-3, reworded). Members are collected once as `(key bytes, value)` pairs, which removes the per-key map lookup. No input is known to trigger the new error. | Check | Result | |---|---| | `cargo test --locked --all-features` | 170 passed, 0 failed | | Must-fail controls: `strictly_increasing_refuses_disorder_and_repeats`, `test_member_order_is_certified_not_trusted` | 9 disordered or repeated key sequences refused, including a pair sorted as UTF-8 but not as UTF-16 | | Planted mutants of the check | 2 of 2 fail the tests | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 6 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | two new `unreachable` exclusions (the refusal and the `return false`), each named with the unit test that executes it; no other new uncovered line | | `cargo bench --locked`, `canonical-object-v1`, median of 9 | 858,880 ns (997,985 ns on #53; one local run each, not a baseline) | One thing the tests cannot show: deleting the call to `certify_member_order` would not fail any test, because the standard sort never returns disorder. That call is three lines read by eye; the check it calls is what carries the contract. No verifier has been run. `J-6` (members written in strictly increasing order): status stays `OPEN`; scope now names `strictly_increasing` and its contract, and says which three lines are outside Creusot's scope. `A-3` narrowed to "permutation". Census unchanged: 16 obligations, `PROVEN` 0, `TESTED` 8, `OPEN` 8; 7 `ASSUMED` boundaries. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <noreply@anthropic.com>
…ndering evidence (not yet run) (#58) Stacked on #57 (base `claude/beta-member-order`), the top of the #53 → #54 → #55 → #57 stack. Follows the owner rulings of 2026-12-02: beta covers every ledger surface; keep the integer fast path and prove it; specify tests, do not prove them. **No verifier has been run.** Nothing here is `PROVEN`. ## What is in the PR | Path | Content | |---|---| | `src/framing_core.rs` | `matches_canonical` (the canonical bytes, optionally plus one line feed) and `line_end` (where a line stops), dependency-free, with Pearlite contracts behind `cfg(creusot)` | | `src/profile.rs`, `src/records.rs` | call the core; behaviour unchanged | | `verification/creusot/` | includes the new file by path; one more true control and one more false control; `SCOPE` and the gate self-test follow | | `tests/integer_rendering.rs` | J-9 evidence: integer fast path against the ryu-js path | | `verification/PROOF-STATUS.adoc` | new sections: profiles and framing (F-1 to F-6), command-line tool (C-1 to C-5, boundary A-8), and a table giving each test file's oracle, inputs and what a pass shows | Not written, by agreement with the hub until the first Creusot run: contracts on `classify`, `Records::parse`, `canonicalize_records`, the JSON-LD entry point and the whole CLI, and the `std::fs` / `std::io` boundary specification (A-8). Their rows exist and say so. ## Evidence (executed here, rustc 1.99.1) | Check | Result | |---|---| | `cargo test --locked --all-features` | 177 passed, 0 failed | | `matches_canonical` against the previous rule | all pairs of 364 short byte strings, both settings, equal | | `line_end` and the record splitter against the previous splitter | every start in those strings; 3,280 inputs; equal | | Planted mutants of `src/framing_core.rs` | 4 of 4 fail the tests | | `tests/integer_rendering.rs` | exhaustive for magnitudes up to 2^17, ±8 around powers of two and ten, 200,000 sampled: fast path and ryu-js path give the same bytes | | Wider run of the same comparison (scratch program, not committed; ryu-js 1.0.3) | 134,217,729 exhaustive, 18,448 boundary and 200,000,000 sampled values, all equal; fast path 26.0 vs 43.8 ns per value on large integers, 17.3 vs 53.6 on small ones (one machine, one run) | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 13 + 8 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | no new uncovered line; one counted test added to reach the mismatch branch through `classify` | While writing `matches_canonical` I introduced and caught a subtraction that would have underflowed on an empty input; the test for it (`matches_canonical(b"", b"{}", true)`) is in the file. ## Row census Denominator: 27 obligations across the four sections (J 9, R 7, F 6, C 5). | Token | Count | |---|---| | `PROVEN` | 0 | | `PROVEN-WITH-AXIOMS` | 0 | | `TESTED` | 19 | | `ASSUMED` | 0 | | `OPEN` | 8 | Trust boundaries: 8, all `ASSUMED`; A-8 (`std::fs`, `std::io`) has no written specification yet. Under the beta gate, `TESTED` blocks a tag exactly as `OPEN` does, so all 27 remain to be proved. Engineering proofs are not PWG-graded. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…ng: new error variant) (#57) Owner ruling of 2026-12-01 (hardening a): prove member order instead of trusting `sort_by`. Stacked on #55 (base `claude/beta-proof-reader`), the top of the #53 → #54 → #55 stack. `CanonicalizationError` gains a variant, `MemberOrder`. The enum is not `#[non_exhaustive]`, so downstream code that matches it without a wildcard arm stops compiling. This lands before any 0.1 tag, as ruled, and is recorded in a new `CHANGELOG.adoc`. `write_object_jcs` still sorts with `slice::sort_by`, but then calls `jcs_core::strictly_increasing` and returns `MemberOrder` unless every adjacent pair of keys is in strict UTF-16 order. Under a strict total order, a strictly increasing sequence is the one sorted arrangement of its keys, so anything written is in canonical order. What is trusted of the sort shrinks from "sorted" to "a permutation of its input" (assumption A-3, reworded). Members are collected once as `(key bytes, value)` pairs, which removes the per-key map lookup. No input is known to trigger the new error. | Check | Result | |---|---| | `cargo test --locked --all-features` | 170 passed, 0 failed | | Must-fail controls: `strictly_increasing_refuses_disorder_and_repeats`, `test_member_order_is_certified_not_trusted` | 9 disordered or repeated key sequences refused, including a pair sorted as UTF-8 but not as UTF-16 | | Planted mutants of the check | 2 of 2 fail the tests | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 6 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | two new `unreachable` exclusions (the refusal and the `return false`), each named with the unit test that executes it; no other new uncovered line | | `cargo bench --locked`, `canonical-object-v1`, median of 9 | 858,880 ns (997,985 ns on #53; one local run each, not a baseline) | One thing the tests cannot show: deleting the call to `certify_member_order` would not fail any test, because the standard sort never returns disorder. That call is three lines read by eye; the check it calls is what carries the contract. No verifier has been run. `J-6` (members written in strictly increasing order): status stays `OPEN`; scope now names `strictly_increasing` and its contract, and says which three lines are outside Creusot's scope. `A-3` narrowed to "permutation". Census unchanged: 16 obligations, `PROVEN` 0, `TESTED` 8, `OPEN` 8; 7 `ASSUMED` boundaries. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <noreply@anthropic.com>
…ndering evidence (not yet run) (#58) Stacked on #57 (base `claude/beta-member-order`), the top of the #53 → #54 → #55 → #57 stack. Follows the owner rulings of 2026-12-02: beta covers every ledger surface; keep the integer fast path and prove it; specify tests, do not prove them. **No verifier has been run.** Nothing here is `PROVEN`. ## What is in the PR | Path | Content | |---|---| | `src/framing_core.rs` | `matches_canonical` (the canonical bytes, optionally plus one line feed) and `line_end` (where a line stops), dependency-free, with Pearlite contracts behind `cfg(creusot)` | | `src/profile.rs`, `src/records.rs` | call the core; behaviour unchanged | | `verification/creusot/` | includes the new file by path; one more true control and one more false control; `SCOPE` and the gate self-test follow | | `tests/integer_rendering.rs` | J-9 evidence: integer fast path against the ryu-js path | | `verification/PROOF-STATUS.adoc` | new sections: profiles and framing (F-1 to F-6), command-line tool (C-1 to C-5, boundary A-8), and a table giving each test file's oracle, inputs and what a pass shows | Not written, by agreement with the hub until the first Creusot run: contracts on `classify`, `Records::parse`, `canonicalize_records`, the JSON-LD entry point and the whole CLI, and the `std::fs` / `std::io` boundary specification (A-8). Their rows exist and say so. ## Evidence (executed here, rustc 1.99.1) | Check | Result | |---|---| | `cargo test --locked --all-features` | 177 passed, 0 failed | | `matches_canonical` against the previous rule | all pairs of 364 short byte strings, both settings, equal | | `line_end` and the record splitter against the previous splitter | every start in those strings; 3,280 inputs; equal | | Planted mutants of `src/framing_core.rs` | 4 of 4 fail the tests | | `tests/integer_rendering.rs` | exhaustive for magnitudes up to 2^17, ±8 around powers of two and ten, 200,000 sampled: fast path and ryu-js path give the same bytes | | Wider run of the same comparison (scratch program, not committed; ryu-js 1.0.3) | 134,217,729 exhaustive, 18,448 boundary and 200,000,000 sampled values, all equal; fast path 26.0 vs 43.8 ns per value on large integers, 17.3 vs 53.6 on small ones (one machine, one run) | | pearlite-syn 0.15.0 syntax check | 37 + 7 + 13 + 8 contract terms parse | | `scripts/tests/proof-gate-test.sh` (stub verifiers) | 11 of 11 cases | | clippy `-D warnings`, `cargo fmt --check` | clean | | `scripts/proven-coverage.sh` | no new uncovered line; one counted test added to reach the mismatch branch through `classify` | While writing `matches_canonical` I introduced and caught a subtraction that would have underflowed on an empty input; the test for it (`matches_canonical(b"", b"{}", true)`) is in the file. ## Row census Denominator: 27 obligations across the four sections (J 9, R 7, F 6, C 5). | Token | Count | |---|---| | `PROVEN` | 0 | | `PROVEN-WITH-AXIOMS` | 0 | | `TESTED` | 19 | | `ASSUMED` | 0 | | `OPEN` | 8 | Trust boundaries: 8, all `ASSUMED`; A-8 (`std::fs`, `std::io`) has no written specification yet. Under the beta gate, `TESTED` blocks a tag exactly as `OPEN` does, so all 27 remain to be proved. Engineering proofs are not PWG-graded. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Proof module 1 of the beta track:
src/jcs.rs. No verifier has been run. The owner ruled that provers run from the pinnedhyperpolymath/prover-images, which has no Creusot or Verus image yet, so every proof row in this PR isOPEN. What this PR does is make the code provable, write the contracts, and give executedTESTEDevidence that behaviour is unchanged.Design decision (for the owner)
Key ordering used
str::encode_utf16().cmp()and escaping usedserde_json::to_string. Neither can be given more than an assumed contract in Creusot, so a proof "on the production code" would have proved almost nothing first-party.src/jcs_core.rs, a dependency-free byte-level module. UTF-16 code-unit order on well-formed UTF-8 is plain byte order after one permutation of the byte valuesEE..=F4; escaping only ever touches bytes below0x20,"and\. Both become short loops over&[u8]that Creusot handles directly, and the trusted base for these two properties shrinks to "astris UTF-8".encode_utf16andserde_json::to_string. Zero production change; the two properties stayASSUMEDfor good.sort_by(creusot-std 0.15.0 has no contract for it), at the cost of a new error path. Needs an owner ruling because it touches the public error enum.What is in the PR
src/jcs_core.rscmp_utf16,write_string_literal, Pearlite contracts and lemmas behindcfg(creusot), differential unit testssrc/jcs.rsstd::cmp::Orderingimport and the serde_json escaping calls removedverification/creusot/src/jcs_core.rsby path;controls.rshas 2 true controls and 2 false controls (featurefalse-control);tests/contracts_parse.rsis a syntax checkverification/verus/jcs_model.rsverification/PROOF-STATUS.adocCargo.tomlcheck-cfgforcfg(creusot)only; no new dependency in the shipped crateThe Verus file is a separately written model. Per policy §1.2 a Verus result on it would not be a proof of the production code and is not a second independent witness: one author, one specification, SMT solvers on both sides.
Evidence (executed here, rustc 1.99.1, Linux x86_64)
cargo test --locked --all-featurescargo test --locked --lib jcs_core(differential, vs the old implementation)serde_json::to_stringencode_utf16().cmp()src/jcs_core.rs(false control for the tests)cargo test --manifest-path verification/creusot/Cargo.toml(pearlite-syn 0.15.0)cargo clippy --locked --all-targets --all-features -- -D warnings,cargo fmt --checkcargo bench --locked, median of 9,canonical-object-v1scripts/proven-coverage.shunreachableexclusion (bytesF5..FF); still exits 1 for the pre-existingparse_jcslines reported in #50Not executed: Creusot, Why3, Verus, Z3, CVC5, Kani. No image digests exist to cite. The pearlite-syn check is syntax only: it does not type-check the contracts, and I expect some to need adjustment on first contact with the verifier (lemma bodies are empty;
Seqequalities may needext_eqhints). MSRV, macOS and Windows jobs were not run locally.Kani: not applicable.
#[forbid(unsafe_code)]holds in the library and the binary and there is no FFI.Row census
Denominator: the 9 obligations J-1 to J-9 added to
PROOF-STATUS.adoc.PROVENPROVEN-WITH-AXIOMSTESTEDASSUMEDOPENAssumptions recorded: 5 (serde_json, ryu-js,
sort_by,i64::to_string,stris UTF-8), allASSUMED. Engineering proofs are not PWG-graded.Open points
char::to_utf8is opaque. This is the hardest remaining statement and may be better stated once as theory.ijson-jcs. No licence file was touched..proven/coverage-exclusions.tsv.Generated by Claude Code