Skip to content

Kani harnesses: diff hunk range line-zero guard and hunk-number digits - #11911

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/fv-diff-line-math
Nov 1, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/fv-diff-line-math

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #12109 (Kani bounded model checking of ripr decision logic)

Acceptance delta (one sentence): Two #[cfg(kani)] harnesses prove, within a 5-byte input bound, that the production unified-diff hunk parsers never yield a positive span starting at line 0 and accept hunk numbers only from ASCII digits.

Harnesses live in crates/ripr/src/analysis/diff/parse/hunk_kani.rs (declared #[cfg(kani)] mod hunk_kani; in parse.rs); normal builds are unaffected. They call production parse_hunk_number and parse_range.

Harness Property Bounds / assumptions Result
hunk_number_accepts_only_nonempty_ascii_digits parse_hunk_number returns Some only for all-digit input; no panic 4 symbolic ASCII bytes, unwind 8 verified within bounds (2/2 covers hit), ~11s
hunk_range_rejects_positive_span_at_line_zero parse_range Some((s,c)) implies c == 0 || s >= 1 5 symbolic ASCII bytes, unwind 8 verified within bounds (2/2 covers hit), ~100s

Not claimed: usize overflow of start + count. At a 5-byte bound the largest reachable sum is 100000, so the overflow guard in parse_range is unreachable and an overflow assertion could not fail. An earlier revision named the range harness ..._never_overflows and asserted this; it was removed after review.

Non-vacuity: temporarily removing the count > 0 && start == 0 guard in parse_range made the range harness FAIL (assertion failed: count == 0 || start >= 1); reverted. This was a manual experiment during development; the repository has no hosted Kani receipt until the Kani lane (#11787) lands.

Not tractable (removed): full parse_hunk_header (CBMC timeout > 580s on split_whitespace) and parse_range at usize extremes (timeout > 500s in memchr). Not covered: consume_hunk_line counter arithmetic, range overlap, git.rs helpers.

Local checks: cargo fmt --check. cargo xtask precommit not run (host disk space).


Generated by Claude Code

https://claude.ai/code/session_01SvmPmqCNvFAErf575FjLhG


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmqCNvFAErf575FjLhG
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

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: Essentials
  • Run ID: df35ee05-6303-4a97-ac23-156712ddfdb7
Commits

Reviewing files that changed from the base of the PR and between 5046f4c and 6935648.

Files selected for processing: 3
  • changelog.d/11911-fv-diff-hunk-range-kani.md
  • crates/ripr/src/analysis/diff/parse.rs
  • crates/ripr/src/analysis/diff/parse/hunk_kani.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven EffortlessSteven left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (fresh-context reviewer, head 99c3375): REPAIR_REQUIRED

Inspected:

  • Merge base 7eb558f -> head 99c3375. The declared baseRefOid (fa621a3) is NOT an ancestor of this head, so I diffed against the merge base; that three-dot diff matches the 4-file GraphQL file list (1 commit in range).
  • crates/ripr/src/analysis/diff/parse.rs:16-19 (module wiring) and :150-169 (parse_range, parse_hunk_number) at head; crates/ripr/src/analysis/diff/parse/hunk_kani.rs:1-50 (both harnesses) at head.
  • changelog.d/fv-diff-hunk-range-kani.md at head.
  • Cargo.toml [workspace.lints.rust] at merge base and at head (no unexpected_cfgs/check-cfg entry); crates/ripr/Cargo.toml [lints] workspace = true at head.
  • .github/workflows/rust-gates.yml:226-228 ("Strict workspace Clippy" -> cargo clippy --workspace --all-targets -- -D warnings) at fa621a3.
  • xtask/src/policy/changelog_fragments.rs:243-252 (per-entry issue/PR reference rule), :60 (file-naming rule); xtask/src/main.rs:1741 (check_changelog_fragments() inside run_policy_checks(), reached by cargo xtask ci-policy).
  • policy/proof-packs.toml (no Kani pack) and xtask/src (no kani occurrence anywhere).
  • Hosted check runs at head 99c3375, grouped by workflow run id. No prior review exists on this PR.

Blocking:

  • crates/ripr/src/analysis/diff/parse.rs:18 - #[cfg(kani)] mod hunk_kani; introduces a cfg name the workspace never declares. Cargo.toml [workspace.lints.rust] at this head has no unexpected_cfgs entry and no check-cfg list, so rustc's warn-by-default unexpected_cfgs lint fires at parse.rs:18; .github/workflows/rust-gates.yml:228 runs cargo clippy --workspace --all-targets -- -D warnings, which promotes that warning to an error. The required Rust lane fails on this candidate the moment it is not skipped. The repair already exists in this repo: open PR #11624 (head 3dcb5ce) adds exactly unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] } to [workspace.lints.rust], and its commit 517c77c is titled "build: declare cfg(kani) so the proof modules do not warn as unexpected_cfgs". Candidate-attributable: the base tree contains no #[cfg(kani)] attribute anywhere; this PR adds the first one.
  • changelog.d/fv-diff-hunk-range-kani.md:2 - the entry names no issue or PR. xtask/src/policy/changelog_fragments.rs:243-252 rejects any - entry without an issue/PR reference ("names no issue or PR; add (#N) or a link to it"), and that gate runs in the required lane through cargo xtask ci-policy -> run_policy_checks() -> check_changelog_fragments() (xtask/src/main.rs:1741). The file name also departs from the documented <pr-or-issue>-<short-slug>.md convention (changelog_fragments.rs:60): fv-diff-hunk-range-kani.md carries no issue or PR prefix. Sibling PRs #11624 ((#11624)), #11517 ((#10686)), #11415 ((#7415), (#11353)) and #11930 ((#4987)) all carry the reference; this one does not.

Non-blocking:

  • crates/ripr/src/analysis/diff/parse/hunk_kani.rs:44 - the overflow half of hunk_range_exclusive_end_never_overflows is not a discriminator at the stated bound. buf is 5 ASCII bytes (hunk_kani.rs:37), so the largest reachable start is 99999 and the largest reachable start + count is 100000 (no comma) or 1008 (one comma leaves <= 9 for start, <= 999 for count). usize::MAX is unreachable, and assert!(start.checked_add(count).is_some()) holds by arithmetic on the bound, not because of the production guard start.checked_add(count).is_none() at parse.rs:158. A mutant that replaced the guarded checked_add with an unchecked add, or deleted that guard, would still pass at this bound. The other half is discriminating: assert!(count == 0 || start >= 1) (hunk_kani.rs:46) fails if the count > 0 && start == 0 guard at parse.rs:158 is removed. The fragment states both properties in one sentence ("never accepts a span whose exclusive end overflows usize or a positive span at line 0"), so it advertises more than the harness demonstrates; the module doc (hunk_kani.rs:6-8) scopes it more tightly ("inputs are ASCII byte strings of a fixed small length"), so fragment and module doc disagree.
  • crates/ripr/src/analysis/diff/parse/hunk_kani.rs:14-31 - hunk_number_accepts_only_nonempty_ascii_digits is a real discriminator: parse_hunk_number rejects non-digits at parse.rs:165 and the harness asserts Some(value) => text.bytes().all(|b| b.is_ascii_digit()) (hunk_kani.rs:22). The None-branch cover (hunk_kani.rs:26-29) needs a non-digit input and is reachable. The Some-branch cover (hunk_kani.rs:23) requires value > 0, so parse_hunk_number("0") is the one accepted input the cover does not name - consistent with its label, worth stating.
  • No declared proof lane executes this harness. policy/proof-packs.toml has no Kani pack; the analysis-fixture pack covering crates/ripr/src/analysis/** requires cargo test --workspace, cargo xtask fixtures, cargo xtask goldens check, cargo xtask check-fixture-contracts, and a #[cfg(kani)] module is compiled out by all four. xtask/src/ contains no kani reference at all. The proof claim rests entirely on the author's local cargo kani run, which the repository's own automation cannot reproduce. Disclosed gap, not a defect - but it is not repo-established proof.
  • The harness module is not registered in .ripr/traceability.toml nor in any proof pack. I checked the convention against the sibling Kani PRs in flight (#11624, #11843, #11877): none registers a harness file there either, and RIPR-SPEC-0367 requires traceability registration for spec-owned artifacts, not for verification modules no spec owns. Not a finding against this PR.
  • The head is behind main (merge base 7eb558f; main is at fa621a3). The diff is small and self-contained, but a merge must rebase over what landed since 7eb558f.

Not run:

  • No local build, test, clippy, fmt, cargo xtask gate, or cargo kani harness execution was run: the Rust toolchain on this host is not on PATH and the working tree is shared, so I did not build. The unexpected_cfgs analysis is a source reading of Cargo.toml plus .github/workflows/rust-gates.yml:228, not an observed compiler diagnostic; the author's own note in #11912's body ("4 warnings are unexpected_cfgs for cfg(kani)") corroborates the mechanism but is not a receipt from this head.
  • Hosted lanes at head 99c3375 are skipped, not green and not red: this PR is a draft and the Rust lanes arm on the merge-ready label event. Observed: 41244767450 ub-review = success; 41244767484 (Qualify ripr-rs Python Wheel) "clean uv install and useful Python journey", "clean pip install and useful Python journey", "build and inspect Linux x64 wheel", "workflow policy and wheel applicability" = success, "pinned MCP evidence before and after (advisory)" = skipped; CodeRabbit = neutral; GitGuardian Security Checks = success. Skipped: 41244767421 macos-advisory, 41244767428 rust-tests-junit, 41244767449 rust-coverage, 41244767453 (msrv, source-identity, Rust-only feature lane, ci-result, Perl and release proof, vscode), 41244767459 paste matrix, 41244767480 cargo-deny/dependency-review, 41244767490 future-clippy, 41244767552 windows-advisory / -subset / -runner-probe, 41244767579. Not observed on this head: any clippy execution, any Rust test execution, any cargo xtask policy gate, any Kani harness execution. The blocking unexpected_cfgs defect is a source-level defect the hosted head cannot currently expose; it will surface as a red "Strict workspace Clippy" step once this draft leaves draft.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 99c3375c68ad4ce1da9d181cd3df0d10e28ecdc7. Not an approval.

Review blockers: unexpected_cfgs check-cfg for cfg(kani) so the strict
Clippy lane stays clean, and an issue/PR reference plus accurate proof
scope in the changelog fragment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmqCNvFAErf575FjLhG

@EffortlessSteven EffortlessSteven left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (fresh-context reviewer, head 6587beb): REVIEW_INCOMPLETE

Supersedes my earlier review at head 99c3375. The head moved while I was reviewing; this review re-reads the current head and covers the delta.

Inspected:

  • The delta 99c3375 -> 6587beb in full: one commit, "Declare cfg(kani) and fix changelog fragment reference", touching Cargo.toml (+2) and the changelog fragment (renamed, +2/-2). No harness file changed.
  • The current head's Cargo.toml [workspace.lints.rust], crates/ripr/src/analysis/diff/parse.rs:16-19 and :150-169, crates/ripr/src/analysis/diff/parse/hunk_kani.rs:1-50, and changelog.d/11911-fv-diff-hunk-range-kani.md.
  • Re-read at the new head: crates/ripr/src/analysis/diff/parse/hunk_kani.rs:1-16 (module doc and harness names), the cfg(kani) attribute sites, and policy/proof-packs.toml plus xtask/src (no kani reference) to re-confirm the proof-lane position.
  • Hosted check runs at head 6587beb, grouped by workflow run id. The earlier review at 99c3375 remains on the PR; this review states which of its findings are repaired, which still hold and which are now stale.

Blocking:

  • none. Both blocking findings from my review at 99c3375 are REPAIRED at this head.
    • The undeclared cfg(kani) is fixed. Cargo.toml now carries # \cfg(kani)` gates the bounded-model-checking proof modules; Kani sets it, rustc does not know it.followed byunexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }in[workspace.lints.rust]. That is byte-identical to the declaration open PR #11624 carries at head 3dcb5ce9, so rustc's warn-by-default unexpected_cfgslint no longer fires at crates/ripr/src/analysis/diff/parse.rs:18 and.github/workflows/rust-gates.yml:228 (cargo clippy --workspace --all-targets -- -D warnings`) will no longer fail on this candidate.
    • The changelog fragment is fixed. changelog.d/fv-diff-hunk-range-kani.md is renamed to changelog.d/11911-fv-diff-hunk-range-kani.md - satisfying the documented <pr-or-issue>-<short-slug>.md convention (xtask/src/policy/changelog_fragments.rs:60) - and the entry now carries (#11911), satisfying the per-entry issue/PR reference rule at changelog_fragments.rs:243-252 that cargo xtask ci-policy -> run_policy_checks() -> check_changelog_fragments() (xtask/src/main.rs:1741) enforces.

Non-blocking:

  • The overflow overclaim is repaired in the release note, but the harness still carries it. The fragment now reads "...prove, within a 5-byte input bound, that the unified-diff hunk-range parser never accepts a positive span at line 0 and accepts hunk numbers only from ASCII digits. The bound is too small to exercise the usize overflow guard, so overflow is not claimed (#11911)." That is exactly the correction my earlier review asked for, and it is accepted. The source still names the harness hunk_range_exclusive_end_never_overflows and still carries the inline comment "// Downstream start + count arithmetic cannot overflow." above assert!(start.checked_add(count).is_some()); - an assertion that is tautological at this bound, because with buf: [u8; 5] the largest reachable start + count is 100000 (no comma) or 1008 (one comma), far from usize::MAX. The release note is now honest; the harness name and the comment are not. Renaming the harness (for example to hunk_range_rejects_line_zero_spans) and dropping the comment, or raising the bound so the guard at crates/ripr/src/analysis/diff/parse.rs:158 is actually reachable, would close the gap in code as well as in prose.
  • Still holds from my earlier review: the line-0 half of the harness is the genuinely discriminating one. assert!(count == 0 || start >= 1) (hunk_kani.rs:46) fails if the count > 0 && start == 0 guard at crates/ripr/src/analysis/diff/parse.rs:158 is removed; hunk_number_accepts_only_nonempty_ascii_digits (hunk_kani.rs:14-31) is a real discriminator because parse_hunk_number rejects non-digits at parse.rs:165 and the None-branch cover at hunk_kani.rs:26-29 is reachable. The Some-branch cover at hunk_kani.rs:23 requires value > 0, so parse_hunk_number("0") remains the one accepted input the cover does not name - consistent with its label.
  • Still holds from my earlier review: no declared proof lane executes this harness. policy/proof-packs.toml has no Kani pack; the analysis-fixture pack covering crates/ripr/src/analysis/** requires cargo test --workspace, cargo xtask fixtures, cargo xtask goldens check and cargo xtask check-fixture-contracts, and a #[cfg(kani)] module is compiled out by all four. xtask/src/ contains no kani reference at all, so no cargo xtask surface runs it. The proof claim rests entirely on the author's local cargo kani run. Disclosed, but not repo-established proof.
  • Still holds from my earlier review: the harness module is registered in neither .ripr/traceability.toml nor any proof pack, and the sibling Kani PRs in flight (#11624, #11843, #11877) behave the same way, so this is not a finding against this PR.
  • New coordination point, not a defect: this PR, #11912 (head 40e6bda) and #11624 (head 3dcb5ce) now carry a byte-identical two-line Cargo.toml hunk, and open draft PR #11787 adds the same declaration to the same file for the same reason. Four PRs, one hunk. Whichever lands second will need a rebase, and because the hunk is identical rather than conflicting, the resolution is trivial - but one owner should land it and the others should drop the duplicate. Setting [workspace.lints.rust] unexpected_cfgs also replaces the workspace's own check-cfg list; cargo passes feature cfgs separately, so this is additive in practice, but it is still worth landing once.
  • The head is still behind main (the base fa621a3 is an ancestor of this head; the merge base is unchanged from my earlier review), so a merge must rebase over whatever landed since.

Not run:

  • No local build, test, clippy, fmt, cargo xtask gate, or cargo kani harness execution was run: the Rust toolchain on this host is not on PATH and the working tree is shared, so I did not build. The unexpected_cfgs analysis is a source reading of Cargo.toml plus .github/workflows/rust-gates.yml:228; it is not an observed compiler diagnostic.
  • Hosted at head 6587beb: this PR is a Draft, so the Rust lanes are skipped - not green, not red. Observed: 41249151620 "workflow policy and wheel applicability" = success, "build and inspect Linux x64 wheel" = in_progress, "pinned MCP evidence before and after (advisory)" = skipped; 41249151535 ub-review = in_progress; CodeRabbit = neutral; GitGuardian Security Checks = success. Skipped: 41249151537 (Rust-only feature lane, source-identity, Perl and release proof, msrv, ci-result, vscode), 41249151667 macos-advisory, 41249151677 dependency-review and cargo-deny, 41249151681 windows-advisory / -subset / -runner-probe, 41249151691 paste matrix, 41249151777 rust-tests-junit, 41249151796 future-clippy, 41249151797 rust-coverage. Not observed at this head: any clippy execution, any Rust test execution, any cargo xtask policy gate, and any Kani harness execution. That includes the newly added unexpected_cfgs declaration itself: the fix that repairs my blocking finding has not been validated by a compiler, because the lane that would compile it is skipped while the PR is a draft. That is the whole of what remains unverified, and it is why the disposition is REVIEW_INCOMPLETE rather than READY - the source and oracle review is complete and I found no blocking defect.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 6587beb90937f0ec33b123b795f122af9c6a275d. Not an approval.

…ow assert

At the 5-byte bound the usize overflow guard is unreachable, so the
assertion could not fail. Keep the line-0 discriminator under an honest name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmqCNvFAErf575FjLhG

@EffortlessSteven EffortlessSteven left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (fresh-context reviewer, head ef08c71): REVIEW_INCOMPLETE

Consolidated re-review. This supersedes my two earlier reviews on this PR (at heads 99c3375 and 6587beb) and covers the full delta from the head I first reviewed.

Inspected:

  • The full delta 99c3375 -> ef08c71, which is two commits: 6587beb ("Declare cfg(kani) and fix changelog fragment reference") and ef08c71 ("Rename hunk-range harness to what it proves; drop tautological overflow assert"). I read both diffs in full.
  • The complete PR diff at this head, verified against the GraphQL file list and merge base 7eb558f: Cargo.toml (+2), changelog.d/11911-fv-diff-hunk-range-kani.md (+2), crates/ripr/src/analysis/diff/parse.rs (+3), crates/ripr/src/analysis/diff/parse/hunk_kani.rs (+48) - four files, 55 insertions.
  • The current head's crates/ripr/src/analysis/diff/parse/hunk_kani.rs in full, crates/ripr/src/analysis/diff/parse.rs:16-19 and :150-169 (production parse_range and parse_hunk_number), Cargo.toml [workspace.lints.rust], and changelog.d/11911-fv-diff-hunk-range-kani.md.
  • Re-confirmed at this head: policy/proof-packs.toml declares no Kani pack, and xtask/src contains no kani reference at all.
  • .github/workflows/rust-gates.yml:226-228 at fa621a3; xtask/src/policy/changelog_fragments.rs:243-252 and :60; xtask/src/main.rs:1741.
  • Hosted check runs at head ef08c71, grouped by workflow run id.

Blocking:

  • none. Every finding from my first review at 99c3375 is now REPAIRED at this head.
    • The undeclared cfg(kani) is fixed: Cargo.toml [workspace.lints.rust] now carries unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }, byte-identical to the declaration in open PR #11624 at head 3dcb5ce, so rustc's warn-by-default unexpected_cfgs lint no longer fires at crates/ripr/src/analysis/diff/parse.rs:18 and .github/workflows/rust-gates.yml:228 (cargo clippy --workspace --all-targets -- -D warnings) will not fail on this candidate.
    • The changelog fragment is fixed: changelog.d/fv-diff-hunk-range-kani.md is renamed to changelog.d/11911-fv-diff-hunk-range-kani.md, satisfying the documented <pr-or-issue>-<short-slug>.md convention (changelog_fragments.rs:60), and the entry carries (#11911), satisfying the per-entry issue/PR reference rule at changelog_fragments.rs:243-252 that cargo xtask ci-policy -> run_policy_checks() -> check_changelog_fragments() (xtask/src/main.rs:1741) enforces.
    • The overflow overclaim is fixed in the prose and now in the code. The fragment reads "...prove, within a 5-byte input bound, that the unified-diff hunk-range parser never accepts a positive span at line 0 and accepts hunk numbers only from ASCII digits. The bound is too small to exercise the usize overflow guard, so overflow is not claimed (#11911)." And ef08c71 renames the harness from hunk_range_exclusive_end_never_overflows to hunk_range_rejects_positive_span_at_line_zero and deletes both the tautological assert!(start.checked_add(count).is_some()) and the overclaiming comment "// Downstream start + count arithmetic cannot overflow." At the 5-byte bound the largest reachable start + count is 100000, so that assertion could never fail and could not discriminate against a mutant of the guard at crates/ripr/src/analysis/diff/parse.rs:158. Removing it leaves the harness asserting exactly what it can prove. REPAIRED, and this is the substantive form of the fix - a renamed harness and a deleted assertion, not a reworded comment.

Non-blocking:

  • The harness that remains is a genuine discriminator. hunk_range_rejects_positive_span_at_line_zero asserts count == 0 || start >= 1, which fails if the count > 0 && start == 0 guard at crates/ripr/src/analysis/diff/parse.rs:158 is removed; hunk_number_accepts_only_nonempty_ascii_digits asserts Some(value) => text.bytes().all(|b| b.is_ascii_digit()) against a production parse_hunk_number that rejects non-digits at parse.rs:165, and its None-branch cover is reachable via a non-digit input. The Some-branch cover requires value > 0, so parse_hunk_number("0") remains the one accepted input the cover does not name - consistent with its label.
  • No declared proof lane executes this harness, and that has not changed. policy/proof-packs.toml has no Kani pack; the analysis-fixture pack covering crates/ripr/src/analysis/** requires cargo test --workspace, cargo xtask fixtures, cargo xtask goldens check and cargo xtask check-fixture-contracts, and a #[cfg(kani)] module is compiled out by all four. xtask/src/ contains no kani reference at all, so no cargo xtask surface runs it. The proof claim rests entirely on the author's local cargo kani run, which the repository's own automation cannot reproduce. Disclosed in the PR body; not repo-established proof.
  • The harness module is registered in neither .ripr/traceability.toml nor any proof pack. The sibling Kani PRs in flight (#11624, #11843, #11877) behave the same way and RIPR-SPEC-0367 requires traceability registration for spec-owned artifacts rather than for verification modules that no spec owns, so this is not a finding against this PR.
  • Coordination, not a defect: this PR, #11912 (head 40e6bda) and #11624 (head 3dcb5ce) now carry a byte-identical two-line Cargo.toml hunk, and open draft PR #11787 adds the same declaration to the same file for the same reason. Four PRs, one hunk. Because the hunk is identical rather than conflicting, the resolution is trivial, but one owner should land it and the others should drop the duplicate.
  • The head is behind main. The PR's declared base is main at fa621a3, and git merge-base --is-ancestor fa621a32e ef08c71ca exits non-zero - the base is NOT an ancestor of the head. The merge base is 7eb558f, and a merge must rebase over whatever landed since. (This corrects a clause in my review at 6587beb, which asserted the opposite; I withdrew it there and repeat the corrected statement here.)

Not run:

  • No local build, test, clippy, fmt, cargo xtask gate, or cargo kani harness execution was run: the Rust toolchain on this host is not on PATH and the working tree is shared, so I did not build. The unexpected_cfgs analysis is a source reading of Cargo.toml plus .github/workflows/rust-gates.yml:228; it is not an observed compiler diagnostic, and the harness rename and assertion deletion are source reads, not executed proofs.
  • Hosted at head ef08c71: this PR is a Draft, so the Rust lanes are skipped - not green, not red. Observed: 41249629940 "workflow policy and wheel applicability" = in_progress and "pinned MCP evidence before and after (advisory)" = skipped; CodeRabbit = neutral; GitGuardian Security Checks = success. Skipped: 41249629911 cargo-deny and dependency-review, 41249629916 macos-advisory, 41249629918 (msrv, Rust-only feature lane, source-identity, ci-result, vscode, Perl and release proof), 41249629921 windows-advisory / -subset / -runner-probe, 41249629926 rust-tests-junit, 41249629930 paste matrix, 41249629950 future-clippy, 41249630003 rust-coverage. Not observed at this head: any clippy execution, any Rust test execution, any cargo xtask policy gate, and any Kani harness execution. That includes compiler validation of the newly added unexpected_cfgs declaration itself and of the edited harness: the fixes that repair my findings have not been validated by a compiler, because the lane that would compile them is skipped while the PR is a draft. That is the whole of what remains unverified, and it is why the disposition is REVIEW_INCOMPLETE rather than READY - the source and oracle review is complete and I found no blocking defect.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head ef08c71ca7ccf2a5dffce8f350972c7fab833667. Not an approval.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the PR adds Kani harnesses but no ordinary regression test that distinguishes pre-change and post-change behavior; the new proof module is cfg-gated and absent from normal test execution.
  • Confirm the digit-only harness has a discriminating postcondition but no explicit non-vacuity mutation receipt.
  • Confirm the range harness proves rejection of positive spans at line zero only within five ASCII bytes, not the originally claimed usize overflow property.
  • Confirm alternate range parsers or arithmetic helpers were not comprehensively inventoried, so sibling completeness remains unproven.
  • Confirm the PR body claims a Kani proof that exclusive-end usize overflow cannot occur, but the current five-byte harness cannot reach overflow-scale inputs and the changelog explicitly disclaims that claim. Update the PR description to match the reviewed head.

Refuted

  • The current harness proves the line-zero invariant but cannot exercise the usize overflow guard.

Evidence gaps

  • The PR body's non-vacuity experiment is a manual, unreceipted mutation claim; the packet contains no artifact showing the guard-removal run failing and being reverted.
  • The supplied packet lacks completed cargo-test and ripr execution receipts, so compilation and proof behavior remain unconfirmed by available evidence.
  • Model proof intent was rejected by deterministic validation.
  • Execution evidence is incomplete: cargo-test is scheduled without a receipt and ripr failed with exit code 2.
  • The provided packet lacks completed cargo-test and Kani proof receipts, while the ripr sensor failed with exit code 2.

@EffortlessSteven EffortlessSteven changed the title Kani harnesses: diff hunk range arithmetic Kani harnesses: diff hunk range line-zero guard and hunk-number digits Oct 31, 2026
All Kani PRs now carry the byte-identical declaration at the same place
in [workspace.lints.rust] as #11787, so whichever lands first the others
merge cleanly and the key is never defined twice.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmqCNvFAErf575FjLhG

@EffortlessSteven EffortlessSteven left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (fresh-context reviewer, head e879ef3): REVIEW_INCOMPLETE

Inspected:

  • Rebind bundle .tmp-review-rebind/pr-11911.md; head e879ef33db16d37b9a9e29a66c81f8685a8d9284, base ref main @ fa621a32eaf4c3dc6c17119021ea943641696aef, merge base vs current main 7eb558fb4727298c7da10702496c6b2f385f08bd, current main tip a69bf0214f7bd7e0537a1cdd07e95608e5a366e8, draft, mergeable MERGEABLE, mergeStateStatus BLOCKED, no labels. Delta since the previously reviewed head ef08c71ca is one path: Cargo.toml, +2/-2.
  • That delta re-positions the unexpected_cfgs declaration inside [workspace.lints.rust] — it removes the copy that sat lower in the table (with the comment "cfg(kani) gates the bounded-model-checking proof modules; Kani sets it, rustc does not know it.") and adds an identical-semantics copy immediately after unsafe_code = "forbid" (now Cargo.toml:23) with the comment "cfg(kani) is set only by cargo kani (RIPR-SPEC-0370).". The lint name, level = "warn" and check-cfg = ['cfg(kani)'] are unchanged, so this is a placement and comment change with no semantic effect. The resulting table holds exactly one unexpected_cfgs key.
  • Semantic owner and scope, unchanged by the delta: crates/ripr/src/analysis/diff/parse/hunk_kani.rs — hunk_number_accepts_only_nonempty_ascii_digits at :14 and hunk_range_rejects_positive_span_at_line_zero at :36 — gated by #[cfg(kani)] mod hunk_kani; in crates/ripr/src/analysis/diff/parse.rs:18. The production code they target is parse_hunk_number (parse.rs:165) and parse_range (parse.rs:150-169), including the count > 0 && start == 0 guard at parse.rs:158.
  • Merge basis: GitHub test-merge tree c3496c6629a15b7d33a5eb69f2ed65ec5c1fa61d against main tip a69bf0214f7bd7e0537a1cdd07e95608e5a366e8. This check mattered: the branch's previous blob carried the declaration at a different position in the same TOML table, so a careless application could have produced two unexpected_cfgs keys in one table — a TOML duplicate-key parse error that breaks every cargo invocation in the workspace. The merged Cargo.toml carries exactly one entry, and main carries none, so the merge adds exactly the two lines and the hazard is gone.
  • Duplicate-claim survey: I hashed Cargo.toml at the head of all 117 open PRs. Nine carry the byte-identical blob 874fef728 with this exact declaration: #11624, #11787, #11811, #11823, #11843, #11877, #11911, #11912, #11954. This PR is one of the nine, and this delta is what brought it into line with the other eight.

Blocking:

  • None attributable to this candidate, and no regression in the delta. Hosted Rust proof is nevertheless missing at this head, so this cannot be REVIEW_READY: the required context Ripr Rust Small Result is ABSENT at e879ef33d (27 contexts; 17 SKIPPED, 9 SUCCESS, 1 NEUTRAL) and every Rust lane is SKIPPED (source-identity, rust-coverage, future-clippy, cargo-deny, rust-tests-junit, Rust-only feature lane, msrv, ci-result). An absent required check is not a failing check; this PR is a draft with no merge-ready label, so no Rust qualification was dispatched for this head.

Non-blocking:

  • Every finding from the predecessor's review at ef08c71ca remains REPAIRED; the delta touches only Cargo.toml and no artefact those findings were raised against. The check-cfg declaration is present; the changelog fragment remains changelog.d/11911-fv-diff-hunk-range-kani.md carrying (#11911); the harness remains renamed to hunk_range_rejects_positive_span_at_line_zero with the tautological assert!(start.checked_add(count).is_some()) deleted, so the harness now asserts exactly what it can prove at a 5-byte bound. The fragment's own wording ("The bound is too small to exercise the usize overflow guard, so overflow is not claimed") and the body's "Not claimed" section both state the limit explicitly rather than implying it.
  • The surviving harness is a genuine discriminator, and I verified the code rather than trusting the description: hunk_range_rejects_positive_span_at_line_zero asserts count == 0 || start >= 1 (hunk_kani.rs:44), which fails if the count > 0 && start == 0 guard at crates/ripr/src/analysis/diff/parse.rs:158 is removed, and hunk_number_accepts_only_nonempty_ascii_digits asserts Some(value) => text.bytes().all(|b| b.is_ascii_digit()) against a production parse_hunk_number that rejects non-digits at parse.rs:165, with a reachable None-branch cover.
  • One precision note on the surviving harness: the Some-branch kani::cover! requires value > 0, so parse_hunk_number("0") is the one accepted input the cover does not name. That is consistent with the cover's own label, and the predecessor already recorded it; nothing in the delta changes it.
  • Earlier finding that no declared proof lane executes this harness — STILL HOLDS. policy/proof-packs.toml declares no Kani pack; the analysis-fixture pack covering crates/ripr/src/analysis/** requires cargo test --workspace, cargo xtask fixtures, cargo xtask goldens check and cargo xtask check-fixture-contracts, and a #[cfg(kani)] module is compiled out by all four; xtask/src contains no kani reference at all. The proof claim rests entirely on the author's local cargo kani run, which the repository's own automation cannot reproduce. Disclosed in the body; not repo-established proof.
  • Earlier finding that the harness module is registered in neither .ripr/traceability.toml nor any proof pack — STILL HOLDS, and is not a finding against this PR: the sibling Kani PRs in flight behave the same way, and RIPR-SPEC-0367 requires traceability registration for spec-owned artefacts rather than for verification modules that no spec owns.
  • Coordination, not a defect: the shared two-line hunk now has nine owners (listed above) rather than the four the predecessor counted. All nine are byte-identical, so the merge resolution is trivial — whichever lands second rebases and drops the hunk — but one owner should land it and the others should drop the duplicate. Survivor recommendation for the key: #11624 — among the two merge-ready members it is the one whose body is already consistent with the declaration being present ("The workspace unexpected_cfgs lint now declares cfg(kani) so normal builds do not warn"), whereas this PR's own body, #11787's and #11823's still describe the declaration as pending elsewhere. #11787 keeps the distinct surface it owns — .github/workflows/kani.yml, the xtask lane, crates/ripr/src/kani_smoke.rs, RIPR-SPEC-0370 — which is the lane, not the lint key, so it is not a duplicate of the declaration. The other seven members should rebase and drop the hunk, since main carries no unexpected_cfgs entry (verified at a69bf0214).
  • The new comment cites RIPR-SPEC-0370, which does not exist on main; it lands only with the draft #11787. If #11787 is dropped or reworked, the citation dangles. Low impact, but the comment should point at a spec that has landed or drop the reference.
  • The head is still behind main: the declared base fa621a32e is not an ancestor of this head and the merge base is 7eb558fb, so a merge must rebase over whatever landed since. The diff itself is small and self-contained.
  • Merge-loss check (new, positive): the test-merge tree's .ripr/traceability.toml blob is 9cd12b80a2ad6b1f427dd2d90dec684d4822aef6, identical to main's, so the merge drops no live [[behavior]] or fixture registrations.
  • Efficiency: no efficiency concern. The delta adds a lint declaration and reorders two lines in a TOML table; it changes no shipped code path, adds no runtime work, no I/O, no cache and no retained collection. The harnesses are excluded from normal builds by #[cfg(kani)], so there is no compile or run cost outside cargo kani. No magnitude claim needs verifying.

Not run:

  • The Rust toolchain on this host is not on PATH, so no cargo xtask precommit, cargo test, cargo fmt --check, cargo xtask ci-policy, clippy or cargo kani was executed. Every Rust-level statement above comes from reading source at this head, not from execution.
  • Hosted CI at this head did not exercise the Rust lane (all Rust contexts SKIPPED, required context absent), so neither the re-positioned declaration nor the harnesses have hosted compile or test evidence bound to e879ef33d.
  • The CBMC runtimes and the injected-bug result in the body are unverified; there is no hosted CBMC artefact and no local toolchain here.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head e879ef33db16d37b9a9e29a66c81f8685a8d9284. Not an approval.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 1, 2026 06:41
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW_READY

Head reviewed: 5258e5a. Static review against RIPR-SPEC-0371; I did not run cargo xtask kani or inspect hosted checks.

Soundness. Both harnesses call the real parse_hunk_number / parse_range on symbolic ASCII (4 and 5 bytes, explicit assume(< 128), stated in the header). hunk_range_rejects_positive_span_at_line_zero asserts count == 0 || start >= 1 against production's (count > 0 && start == 0) rejection, with covers on both an accepted non-empty range and the accepted empty 0,0 range, so it is not vacuous (0,0 and 1,1 fit in 5 bytes). The changelog explicitly disclaims the checked_add overflow guard ("bound too small to exercise it, overflow is not claimed"), which is the honest statement.

Nit (non-blocking). hunk_number_accepts_only_nonempty_ascii_digits is named for non-emptiness, but the buffer is a fixed 4 bytes, so the empty string is never explored and the assertion is only "accepted ⇒ all ASCII digits". Production's raw.is_empty() guard happens to be redundant with "".parse::<usize>() failing, so there is no behavioral gap, but either rename (..._accepts_only_ascii_digits) or add a symbolic length so emptiness is actually in scope. The changelog wording ("only from ASCII digits") is accurate as is.

Leftover spec refs. None (0370 absent).


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the digit harness has a discriminating accepted-input postcondition but its rejection-path cover does not ensure every non-digit string is rejected.
  • Confirm the digit harness's fixed four-byte input cannot distinguish the empty-string behavior from the stated nonempty claim.
  • Confirm the PR contains no ordinary regression test that fails before the change and passes after it.
  • Confirm the digit harness proves accepted implies every byte is ASCII-digit, but its fixed four-byte buffer cannot exercise the empty-string path despite its name.
  • Confirm the digit harness covers only fixed-length four-byte input, so its name implies nonempty coverage that is not exercised.

Evidence gaps

  • The scheduled cargo-test receipt is absent, and the repository ripr sensor failed with exit code 2.
  • Model proof intent was rejected by deterministic validation.
  • The manual non-vacuity experiment and bounded Kani claims remain unreceipted in the supplied evidence.
  • The packet contains a manual non-vacuity claim but no hosted Kani receipt or mutation artifact; the failed ripr sensor and absent cargo-test receipt do not prove either harness.
  • No automated cargo-test or Kani receipt is available in the packet to confirm the harnesses compile and remain discriminating.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW_READY — head 6935648

Delta since my last reviewed head 5258e5a: merge-of-main only; PR-owned files byte-identical, so the earlier review carries forward. Admission: the body says "Governing issue or accepted claim: new (formal verification of own code)", which has no #N. Link or file the Kani formal-verification claim issue before applying merge-ready. Hosted: no Ripr Rust Small Result on this exact head yet, so merge waits on it.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Governing claim and deferred claim boundaries for this PR are tracked in #12109. Deferred items are listed there so they are not dropped; merge-ready was applied with the admission already passed on this head.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the digit harness name claims nonempty coverage, but its fixed four-byte buffer can never represent the empty string; the proven postcondition is only accepted implies all ASCII digits.
  • Confirm the digit harness name mentions nonempty input, but its fixed four-byte buffer cannot represent the empty string; the assertion still proves only accepted implies all ASCII digits.
  • Confirm the digit harness name claims nonemptiness, but its fixed four-byte buffer cannot represent an empty input.
  • Confirm the stated range property is correctly bounded to positive spans at line zero, and the changelog explicitly avoids claiming that the five-byte bound exercises usize overflow.
  • Confirm rename hunk_number_accepts_only_nonempty_ascii_digits to hunk_number_accepts_only_ascii_digits, or add a separately bounded empty-input case; the current proof cannot reach the empty string.

Refuted

  • The digit harness name claims nonempty coverage, but its fixed [u8; 4] input never represents the empty string, so the proof establishes only accepted implies all ASCII digits.

Parked follow-ups

  • The proof scope is deliberately narrow: four- and five-byte inputs, explicit overflow disclaimer, and no coverage of other range parsers or counter arithmetic.

Evidence gaps

  • The bounded properties have no executable Kani or mutation receipt in the supplied packet; the PR body's manual mutation is explicitly described as unreceipted.
  • Model proof intent was rejected by deterministic validation.
  • No hosted Kani receipt or deterministic mutation witness is supplied, so the manual non-vacuity experiment remains unverified.
  • The supplied evidence contains no completed Kani or mutation-witness artifact for either harness, so execution and non-vacuity remain manual claims rather than independently reviewable receipts.

@EffortlessSteven
EffortlessSteven merged commit 703cf40 into main Nov 1, 2026
64 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/fv-diff-line-math branch November 1, 2026 10:13
EffortlessSteven added a commit that referenced this pull request Nov 6, 2026
…count claim (#11621) (#13338)

The slim section of docs/interop/mcp.md now states ten outputSchema
documents (#11911 added the tenth tool after #11943 wrote nine) and
carries the measured wire sizes (45,424 B full / 16,710 B slim over
stdio); a new guard test reads the sentence back against the live
payload (RED at base: docs said nine, tools/list advertises 10). The
recorded $defs/$ref factoring rejection in mcp/protocol.rs is refreshed
with today's arithmetic: cross-document duplication is ~870 B x 10 tools
(~8.7 KB), still semantically blocked for standalone validators;
per-document factoring measures a net loss (28,554 -> 28,633 B), largest
repeated object 61 B x 2. The Full defaults stay; the flip question is
re-surfaced for the owner in the PR body with numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants