Skip to content

fix(lsp): retain full analysis input identity - #1671

Merged
EffortlessSteven merged 9 commits into
mainfrom
fix/lsp-snapshot-input-identity-current
Jul 15, 2026
Merged

EffortlessSteven merged 9 commits into
mainfrom
fix/lsp-snapshot-input-identity-current

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

What this does

LSP analysis status and retained snapshots need to identify the exact inputs that produced their evidence. The previous path tracked configuration and workspace revisions, but not manifest and lockfile content, the resolved base commit, or mixed watched-file batches.

Fix: retain one producer-owned input identity on refresh requests and completed snapshots, resolve a configured base to its exact commit when Git can establish it, and fail closed when it cannot. One workspace traversal supplies both Cargo identities, and a notification containing both ripr.toml and Cargo changes now processes both invalidation paths. Base-ref resolution remains owned by the analysis layer; LSP only projects its result.

Verification

Check Result
LSP-focused library tests 327 passed
exact base commit / unknown-ref test 1 passed
seam-cache tests 33 passed
cargo clippy -p ripr --lib -- -D warnings clean
cargo xtask check-process-policy clean
cargo xtask check-local-context clean
cargo fmt --all -- --check, git diff --check clean

Review map

  • workspace_named_file_identities: computes Cargo manifest and lockfile identities with one traversal while preserving per-name hashing.
  • LspAnalysisInputIdentity::from_refresh_inputs: records the requested base and exact resolved commit, retaining None for unresolved refs.
  • Backend::did_change_watched_files: handles repository-config and workspace-graph changes independently in mixed notifications.
  • workspace_input_path_is_relevant tests: cover containment, filename filtering, and Windows case-insensitive behavior.
  • analysis::diff::load::resolve_base_commit: is the sole Git-backed producer for exact base identity.

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

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds manifest and lockfile content identities, stores them on refresh requests and snapshots, exposes identity state through analysis health, and refreshes analysis when relevant workspace files change.

Changes

LSP input identity lifecycle

Layer / File(s) Summary
Identity construction and refresh request storage
crates/ripr/src/analysis/seam_cache.rs, crates/ripr/src/lsp/input_identity.rs, crates/ripr/src/lsp/refresh_scheduler.rs
Workspace manifest and lockfile identities now participate in canonical stable IDs, while refresh requests retain the computed identity.
Snapshot provenance and refresh gating
crates/ripr/src/lsp/state.rs, crates/ripr/src/lsp/backend.rs, crates/ripr/src/lsp/{actions,diagnostics,hover,lens}.rs, crates/ripr/src/lsp/tests.rs
Analysis snapshots carry optional input provenance, refresh execution populates it, and publishing is blocked when it remains absent.
Health and status identity reporting
crates/ripr/src/lsp/backend.rs, crates/ripr/src/lsp/tests.rs, docs/specs/RIPR-SPEC-0069-lsp-agent-feedback-use-case.md
Current and last-successful input identities are tracked, emitted in analysis_status, tested across failed refreshes, and documented in the status contract.
Workspace manifest and lockfile refresh flow
crates/ripr/src/lsp/backend.rs, crates/ripr/src/lsp/tests.rs
File watching and relevance filtering now cover workspace Cargo.toml and Cargo.lock changes, which invalidate input state and trigger refreshes.

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

Sequence Diagram(s)

sequenceDiagram
  participant WorkspaceWatcher
  participant Backend
  participant RefreshScheduler
  participant AnalysisSnapshot
  participant AnalysisStatus
  WorkspaceWatcher->>Backend: report Cargo.toml or Cargo.lock change
  Backend->>Backend: invalidate current input identity
  Backend->>RefreshScheduler: request interactive refresh
  RefreshScheduler->>AnalysisSnapshot: attach computed input identity
  Backend->>AnalysisStatus: publish current and last-successful identities
Loading

Possibly related PRs

Poem

A rabbit hashes files in the breeze,
Cargo whispers beneath the trees.
Snapshots carry each input’s trail,
Status lights glow when refreshes sail.
Hop, hop—identities stay clear!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers purpose and verification, but it omits most required template sections like Scope, Proof, Rollback, and traceability. Rewrite the PR description using the repository template and fill in the missing sections, especially Scope, Source-of-truth Links, Proof, Claim Boundary, Rollback, and Spec-Test-Code Traceability.
✅ Passed checks (3 passed)
Check name Status Explanation
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 matches the main change: preserving full LSP analysis input identity.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lsp-snapshot-input-identity-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: 51d709eb26

ℹ️ 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
Comment thread crates/ripr/src/lsp/input_identity.rs Resolved
@codecov

codecov Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.32110% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/lsp/backend.rs 60.86% 27 Missing ⚠️
crates/ripr/src/lsp/input_identity.rs 94.11% 3 Missing ⚠️
crates/ripr/src/analysis/diff/load.rs 93.93% 2 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: 2

Caution

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

⚠️ Outside diff range comments (1)
crates/ripr/src/lsp/input_identity.rs (1)

95-120: 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Avoid two recursive workspace scans on every refresh

from_refresh_inputs now calls workspace_named_file_identity twice inside RefreshScheduler::request(), and that helper recursively walks the workspace and reads matching files. Because request() runs on every interactive refresh trigger before analysis is offloaded, this adds blocking I/O to a latency-sensitive path. Cache the manifest/lockfile identities per root and invalidate them from the watcher, or merge both lookups into one traversal.

🤖 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 `@crates/ripr/src/lsp/input_identity.rs` around lines 95 - 120, Update
from_refresh_inputs and its RefreshScheduler::request() path to avoid performing
two recursive workspace scans for Cargo.toml and Cargo.lock on every refresh.
Reuse a single traversal or cached manifest/lockfile identities keyed by
effective_root, and invalidate that cache through the existing watcher before
subsequent refreshes.
🤖 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 1622-1639: Update did_change_watched_files so config_changed and
workspace_graph_changed are handled by independent if statements rather than
mutually exclusive branches. Preserve reload_repository_config for repository
config events, and ensure batched workspace manifest or lockfile events still
call invalidate_analysis_input, publish_analysis_status, and refresh_diagnostics
even when config_changed is also true.

In `@crates/ripr/src/lsp/tests.rs`:
- Around line 99-119: The test
workspace_input_watch_requires_contained_cargo_manifest_or_lockfile currently
uses Windows paths but runs only on non-Windows CI, so it does not exercise the
Windows containment branch. Gate this test with #[cfg(windows)] or otherwise add
Windows execution coverage, while preserving its existing assertions.

---

Outside diff comments:
In `@crates/ripr/src/lsp/input_identity.rs`:
- Around line 95-120: Update from_refresh_inputs and its
RefreshScheduler::request() path to avoid performing two recursive workspace
scans for Cargo.toml and Cargo.lock on every refresh. Reuse a single traversal
or cached manifest/lockfile identities keyed by effective_root, and invalidate
that cache through the existing watcher before subsequent refreshes.
🪄 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: bbd7ab0a-a552-4588-beca-e18ee188f414

📥 Commits

Reviewing files that changed from the base of the PR and between f8b7628 and 51d709e.

📒 Files selected for processing (11)
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/lsp/actions.rs
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/diagnostics.rs
  • crates/ripr/src/lsp/hover.rs
  • crates/ripr/src/lsp/input_identity.rs
  • crates/ripr/src/lsp/lens.rs
  • crates/ripr/src/lsp/refresh_scheduler.rs
  • crates/ripr/src/lsp/state.rs
  • crates/ripr/src/lsp/tests.rs
  • docs/specs/RIPR-SPEC-0069-lsp-agent-feedback-use-case.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/ub-review (auto-detected)
  • EffortlessMetrics/perl-lsp (auto-detected)

Comment thread crates/ripr/src/lsp/backend.rs Resolved
Comment thread crates/ripr/src/lsp/tests.rs Resolved
This was referenced Jul 14, 2026
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.

1 participant