Skip to content

fix(lsp): compose diagnostic budget bounds without saturation holes - #14521

Merged
EffortlessSteven merged 3 commits into
mainfrom
fix/diagnostic-budget-composed-assurance
Nov 20, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
fix/diagnostic-budget-composed-assurance

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Compose diagnostic count, byte and inline-detail constraints in the same bounded walk, and close the admitted arithmetic-boundary hole where saturating addition hid a sum above usize::MAX.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Proposal: #12109's budget/identity/lifecycle composition obligation and #11877's explicitly deferred combined count-plus-byte claim.
Spec: RIPR-SPEC-0126; native-result interpretation remains governed by RIPR-SPEC-0371.
ADR: none; reuse the existing scalar production budget owner.
Plan item: #12109 execution plan, priority obligation 6.
Governing issue or accepted claim: #12109, bounded diagnostic-budget composition only.
Acceptance delta (one sentence): Actual selected payloads drive combined count/byte/detail checks, including maximum admitted byte limits, with independent widened-arithmetic expectations and ordinary evaluator parity.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): fix/diagnostic-budget-composed-assurance.
Stack parent or prerequisite PR (if any): none; base 55e5868.
Proposed replacement of PR (if any; not yet accepted): none.
Acceptance retained from a replaced candidate (if any): none; preserve #11877's existing scalar harness names and other claims.
Accepted winner and losing candidate disposition (when decided): single bounded candidate; no predecessor is superseded.

Scope

Production: BudgetCursor::decide uses checked addition. Mathematical overflow exceeds every admitted byte limit. Count-reason precedence, exact fits, inline-detail flags and the lone oversized first-item exception are unchanged.

Evidence: the existing four-step/two-document Kani walk commits real payload bytes and checks exact selection, typed omission priority, counts, total bytes and detail flags. New covers require combined document/byte and workspace/byte pressure and a maximum-limit byte refusal. The byte-only harness no longer excludes usize::MAX. Four ordinary tests exercise 73,728 representative scalar walks and actual evaluator outputs. Spec, traceability and changelog retain the finite scope.

Scope Classification

  • One production behavior

Single acceptance criterion: Diagnostic delivery budget arithmetic and count/byte composition agree with the independent widened arithmetic contract, without relaxing admitted boundaries or refusing legitimate exact fits.

Non-goals: no queue/CI redesign, workflow/check/protection changes, Kani runner/result-registry changes, physical policy package split, releases, host-limit changes, source inference or user-facing formal-assurance claim.

Support-tier Impact

  • none

Policy Impact

  • none

Existing spec and additive traceability only. No new process/network/lint/architecture allowance.

Proof actually observed

Base 55e5868: a standalone Rust test compiled the actual contiguous production evaluator/core, removing only unused external imports. A maximum admitted budget followed by payloads usize::MAX and 1 fails the expected byte-refusal assertion: baseline incorrectly selects the latter. This is arithmetic-domain hardening, not a claim that a real editor allocates exabytes.

Candidate local execution subject aaeacb7786673a72d7dc63d5c43c6e8f9bee4514, exact full tree b403a9352632499eca1fd4cbac3da7320689ce95; connector-published head ff53fa51359f5d861656d2a454d8fa43d86ce4b7 has that identical tree. Six remote blobs and full tree were verified against the local committed Git objects.

  • Rust 1.99.1, rustc --edition=2024 -D warnings --test: 4/4 tests pass; 73,728 finite four-step walks execute.
  • Five separately compiled wrong implementations fail the unchanged controls: original saturating sum, document-count off-by-one, omitted byte refusal, zero-byte accounting, and rejection of exact fits. Every mutant compiles successfully before behavioral failure.
  • Independent exact-tree review repeated all four tests and added a sixth compiled mutation swapping workspace/document reason priority; it fails on the intended reason mismatch. No actionable source/oracle defect found.
  • Changed Rust files formatted with Rustfmt 1.99.1; git diff --check passes.

These executions compile the actual extracted contiguous production core and real ordinary test module, not a hand-written decision surrogate. They do not compile the complete library, Kani harness module, LSP transport or workspace. Repository pins remain unchanged at Rust 1.95.0.

Missing evidence and continuation

Draft / REVIEW_INCOMPLETE. Native Kani compilation/execution and complete cover results are not established. The official pinned Kani 0.68 driver runs in the local task, but its compiler cannot load the required nightly-2026-08-21 Rust driver library. No new nightly installation, full Kani dispatch or required CI request was made in this pass.

Full-library integration, repository policy/traceability execution, check-fast, Clippy and required hosted qualification are not run. Source inspection and extracted-core tests do not promote those dimensions. The owning session retains this candidate and will reuse an already-admitted Kani executor or obtain the appropriate setup authority, verify the native harnesses and full integration, inspect current findings, then request the installed protected qualification route. No merge-ready, auto-merge or protection change is requested by this Draft.

Claim Boundary

May claim: actual production-core arithmetic controls and finite ordinary walks passed; compiled wrong implementations were rejected; combined Kani properties are authored and reviewed.

Must not claim: current native formal proof, full-library/whole-suite pass, transport correctness, formal verification of sorting/maps/serialization/allocator behavior, or completion of #12109/#12904.

Rollback

Revert this coherent six-file candidate. Preserve native runner, proof inventory and other lifecycle owners.

Changelog

changelog.d/12109-composed-diagnostic-budget.md: canonical Fixed marker, bullet and #12109 reference. Describes harness/test additions without promoting native proof.

CI Economics

No workflow or required-lane change. Four ordinary tests add about 0.03 seconds in the extracted-core run. Two existing Kani harnesses become stronger without adding harness count; solver-cost change remains unmeasured until native execution. Do not infer a CI speedup from these results.

Source review: REVIEW_READY 673d294


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 12, 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 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 148 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: 295f78de-08dd-4491-b5a1-80d1ae88af7f
Commits

Reviewing files that changed from the base of the PR and between 332729a and 673d294.

Files selected for processing: 6

  • .ripr/traceability.d/12109-composed-diagnostic-budget.toml
  • changelog.d/12109-composed-diagnostic-budget.md
  • crates/ripr/src/lsp/diagnostic_budget.rs
  • crates/ripr/src/lsp/diagnostic_budget/budget_composition_tests.rs
  • crates/ripr/src/lsp/diagnostic_budget/kani_proofs.rs
  • docs/specs/RIPR-SPEC-0126-lsp-diagnostic-delivery-budget.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the diagnostic delivery budgeting logic to prevent machine-sum overflow by replacing saturating addition with checked addition when evaluating serialized byte limits. This ensures that overflows are correctly refused even when the budget limit is set to usize::MAX. Additionally, the PR introduces a comprehensive suite of unit tests in budget_composition_tests.rs, updates the Kani verification proofs in kani_proofs.rs to cover the maximum byte limit boundary, and updates the corresponding specification documentation. There are no review comments to address, and I have no additional feedback to provide.

Copy link
Copy Markdown
Member Author

Exact-source continuation: remote head ff53fa51359f5d861656d2a454d8fa43d86ce4b7 was fetched and its full tree independently read back as b403a9352632499eca1fd4cbac3da7320689ce95, matching the local reviewed/executed tree. Independent review found no source/oracle defect, repeated all four ordinary tests, and rejected a compiled workspace-before-document priority mutation. A structural traceability probe resolves all four test symbols and both implementation/harness paths; this is not the repository traceability gate.

Pinned-native-tool discovery is now exhausted on available executors: cloud Kani0.68 driver is available but its matching nightly Rust driver library is absent. Native Windows has other Rust toolchains but neither Kani nor nightly2026-08-21; WSL inspection was denied and not bypassed. No new nightly installation occurred. The existing Kani workflow has no harness-selection input and a 90-minute whole-job allowance; this pass did not use it to evade the assigned bounded local proof limits.

Current state remains Draft / REVIEW_INCOMPLETE. Next native transition needs an already-admitted matching Kani executor or specific authority for the pinned task-local nightly setup, followed by actual production-library integration and current hosted qualification. Current source/extracted-core evidence remains valid at the exact tree; no native or aggregate pass is claimed.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 19, 2026 16:43
@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.

SOURCE_REVIEW_READY

Head: 627121e

Independent exact-head review after merging current main. Net change is six files, +318/-32, all in the diagnostic-budget boundary.
Inspected: BudgetCursor::decide now uses checked_add with is_none_or, with reason precedence and the lone-first-item rule unchanged; commit still saturates safely; the Kani walk harness uses independent u128 expectations; budget_composition_tests.rs cases traced by hand (usize::MAX first item, document and byte pressure, oversized first item, 73,728-case walk). Reverting to saturating_add changes the first composition case and the walk result. SPEC-0126 text matches the code.
Local proof: cargo fmt. Native Kani is not run here. Hosted qualification is requested by the label.


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

SOURCE_REVIEW_READY

Head: 673d294

Independent exact-head review after merging current main. Net change is six files, +318/-32, all in the diagnostic-budget boundary.
Inspected: BudgetCursor::decide now uses checked_add with is_none_or, with reason precedence and the lone-first-item rule unchanged; commit still saturates safely; the Kani walk harness uses independent u128 expectations; budget_composition_tests.rs cases traced by hand (usize::MAX first item, document and byte pressure, oversized first item, 73,728-case walk). Reverting to saturating_add changes the first composition case and the walk result. SPEC-0126 text matches the code.
Follow-up commit 673d294 turns the duplicate traceability entry in .ripr/traceability.d/12109-composed-diagnostic-budget.toml into an [[extend]] of the existing behavior id (the hosted traceability check reported the duplicate id on the old head).
Local proof: cargo fmt; cargo xtask check-traceability passes on this head (rc 0). Native Kani is not run here. Hosted qualification is requested by the label.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 12cb5c0 Nov 20, 2026
19 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/diagnostic-budget-composed-assurance branch November 20, 2026 10:14
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