Skip to content

fix(lsp): preserve diagnostic budget evidence - #1858

Merged
EffortlessSteven merged 9 commits into
mainfrom
fix/lsp-budget-contract-1837-current
Jul 19, 2026
Merged

EffortlessSteven merged 9 commits into
mainfrom
fix/lsp-budget-contract-1837-current

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Jul 19, 2026 •

Copy link
Copy Markdown
Member

What this does

Preserves diagnostic-budget evidence when projecting workspace status through the agent-facing LSP interface.

  • carries producer-owned diagnostic identities and deterministic legacy fallback identities;
  • derives budget eligibility from the gap-decision-ledger producer, seam headline eligibility, and preview packet readiness;
  • preserves selected/omitted identities, omission reasons, byte totals, overflow reasons, and continuation routing;
  • binds budget identity to snapshot input provenance and complete evidence identity to the existing workspace diagnostic result identity;
  • reports stable unavailable reason codes (
    o_snapshot, serialization_failure, evaluation_failure) with optional detail;
  • keeps unavailable ranking and inline-detail measurements explicit instead of fabricating values;
  • updates the LSP spec, traceability, and focused regression coverage.

This is a current-main replacement for #1855, with the Rust 1.95 Clippy fixture repair included and no force-push.

Verification

  • cargo fmt --check — pass
  • git diff --check — pass
  • exact-head hosted checks for d67779e — pending;
  • previous exact-head hosted test, coverage, source-of-truth, security, routed preflight, review, and dependency checks — pass at the predecessor head;
  • local targeted Cargo test — not run to completion because the shared Windows workspace had concurrent Cargo/Rust processes and the bounded command timed out without compiler output.

The full workspace/release gate is intentionally not claimed here.

Claim boundary

This lane makes workspace-status budget evidence producer-aware and snapshot-bound. It does not implement push suppression, pull parity, continuation paging, client UI, or gate-policy changes.

@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 Jul 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 175c43d5-3fea-4a07-9fc4-a921af5c4d4d

📥 Commits

Reviewing files that changed from the base of the PR and between cba0a44 and f952ca6.

📒 Files selected for processing (5)
  • .ripr/traceability.toml
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/diagnostic_budget.rs
  • crates/ripr/src/lsp/tests.rs
  • docs/specs/RIPR-SPEC-0126-lsp-diagnostic-delivery-budget.md

Walkthrough

The LSP diagnostic budget bridge now derives deterministic identities and producer-defined actionability. Workspace status exposes serialized budget details with explicit availability state, while tests, specification text, and traceability metadata cover the updated contract.

Changes

Diagnostic budget projection

Layer / File(s) Summary
Diagnostic identity and actionability
crates/ripr/src/lsp/diagnostic_budget.rs
Diagnostic budget items now use serialized payloads, deterministic SHA-256 fallback identities, and producer metadata to determine actionability.
Workspace-status budget projection
crates/ripr/src/lsp/backend.rs
Workspace status now emits diagnostic_budget and diagnostic_budget_state, including serialized omission and overflow reasons across response branches.
Workspace-status contract validation
crates/ripr/src/lsp/tests.rs, docs/specs/RIPR-SPEC-0126-lsp-diagnostic-delivery-budget.md, .ripr/traceability.toml
Tests and specification text cover unavailable states, budget fields, identity binding, identity changes, and diagnostic bridge behavior; traceability includes the new contract test.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LSPWorkspaceStatus
  participant DiagnosticBudgetBridge
  participant BudgetSerializer
  LSPWorkspaceStatus->>DiagnosticBudgetBridge: Evaluate diagnostics with complete-evidence and profile identities
  DiagnosticBudgetBridge->>DiagnosticBudgetBridge: Derive canonical IDs, payload bytes, and eligibility
  DiagnosticBudgetBridge-->>LSPWorkspaceStatus: DiagnosticBudgetResult
  LSPWorkspaceStatus->>BudgetSerializer: Serialize result and reason variants
  BudgetSerializer-->>LSPWorkspaceStatus: diagnostic_budget payload
  LSPWorkspaceStatus-->>LSPWorkspaceStatus: Emit diagnostic_budget_state
Loading

Possibly related PRs

Poem

A bunny counts each warning bright,
Hashes its trail by moonlit light.
“Actionable!” the carrots cheer,
While unavailable states stay clear.
Budgets bloom in status white.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is relevant but misses most required template sections, including summary, scope, traceability, and rollback details. Add the missing template sections or map the current text into them, especially Summary, Swarm/Source Boundary, Scope, Traceability, Proof, and Rollback.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: preserving diagnostic-budget evidence in LSP workspace status.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lsp-budget-contract-1837-current

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e807cb7c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/ripr/src/lsp/backend.rs Resolved
@codecov

codecov Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.91597% with 36 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/lsp/backend.rs 88.69% 19 Missing ⚠️
crates/ripr/src/lsp/diagnostic_budget.rs 91.00% 17 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.ripr/traceability.toml (1)

6840-6853: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Register all new material contract tests.

The traceability entry omits coverage for seam/preview eligibility, serialized reason variants, and complete-evidence identity changes:

   "crates/ripr/src/lsp/diagnostic_budget.rs::tests::diagnostic_bridge_preserves_identity_and_actionability",
+  "crates/ripr/src/lsp/diagnostic_budget.rs::tests::diagnostic_bridge_uses_explicit_seam_and_preview_eligibility",
+  "crates/ripr/src/lsp/backend.rs::diagnostic_budget_projection_tests::workspace_status_budget_json_preserves_all_reason_variants",
   "crates/ripr/src/lsp/tests.rs::execute_command_collect_workspace_status_no_snapshot_returns_no_snapshot_status",
   "crates/ripr/src/lsp/tests.rs::execute_command_collect_workspace_status_with_snapshot_returns_diagnostics_counts",
+  "crates/ripr/src/lsp/tests.rs::workspace_status_budget_identity_changes_with_diagnostic_snapshot",

As per coding guidelines, every material behavior change must preserve spec -> test or fixture -> code -> output contract -> metric.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.ripr/traceability.toml around lines 6840 - 6853, Update the traceability
entry containing the diagnostic budget and workspace status tests to register
the missing material contract tests covering seam/preview eligibility,
serialized reason variants, and complete-evidence identity changes. Add each
relevant test symbol to tests and include any corresponding fixture or code
symbols needed to preserve the spec-to-test-to-code-to-output-to-metric chain.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 2199-2212: Update the error-result branches in the surrounding LSP
request handling to emit stable machine-readable reason codes: use
serialization_failure for serialization errors and evaluation_failure for
evaluation errors instead of error.to_string(). Preserve the unavailable status
and, if diagnostic context is needed, expose the original error separately as an
optional detail field.

In `@crates/ripr/src/lsp/diagnostic_budget.rs`:
- Around line 311-314: Update the diagnostic identity generation around
diagnostic_canonical_id so fallback identities do not depend on the
discovery-order index. Derive them from stable diagnostic content, or sort
stable fallback keys before assigning duplicate ordinals, while preserving
deterministic IDs for reordered legacy diagnostics and aligning duplicates by
identity.
- Around line 367-392: Update diagnostic_is_actionable so the gap-specific
predicate runs only when the diagnostic data identifies the gap decision ledger
producer, such as through source == "gap_decision_ledger", rather than merely
when canonical_gap_id exists. Allow finding diagnostics with canonical_gap_id
but without that producer identity to continue to the existing
preview_actionability.repair_packet_ready evaluation, preserving the shared
validator as authoritative.

---

Outside diff comments:
In @.ripr/traceability.toml:
- Around line 6840-6853: Update the traceability entry containing the diagnostic
budget and workspace status tests to register the missing material contract
tests covering seam/preview eligibility, serialized reason variants, and
complete-evidence identity changes. Add each relevant test symbol to tests and
include any corresponding fixture or code symbols needed to preserve the
spec-to-test-to-code-to-output-to-metric chain.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e3c7d136-5fef-4c23-9925-0eac1f037049

📥 Commits

Reviewing files that changed from the base of the PR and between 6c69f36 and cba0a44.

📒 Files selected for processing (5)
  • .ripr/traceability.toml
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/diagnostic_budget.rs
  • crates/ripr/src/lsp/tests.rs
  • docs/specs/RIPR-SPEC-0126-lsp-diagnostic-delivery-budget.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • EffortlessMetrics/ripr (auto-detected)
  • EffortlessMetrics/unsafe-review (auto-detected)
  • EffortlessMetrics/perl-lsp (auto-detected)
  • EffortlessMetrics/ub-review (auto-detected)

Comment thread crates/ripr/src/lsp/backend.rs Resolved
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Independent coverage pass before the latest remote advancement measured the LSP slice with cargo-llvm-cov. The remaining uncovered areas were the budget bridge's no-producer fallback identity and the workspace-status unavailable projection branches (serialization/evaluation failures), plus the root-lock fallback response. Equivalent focused tests should be added on the current remote head before merge; re-run Codecov after the latest remote commits. I did not force-push when this branch advanced.

Copy link
Copy Markdown
Member Author

Convergence disposition — diagnostic-budget status/evidence winner

This PR is the current owner for repairing the workspace-status evidence bridge. It is not the bounded-delivery PR.

Before merge, close the remaining producer-eligibility finding:

  • use the same canonical actionability predicate that the gap producer uses;
  • prove a non-actionable canonical gap placed first cannot consume a one-item budget ahead of a real actionable gap;
  • preserve the already-repaired stable fallback IDs, snapshot/evidence identities, and stable unavailable reason codes.

Required current-head proof should include the focused budget bridge, workspace-status output contract, deterministic reorder/duplicate cases, full LSP library tests, and the required routed result.

After merge, update #1764/#1582/#1694 as partial. Remaining work is bounded push publication, pull parity/result IDs, continuation retrieval, and client overflow/retrieval presentation. #1862/#1863 own the convergence and issue-state reconciliation.

…ct-1837-current

# Conflicts:
#	crates/ripr/src/lsp/tests.rs
This was referenced Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants