Skip to content

kani: write first #[kani::proof] invariants #6

Open

Description

@utof

Context

The kani CI workflow (`.github/workflows/kani.yml`) and local target (`just verify`) are both wired up and running — the nightly cron succeeded on 2026-04-16. But there are currently zero `#[kani::proof]` annotations in the codebase, so the kani step is effectively a no-op wiring check (it relies on `continue-on-error: true` to stay green).

CLAUDE.md says kani targets "a curated set of `#[kani::proof]` invariants (hashing, path normalization)".

Proposed first proofs

  1. MediaPath normalization idempotence (`crates/core/src/types.rs`) — `normalize(normalize(p)) == normalize(p)` for arbitrary bytes.
  2. MediaPath forward-slash invariant — no backslash appears in a normalized `MediaPath` on any input.
  3. BlakeHash hex round-trip — `parse_hex(to_hex(h)) == h` for all 32-byte hashes (mostly serde sanity, but kani proves it across all inputs).
  4. FileSize arithmetic non-overflow — if we end up with checked arithmetic on `FileSize`, prove it never silently wraps.

When

Phase 9 (hardening + perf) is the natural home. Can be pulled forward if we find a subtle bug kani would catch. No rush — the CI plumbing is ready whenever proofs land.

Acceptance

  • At least one `#[kani::proof]` in `crates/core` passes locally via `just verify`.
  • Remove `continue-on-error: true` from `.github/workflows/kani.yml` once proofs are reliable (so proof regressions actually fail CI).

Activity

  1. added
    type/feature
    on Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions