Skip to content

test(lsp): Kani proofs for diagnostic budget limits and refresh generations - #11877

Merged
EffortlessSteven merged 7 commits into
mainfrom
claude/fv-lsp-budget-refresh
Nov 1, 2026
Merged

EffortlessSteven merged 7 commits into
mainfrom
claude/fv-lsp-budget-refresh

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): LSP diagnostic-budget limits and refresh-generation currency are now checked by Kani bounded model checking (cfg(kani) only; normal builds unaffected).

Production refactor (behavior unchanged): budget rule extracted into scalar-only BudgetCursor::decide/commit (called by evaluate_diagnostic_budget); generation rules extracted into bump_generation / generation_is_current (called by every scheduler transition). evaluate_diagnostic_budget itself (Strings, BTreeMap/BTreeSet, sort) is not Kani-tractable, and the mutex-guarded RefreshScheduler state is not tractable either; the pure cores are proven instead.

Run: cargo kani -p ripr --default-unwind 6 --harness <name>.

Harness Property Bounds / assumptions Result Runtime
budget_item_limits_hold_over_walk per-document and workspace item limits hold at every step; count omissions only when limit reached 4-item walk, 2 docs, limits in 1..=3, arbitrary payloads proven within bounds 1.2s
budget_bytes_never_exceed_limit_or_wrap byte total exact (no wrap); limit exceeded only by a lone first item, which is flagged 4 items, arbitrary usize payloads, max_serialized_bytes < usize::MAX proven within bounds 2.1s
budget_inline_detail_flag_is_exact inline-detail omission flag iff detail > limit arbitrary usize proven 0.2s
budget_validate_accepts_only_sane_limits validate() Ok implies non-zero limits and doc limit <= workspace limit all usize proven 0.1s
generation_counter_is_monotonic bump never decreases; +1 below u64::MAX all u64 proven <0.1s
generation_counter_saturates_at_max documents saturation at u64::MAX - proven (states a limit) <0.1s
stale_generation_never_current_after_bump stamped generation not current after 1..=3 bumps stamped < u64::MAX-3 proven within bounds 0.1s
only_newest_generation_is_current_and_stop_blocks_all at most the newest generation is current; stopping blocks all all u64 with a<b<=newest proven <0.1s

Non-vacuity: every harness has satisfied kani::cover!s. Injected bugs (reverted): changing document_count >= to > made budget_item_limits_hold_over_walk FAIL; changing newest == generation to >= made stale_generation_never_current_after_bump and only_newest_generation_is_current_and_stop_blocks_all FAIL.

Findings: (1) a max_serialized_bytes of exactly usize::MAX lets the saturating sum clamp so the true sum can exceed the limit (unreachable 18 EB budget; excluded by assumption, documented). (2) At u64::MAX the generation counter saturates, so a stale generation would look current (needs 2^64 requests; documented by a harness). Neither warrants an issue.

Not run: full cargo xtask precommit and the lib test binary (build OOM/disk-killed on this host); cargo check -p ripr and cargo fmt --check pass. unexpected cfg kani warnings are expected until check-cfg lands from the sibling lane.


Generated by Claude Code

…ations

Factor the budget rule into BudgetCursor and the generation rules into
bump_generation/generation_is_current (behavior unchanged) so they are
formally checkable.

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: fa310091-89d5-44b1-b010-2287ea5c149a
Commits

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

Files selected for processing: 5
  • changelog.d/11877-fv-kani-lsp-budget-refresh.md
  • crates/ripr/src/lsp/diagnostic_budget.rs
  • crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs
  • crates/ripr/src/lsp/refresh_scheduler.rs
  • crates/ripr/src/lsp/refresh_scheduler/kani_proofs.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 60ebcd3): REPAIR_REQUIRED

Inspected:

  • The whole diff: crates/ripr/src/lsp/diagnostic_budget.rs (+65/-6), crates/ripr/src/lsp/refresh_scheduler.rs (+21/-7), the two new proof files crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs (171 lines) and crates/ripr/src/lsp/refresh_scheduler/kani_proofs.rs (73 lines), and the new changelog.d/fv-kani-lsp-budget-refresh.md. I fetched both blobs (head 60ebcd35, base 9bfac376) and diffed them myself; the PR's single commit is 60ebcd35.
  • Head source read at: BudgetDecision and BudgetCursor::decide/commit in diagnostic_budget.rs, the rewritten evaluate_diagnostic_budget walk, #[cfg(kani)] mod kani_proofs; at diagnostic_budget.rs:783, bump_generation and generation_is_current in refresh_scheduler.rs and their call sites, and every harness in both proof files.
  • Repo gates read at this base: .github/workflows/rust-gates.yml:246 ("Strict workspace Clippy": cargo clippy --workspace --all-targets -- -D warnings) and :219 (cargo xtask ci-policy); .github/workflows/routed-rust.yml:469 (cargo xtask precommit); the root Cargo.toml [workspace.lints.rust] block (L21-34); xtask/src/main.rs:641 (check_no_panic_family()) and :730 (check_changelog_fragments()); xtask/src/policy/all.rs:7-13; xtask/src/no_panic.rs:21, :191-203 (forbidden_panic_patterns), :330-353 (collect_semantic_panic_findings), :614-639 (evaluate_semantic_no_panic_policy); xtask/src/policy/changelog_fragments.rs:162-203, :249, :404-412, :417-439.
  • policy/no-panic-allowlist.toml at head 60ebcd35 (1285 lines) and the changelog fragment at head.
  • Sibling PRs: #11787 (claude/fv-infrastructure, draft, head c509253e) and #11517 (codex/kani-source-context, draft), both open and both owning Kani-adjacent surface.
  • Hosted proof: REST commits/60ebcd35/check-runs.

Blocking:

    1. This head cannot pass the repo's required Clippy gate. crates/ripr/src/lsp/diagnostic_budget.rs:783 and the matching declaration in crates/ripr/src/lsp/refresh_scheduler.rs are #[cfg(kani)], and the root Cargo.toml at this PR's base 9bfac376 has no check-cfg and no unexpected_cfgs setting anywhere in its 219 lines; the workspace rust lint block (L21-34) lists only unsafe_code, const_item_interior_mutations, function_casts_as_integer, unused_must_use and unsafe_op_in_unsafe_fn. cfg(kani) is therefore an unrecognised cfg name, so rustc's warn-by-default unexpected_cfgs lint fires on both attributes, and the required hosted gate at .github/workflows/rust-gates.yml:246 runs cargo clippy --workspace --all-targets -- -D warnings, which promotes that warning to an error. The owning fix is unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }, and that line exists only in the head of draft PR #11787 (c509253e); it is absent from #11787's own base 8f0e1b08 and from main's tip 515e7dbc. The PR body acknowledges the warnings and defers them to "the sibling lane", which leaves this head red until #11787 lands and this branch rebases, and #11787 is not declared as a stack parent here.
    1. The new changelog fragment names no issue or PR. changelog.d/fv-kani-lsp-budget-refresh.md has one bullet under <!-- section: Added --> and contains no #N, no /issues/N and no /pull/N token at all. xtask/src/policy/changelog_fragments.rs requires an issue or PR reference per entry - the violation text at L249 is "entry {} names no issue or PR; add (#N) or a link to it", and has_issue_reference (L417-439) accepts only a # followed by digits as its own token or a /issues/N or /pull/N marker. The identical rule text is present at this PR's base. cargo xtask precommit calls check_changelog_fragments() (xtask/src/main.rs:730) and CI runs cargo xtask precommit (.github/workflows/routed-rust.yml:469), so this is an enforced gate. The filename fv-kani-lsp-budget-refresh does satisfy is_kebab_slug (L404-412); only the missing reference is at fault. Sibling fragments in this campaign do carry the reference (for example changelog.d/10174-mock-count-paths.md uses (#10174)), so the convention is established.
    1. The new proof file contains an unallowlisted panic-family call. crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs:66 reads OmittedDiagnosticReason::ProfileFiltered => unreachable!(),. unreachable! is one of the forbidden panic-family patterns (xtask/src/no_panic.rs:191-203). The semantic scanner walks every .rs file under crates/ripr/src (no_panic.rs:21, collect_semantic_panic_findings L330-353) and parses it with ra_ap_syntax to find real MacroCall nodes, with no cfg-based exclusion, so a #[cfg(kani)] module is scanned like any other file. evaluate_semantic_no_panic_policy (no_panic.rs:614-639) turns any finding with no matching allowlist entry into a violation ("contains unallowed panic-family 'unreachable'; add exact allowlist entry with explanation"), and policy/no-panic-allowlist.toml at head 60ebcd35 contains no entry for this path (no kani or lsp match in 1285 lines). cargo xtask precommit calls check_no_panic_family() (xtask/src/main.rs:641) and cargo xtask ci-policy reaches it through check_policy_all() (xtask/src/policy/all.rs:12-13); both run in hosted CI. Replacing the arm with an explicit handling of the unreachable variant, or adding a scoped allowlist entry with an explanation, keeps the proof honest either way.

Non-blocking:

  • The production refactor is behaviour-preserving on every path I could trace, which is the main thing a test-only-proof PR can get wrong. In evaluate_diagnostic_budget the base branch if selected_bytes.saturating_add(payload) > limit { insert overflow; if !selected.is_empty() { omit; continue } } maps exactly onto decide's byte_overflow && self.selected_len != 0 omission plus its Select { byte_overflow } arm, which still records the SerializedByteLimit overflow reason; selected.is_empty() and cursor.selected_len == 0 agree because commit increments the counter exactly once per selected item; inline_detail_omitted is still computed only on the select branch; and selected_bytes keeps its saturating addition in commit. bump_generation is saturating_add(1) and generation_is_current is !stopping && newest == generation, each identical to the inlined expression it replaces.
  • The proofs establish safety but not liveness, and that distinction should be stated rather than implied. budget_item_limits_hold_over_walk asserts count identities (selected_len == per_doc[0] + per_doc[1], selected_len + omitted == STEPS) and per-limit bounds, all of which still hold for a decide that omitted every item, so no harness requires an eligible item to be selected. The kani::cover! lines are coverage markers, not assertions. The other harnesses are sound for what they claim: budget_inline_detail_flag_is_exact asserts the flag equals detail > max_inline_detail_bytes exactly, and stale_generation_never_current_after_bump and only_newest_generation_is_current_and_stop_blocks_all fail if the currency predicate is loosened.
  • Two limits are stated honestly rather than assumed away, which is the right shape: budget_bytes_never_exceed_limit_or_wrap excludes max_serialized_bytes == usize::MAX with an explicit kani::assume and a comment explaining the saturating-clamp case, and generation_counter_saturates_at_max pins the u64::MAX saturation limit and the comment says the stale-result proofs therefore assume generation < u64::MAX.
  • Nothing on this head compiles or executes the proofs. #[cfg(kani)] is off in a normal build and the kani lane that would run them belongs to the unlanded draft #11787, so a type error or typo inside either kani_proofs.rs would not be caught by this PR's own CI. The PR's central claim - formal verification of its own code - therefore has no executed evidence anywhere at this head.
  • The PR is a draft with no labels, so the routing workflow never admitted it: on 60ebcd35 every Rust lane (ci-result, future-clippy, msrv, source-identity, rust-tests-junit, rust-coverage, Rust-only feature lane, windows-advisory, windows-advisory-subset, macos-advisory, vscode) is skipped and there is no "Rust gates" or test-shard check at all.
  • There is no duplication hazard between this PR and the open Kani siblings: #11787 owns the CI lane and the check-cfg line, #11517 owns source-context inventory, and this PR owns the LSP budget and generation proofs. The deciding criterion for the check-cfg dependency is that #11787 is the survivor, so the cleanest repair is for this PR to land the one-line check-cfg itself or to declare and rebase onto #11787 rather than to compete with it.

Not run:

  • No local build or test: the Rust toolchain on this host is not on PATH, so cargo fmt --check, cargo xtask precommit, cargo xtask ci-policy, cargo clippy --workspace --all-targets -- -D warnings and cargo kani were not executed. The PR body itself records that full cargo xtask precommit and the lib test binary could not be run on its host, which is consistent with the three gate failures above not having been caught locally.
  • Hosted lanes observed on 60ebcd35 (REST commits/60ebcd35/check-runs): "workflow policy and wheel applicability" SUCCESS, "build and inspect Linux x64 wheel" SUCCESS, "clean uv install and useful Python journey" SUCCESS, "clean pip install and useful Python journey" SUCCESS, "ub-review" SUCCESS, "GitGuardian Security Checks" SUCCESS; every Rust lane skipped.
  • Unobserved: all Rust proof for this head, and any execution of the two Kani harnesses. No cargo kani lane exists in this repository at this commit.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 60ebcd35d5be26e3b134665a4ab5ba44860cbde4. 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
The no-panic-family policy scans cfg(kani) modules too. kani::assert(false)
keeps the same meaning: the proof fails if the arm is reachable.

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 7c1a7ce): REVIEW_INCOMPLETE

Inspected:

  • PR #11877 at head 7c1a7ce (base 9bfac37). It is still a Draft with no labels, so every Rust lane reports skipped at this head and no hosted lane has ever run on it. Changed paths: Cargo.toml +2/-0, changelog.d/11877-fv-kani-lsp-budget-refresh.md +2/-0, crates/ripr/src/lsp/diagnostic_budget.rs +102/-37, crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs +174/-0, crates/ripr/src/lsp/refresh_scheduler.rs +21/-5, crates/ripr/src/lsp/refresh_scheduler/kani_proofs.rs +72/-0.
  • The head moved under me while I was reviewing. The previously reviewed head was 022f886, and 7c1a7ce is "Replace unreachable! in the budget Kani harness with kani::assert", one commit, +5/-1 in crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs.
  • crates/ripr/src/lsp/diagnostic_budget.rs at 7c1a7ce: BudgetCursor at :194, decide at :202, commit at :235, production use at :271, :286 and :311, #[cfg(kani)] mod kani_proofs at :783-784, #[cfg(test)] mod tests at :786-787. crates/ripr/src/lsp/refresh_scheduler.rs: bump_generation at :191, generation_is_current at :197, production call sites at :358, :463, :482 and :501, #[cfg(test)] next_generation_for_test at :604-611, #[cfg(kani)] mod kani_proofs at :614-615, #[cfg(test)] mod tests at :617-618. crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs:69 now reads kani::assert(false, "budget cursor never omits for profile filtering") inside the #[kani::proof] harness budget_item_limits_hold_over_walk at :40-83.
  • xtask/src/no_panic.rs:191-203 forbidden_panic_patterns() and the semantic scanner's file collection, and policy/no-panic-allowlist.toml at this head.
  • Root Cargo.toml at this head: [workspace.lints.rust] at :21 and unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] } at :31, with the explanatory comment at :30. changelog.d/11877-fv-kani-lsp-budget-refresh.md carries the (#11877) reference.

Blocking:

  • No candidate defect is blocking, and I withdraw the one I raised against the previous head. It is repaired, verified by reading the new commit rather than by inference: crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs:69 replaces the unallowlisted unreachable!() with kani::assert(false, "budget cursor never omits for profile filtering"), which is the idiomatic Kani form and sits inside the #[kani::proof] harness at :40-83 where kani::assert is legal. unreachable! is in xtask/src/no_panic.rs:191-203 forbidden_panic_patterns(), and policy/no-panic-allowlist.toml at this head has no entry for kani, diagnostic_budget or refresh_scheduler, so the previous red is gone rather than allowlisted around. I scanned all four changed Rust files for the six forbidden patterns (unwrap(, expect(, panic!, todo!, unimplemented!, unreachable!) and found none, so no new no-panic finding exists either.
  • The disposition is nevertheless not REVIEW_READY, for a reason that is not a defect: the PR is still a Draft with no labels, so every Rust lane reports skipped and no hosted lane has ever run at this head. Per the shared brief a Draft PR can never be REVIEW_READY, and hosted proof is therefore not established, which is REVIEW_INCOMPLETE.

Non-blocking:

  • Earlier blocking #1 REPAIRED: the Clippy unexpected_cfgs red is answered by Cargo.toml:31 adding check-cfg = ['cfg(kani)'], with the comment at :30 explaining that Kani sets the cfg and rustc does not. The key sits in [workspace.lints.rust], so it applies to every workspace member including xtask.
  • Earlier blocking #2 REPAIRED: the fragment is now changelog.d/11877-fv-kani-lsp-budget-refresh.md and its body carries (#11877). The name satisfies the repository's kebab-slug convention and the issue-reference requirement.
  • The proof harnesses are never compiled or executed by any hosted lane at this head. Both modules are gated behind #[cfg(kani)] (diagnostic_budget.rs:783-784, refresh_scheduler.rs:614-615) and no workflow under .github/workflows invokes cargo kani at 7c1a7ce, so nothing in CI type-checks or runs the 246 lines of harness code this PR adds. The sibling PR #11787 (Draft, head ae52017) is titled "feat(ci): Kani bounded-model-checking lane and smoke harness (RIPR-SPEC-0367)" and adds .github/workflows/kani.yml (+70) and xtask/src/kani_lane.rs (+532), so the lane that would exercise these proofs is owned there. Until it lands, the harnesses are unverified by CI. That is a property of the missing lane, not a defect in the harnesses.
  • One direct discriminator is missing for the extracted predicate. generation_is_current (refresh_scheduler.rs:197) is called only from production code at :501 and no ordinary test calls it, so its only direct checks are the Kani harnesses stale_generation_never_current_after_bump and only_newest_generation_is_current_and_stop_blocks_all. The budget side is better covered: seventeen ordinary tests in diagnostic_budget.rs's #[cfg(test)] mod tests call evaluate_diagnostic_budget (:1183, :1194, :1228, :1268, :1295, :1415), including document_and_byte_limits_record_each_omission, first_item_over_byte_budget_stays_selected_and_marks_overflow and profile_filtered_items_never_consume_the_budget, so the BudgetCursor extraction is exercised by CI-compiled tests even though its own call sites are production-only. bump_generation does have a test-only entry point at refresh_scheduler.rs:604-611.
  • Duplicate ownership to settle before this can land cleanly: #11787 also adds the same key to the same table. Its Cargo.toml patch inserts unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] } immediately after unsafe_code = "forbid" in [workspace.lints.rust], while this PR inserts it at Cargo.toml:30-31 after unsafe_op_in_unsafe_fn. Two open PRs writing the same key into the same TOML table will conflict on merge, and a resolution that keeps both copies is a TOML duplicate-key parse error that breaks every cargo invocation in the workspace. Deciding criterion: exactly one PR may own the workspace-wide lint key, whichever lands first keeps it and the other rebases and drops its copy. I name #11787 as the natural owner only because it carries the lane that makes cfg(kani) meaningful end to end, not because its scope is wider.
  • Efficiency: neutral. The refactor moves the budget rule into a small pure helper that production calls once per eligible item (diagnostic_budget.rs:286 decide, :311 commit) and the generation rule into two pure functions; it introduces no new I/O, no process spawn, no cache and no retained collection, and it does not change how many times the existing budget walk runs. The harness code is compile-time-only work under cfg(kani). The one thing worth watching is that decide now returns a decision object per item instead of deciding inline, which is one small enum construction per eligible diagnostic: a constant-factor allocation on a path sized by the number of diagnostics in a response, not a growth-rate change. I did not profile it and therefore state the cost as unestablished rather than quantified.

Not run:

  • The Rust toolchain on this host is not on PATH: rustc, cargo and rustup are absent from PATH, so cargo xtask precommit, cargo test, cargo fmt --check, clippy and cargo xtask check-no-panic-family could not be run, and the shared checkout was not built while other agents hold it. Every Rust-level statement above comes from reading source at SHA 7c1a7ce and from the repository's policy files.
  • cargo kani was not run, for the same reason, so the harnesses are unexecuted here and their proof status is unestablished. I verified only that they are consistent with the surrounding code and that no lane compiles them.
  • No hosted lane ran on this head: because the PR is a Draft with no labels, every run at 7c1a7ce reports skipped (CI, Coverage, macOS Advisory, Windows Advisory, Future Clippy, Test Analytics, Security) and the only non-skipped runs are ub-review and Qualify ripr-rs Python Wheel, which say nothing about the Rust lanes. The repository's own CI therefore contributes no evidence either way for this candidate.

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

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

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

Verification questions

  • Confirm the byte proof's exact-sum assertion is weaker than its comment claims because selected_bytes is saturated while exact is a u128 total.
  • Confirm the refresh helper extraction is routed through every changed scheduler transition, but the requested and invalidation methods still increment the counter only after their existing early-return paths, so proof coverage of all transition sequences is not established.
  • Confirm the budget proof assumes max_serialized_bytes < usize::MAX, while production validation accepts usize::MAX; the stated invariant that byte totals never exceed the limit therefore does not cover every accepted budget.
  • Confirm the byte-budget harness does not assert the stated byte-limit invariant for a lone first selected item; it only checks that selected item's payload exceeds the limit after selection.
  • Confirm the Kani harness models budget decisions with symbolic payload lengths but does not exercise an actual backing-store resize or stale-length snapshot.
  • Confirm the budget helper is a scalar-only boundary consumed by the production walk, but its harness does not prove end-to-end equivalence with the previous walk over collections and item metadata.
  • Confirm the proof files cover the extracted scalar helpers but do not establish parity across other diagnostic-budget or generation-like routes elsewhere in the repository.

Evidence gaps

  • The PR's formal-verification claim is not backed by a completed lane receipt in the supplied evidence.
  • Normal-build and test behavior lacks a completed receipt: ripr failed with exit code 2, and cargo-test was scheduled late without a supplied receipt.
  • Independent execution evidence is incomplete in this packet because ripr failed and cargo-test receipt is absent.
  • Model proof intent was rejected by deterministic validation.
  • The review lacks completed cargo-test evidence and the ripr sensor failed with exit code 2, limiting verification of behavior and resource impact beyond the bounded harnesses.

@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 fea3d28): REVIEW_INCOMPLETE

Inspected:

  • Rebind bundle .tmp-review-rebind/pr-11877.md; head fea3d2890637dfcb807c5ef87efa22eff8a955d7, base 9bfac376cb7d0e1f036bd05f0451848945d1d019, draft, mergeable MERGEABLE, mergeStateStatus BLOCKED, no labels, rollup SUCCESS. Delta since the previously reviewed head 7c1a7ce6d 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 after unsafe_op_in_unsafe_fn (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/lsp/diagnostic_budget.rs (BudgetCursor::decide/commit, and the #[cfg(kani)] mod kani_proofs; declaration), crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs (harnesses at :42, :90, :135, :157), crates/ripr/src/lsp/refresh_scheduler.rs (bump_generation, generation_is_current, and its #[cfg(kani)] mod kani_proofs; declaration), and crates/ripr/src/lsp/refresh_scheduler/kani_proofs.rs. The production code they target is evaluate_diagnostic_budget and the scheduler's generation transitions.
  • Merge basis: GitHub test-merge tree e66a9005e657b02c89b59b5c9c41a9e8c43acacc 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 fea3d2890 (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:

  • Earlier blocking finding 1 (the #[cfg(kani)] declarations at diagnostic_budget.rs:783 and refresh_scheduler.rs:614 would trip unexpected_cfgs under the required cargo clippy --workspace --all-targets -- -D warnings gate) — REPAIRED, and still repaired at this head: Cargo.toml:23 declares cfg(kani), and I confirmed in the merge result that exactly one such declaration exists.
  • Earlier blocking finding 2 (the changelog fragment named no issue or PR) — REPAIRED, and still repaired: the fragment remains changelog.d/11877-fv-kani-lsp-budget-refresh.md and its body carries (#11877), which satisfies has_issue_reference in xtask/src/policy/changelog_fragments.rs.
  • Earlier blocking finding 3 (the unallowlisted unreachable!() at diagnostic_budget/kani_proofs.rs:66) — REPAIRED, and still repaired: the current head uses kani::assert(false, ...) inside the harness, and I scanned the changed Rust files for the forbidden panic-family patterns and found no unwrap(, expect(, panic!, todo!, unimplemented! or unreachable!.
  • Earlier finding about duplicate ownership of the workspace lint key — STILL HOLDS as a coordination point, but the severity has dropped because this delta removes the mechanism that made it dangerous. The predecessor warned that #11787 and this PR inserted the same key into the same TOML table at different positions, so a merge resolution keeping both copies would be a duplicate-key parse error. Both now write the byte-identical blob 874fef728, so no such resolution is possible; whichever lands second rebases and drops the hunk. 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, whereas #11787 is a draft whose body says the check-cfg is "intentionally left to another change". #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). This supersedes the predecessor's naming of #11787 as the key owner: that choice was made while the copies still differed, and lane ownership no longer discriminates the key now that all nine are byte-identical.
  • New: the body is stale against its own head. It ends "Not run: ... unexpected cfg kani warnings are expected until check-cfg lands from the sibling lane." The check-cfg declaration is this head's Cargo.toml:23; there is no sibling lane left to wait for on that point, and cargo check -p ripr will not emit that warning at this head.
  • Earlier finding that the proof harnesses are never compiled or executed by any hosted lane — STILL HOLDS. Both modules are gated behind #[cfg(kani)] and no workflow under .github/workflows invokes cargo kani at this head; the sibling #11787 (draft) is where that lane lives. So the 246 lines of harness code this PR adds have no CI type-check or execution evidence.
  • Earlier finding that generation_is_current has no ordinary test discriminator — STILL HOLDS. It is called only from production code, so its only direct checks are the Kani harnesses stale_generation_never_current_after_bump and only_newest_generation_is_current_and_stop_blocks_all. The budget side is better covered: the #[cfg(test)] mod tests in diagnostic_budget.rs exercises evaluate_diagnostic_budget with seventeen ordinary tests, so the BudgetCursor extraction is covered by CI-compiled tests even though its own call sites are production-only.
  • Earlier finding that the proofs establish safety but not liveness — STILL HOLDS and should stay stated. budget_item_limits_hold_over_walk asserts count identities and per-limit bounds that would still hold for a decide that omitted every item; the kani::cover! lines are coverage markers, not assertions.
  • The two limits the body states are stated honestly, which is the right shape: budget_bytes_never_exceed_limit_or_wrap excludes max_serialized_bytes == usize::MAX with an explicit kani::assume and a comment explaining the saturating-clamp case, and generation_counter_saturates_at_max pins the u64::MAX saturation limit. Both are disclosed limits, not silent gaps.
  • 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.
  • 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: still neutral, and the delta does not change that. The delta adds a lint declaration and reorders two lines in a TOML table; it changes no shipped code path, adds no I/O, no process spawn, no cache and no retained collection, and it does not change how many times the existing budget walk runs. The one cost the predecessor flagged still stands as unquantified: decide now returns a decision object per eligible item instead of deciding inline, which is one small enum construction per eligible diagnostic — a constant-factor allocation on a path sized by the number of diagnostics in a response, not a growth-rate change. I did not profile it, so I state the cost as unestablished rather than quantified. The harness code is compile-time-only work under cfg(kani).

Not run:

  • The Rust toolchain on this host is not on PATH, so no cargo xtask precommit, cargo test, cargo fmt --check, cargo xtask check-no-panic-family, 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 fea3d2890.
  • The CBMC runtimes and injected-bug failures 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 fea3d2890637dfcb807c5ef87efa22eff8a955d7. 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.

REPAIR_REQUIRED

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

Production refactor: behavior-preserving (checked line by line). BudgetCursor::decide/commit reproduce the old order (document limit, workspace limit, byte limit with the lone-first-item exception, then inline detail), the same saturating_adds, and selected.len() becomes cursor.selected_len which is incremented on exactly the select path. bump_generation / generation_is_current are the old expressions extracted. Existing unit tests still cover the walk.

Finding 1 (must fix): the changelog states properties the proofs exclude. The entry says serialized-byte limits "never wrap" and "a result stamped with an older generation is never current". The harnesses prove less, and the author knows it:

  • budget_bytes_never_exceed_limit_or_wrap assumes max_serialized_bytes < usize::MAX; the comment records that the proof itself found the saturating sum can clamp to the limit at exactly usize::MAX.
  • stale_generation_never_current_after_bump assumes stamped < u64::MAX - 3 and 1–3 intervening bumps; generation_counter_saturates_at_max documents that at u64::MAX a captured generation still looks current.
  • The walk proofs cover 4 items over 2 documents with item limits in 1..=3.
    Under RIPR-SPEC-0371 ("states exactly what a proof covers") the changelog should carry those bounds and the saturation caveat, as the sibling Kani PRs' entries do ("within stated bounds"). One-sentence fix; no code change needed.

Non-blocking. generation_counter_saturates_at_max has no cover! (constant check). In budget_item_limits_hold_over_walk, the WorkspaceItemLimit arm asserts the reached limit but not the matching overflow value, and the SerializedByteLimit arm asserts nothing (it is covered in the bytes harness instead); acceptable, though a symmetric overflow == assertion is cheap.

Fine. The ProfileFiltered arm uses kani::assert(false, ..) so reaching it fails the proof; budget validation accepted-set assertions are correct; covers are non-trivial.

Leftover spec refs. None (0370 absent).


Generated by Claude Code

…get/refresh changelog (#11877)

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.

REVIEW_READY

Head reviewed: f882eca (delta from 73c902b is the changelog fragment only; production refactor and harnesses unchanged, so the earlier behavior-preservation check stands). Static review only; I did not run cargo xtask kani or inspect hosted checks.

The earlier finding is resolved. The changelog now states the walk bound (4 items, 2 documents, item limits 1 to 3), the byte-limit caveat (holds for limits below usize::MAX; the saturating sum can clamp at exactly usize::MAX), and the generation bounds (1 to 3 bumps, generations below u64::MAX - 3; saturation at u64::MAX leaves a captured generation looking current). Each matches the corresponding assume in the harnesses. Non-blocking nits from the previous review (no cover! on generation_counter_saturates_at_max; asymmetric overflow assertions in the walk harness) are unchanged. No 0370 reference present.


Generated by Claude Code

@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 found 1 potential issue.

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 2c290d4

Delta since f882eca: merge-of-main only; PR-owned files byte-identical. Deferred claim boundaries: the author replied in the Devin threads that the narrowing/cover fixes go in "the follow-up PR" and resolved them. The replies are accurate, but no tracking issue exists (I searched open issues), so the deferral lives only in resolved threads. Condition, not a code blocker: file one issue listing the deferred items and link it from this PR before merge, so they cannot be dropped silently. (Items here: the item-limit walk commits zero bytes so the combined item+byte case is not verified; changelog states the limit.) 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.

Parked follow-ups

  • The proof architecture is intentionally helper-level, so it does not establish equivalence of the surrounding String/BTreeMap/BTreeSet walk or mutex-guarded scheduler.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The packet contains no completed ordinary test receipt for the changed Rust behavior.
  • Host-side verification is incomplete: ripr failed with exit code 2 and the scheduled cargo-test receipt is absent.

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