8000 test(storage): Kani proofs of the key and value encoders (#627) by adityamukho · Pull Request #690 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

test(storage): Kani proofs of the key and value encoders (#627) - #690

Merged
adityamukho merged 5 commits into
v3from
test/627-kani
Oct 22, 2026
Merged

adityamukho merged 5 commits into
v3from
test/627-kani

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Closes #627.

Implements the spec merged in #689 (docs/superpowers/specs/2026-10-22-kani-storage-encoding-design.md); plan in docs/superpowers/plans/2026-10-22-627-kani-storage-encoding.md. Test-only: no library, .graph format or WAL change.

What

  • src/storage/keys/verification.rs (7 harnesses): put_int, put_uint, put_valid_to (incl. VALID_TIME_FOREVER) preserve order; put_tx_desc reverses it; float_bits preserves IEEE total order on non-NaN, sends every NaN to one value after all others, and round-trips through float_from_bits.
  • src/storage/index/verification.rs (5 harnesses): encode_value per variant — type byte and order for Boolean/Integer/Float/Ref, Null = [0x00], NaN canonical.
  • Cargo.toml: [workspace.lints.rust] unexpected_cfgs check-cfg for cfg(kani), so normal builds don't warn.
  • .github/workflows/kani.yml: runs on PRs touching the encoders, nightly per branch (06:00 main, 18:00 v3; branch chosen from the cron as in grammar-verifier.yml), and on dispatch; a scheduled failure opens/comments on Nightly Kani failure (<branch>).
  • Docs: TEST_COVERAGE.md, CLAUDE.md, CHANGELOG.md [Unreleased] → Tests.

Deviation from the spec

--output-format terse added to the Kani args: Kani 0.68.0 refuses -j without it.

Verification

  • Bench machine, Kani 0.68.0, the workflow's exact args: Complete - 12 successfully verified harnesses, 0 failures, 12 total. 40 s wall, 1.1 GB peak RSS.
  • Mutation check (not committed): one deliberate break per encoder, each of the 12 harnesses fails on its mutation.
  • cargo build (no unexpected cfg warning), cargo clippy --all-features -- -D warnings, cargo fmt --check, cargo test --lib clean.

Decoders, strings, packed pages and the WAL are left out (spec §5): CBMC does not finish on them. The main backport (encode_value harnesses only) follows as a separate PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz

adityamukho and others added 5 commits October 22, 2026 21:34
Twelve #[cfg(kani)] harnesses prove, for every input, that the v8 key
encoders and encode_value keep the order the indexes rely on. Cargo.toml
declares the kani cfg so normal builds do not warn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
@codecov
codecov Bot commented Oct 22, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit e2988bb into v3 Oct 22, 2026
25 of 26 checks passed
@adityamukho
adityamukho deleted the test/627-kani branch October 22, 2026 17:32
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.

1 participant

0