Repository navigation
fix(lsp): retain full analysis input identity - #1671
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
WalkthroughThe 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. ChangesLSP input identity lifecycle
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
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 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".
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
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 liftAvoid two recursive workspace scans on every refresh
from_refresh_inputsnow callsworkspace_named_file_identitytwice insideRefreshScheduler::request(), and that helper recursively walks the workspace and reads matching files. Becauserequest()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
📒 Files selected for processing (11)
crates/ripr/src/analysis/seam_cache.rscrates/ripr/src/lsp/actions.rscrates/ripr/src/lsp/backend.rscrates/ripr/src/lsp/diagnostics.rscrates/ripr/src/lsp/hover.rscrates/ripr/src/lsp/input_identity.rscrates/ripr/src/lsp/lens.rscrates/ripr/src/lsp/refresh_scheduler.rscrates/ripr/src/lsp/state.rscrates/ripr/src/lsp/tests.rsdocs/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)
…current' into fix/lsp-snapshot-input-identity-current # Conflicts: # crates/ripr/src/lsp/input_identity.rs
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.tomland Cargo changes now processes both invalidation paths. Base-ref resolution remains owned by the analysis layer; LSP only projects its result.Verification
cargo clippy -p ripr --lib -- -D warningscargo xtask check-process-policycargo xtask check-local-contextcargo fmt --all -- --check,git diff --checkReview 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, retainingNonefor unresolved refs.Backend::did_change_watched_files: handles repository-config and workspace-graph changes independently in mixed notifications.workspace_input_path_is_relevanttests: 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.