Skip to content

fix(lsp): reject ambiguous workspace roots - #1612

Merged
EffortlessSteven merged 6 commits into
mainfrom
fix/lsp-root-authority
Jul 14, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
fix/lsp-root-authority

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

What this does

The LSP now rejects ambiguous or unavailable workspace roots instead of selecting a possibly wrong repository. It keeps root changes, diagnostic publication, repair actions, and related-test navigation bound to the current selected root, including symlink and Windows containment cases.

Fix: establish one typed root authority, invalidate prior analysis on root transitions, suppress stale publication, and expose root-specific recovery status. The constructor root remains bootstrap storage until initialize establishes client authority.

Verification

Check Result
LSP library tests 296 passed, serialized
Clippy, fmt, diff check clean
local output, traceability, spec, and doc-index checks passed
VS Code compile passed
protected Ripr Rust Small Result passed on 7fcc8ee
local cargo xtask check-pr not claimed, timed out without a failure receipt

Review map

  • crates/ripr/src/lsp/backend.rs: root authority lifecycle, transition invalidation, epoch-bound refresh publication, and status/repair gating.
  • crates/ripr/src/lsp/capabilities.rs: single-root initialization and empty-folder handling.
  • crates/ripr/src/lsp/uri.rs: component-wise containment and canonical symlink-ancestor checks.
  • crates/ripr/src/lsp/tests.rs and VS Code tests: root, containment, recovery, and projection regressions.

Closes #1597

@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 LSP now uses typed workspace-root authority, rejects ambiguous or invalid roots, enforces root-contained projections, invalidates stale refresh work on root changes, gates repair actions, and reports root recovery metadata to the VS Code client.

Changes

Workspace-root authority

Layer / File(s) Summary
Root resolution contract
crates/ripr/src/lsp/capabilities.rs, crates/ripr/src/lsp/state.rs, crates/ripr/src/lsp/backend.rs, crates/ripr/src/lsp/tests.rs, docs/specs/...
Workspace folders and root URIs resolve to selected, ambiguous, or unavailable states with typed authority metadata and updated protocol tests.
Root-contained paths and targets
crates/ripr/src/lsp/uri.rs, crates/ripr/src/lsp/gap_artifacts.rs, crates/ripr/src/lsp/actions.rs
Path, file-URI, diagnostic, and related-test target checks enforce workspace containment.
Authority changes and refresh invalidation
crates/ripr/src/lsp/backend.rs, crates/ripr/src/lsp/refresh_scheduler.rs
Root changes update authority, invalidate prior work, clear unsafe state, gate analysis, and reject projections outside the effective root.
Status gating and editor recovery
crates/ripr/src/lsp/backend.rs, editors/vscode/src/client.ts, editors/vscode/test/suite/extension.test.ts, crates/ripr/src/lsp/tests.rs, .ripr/traceability.toml
Analysis status includes root metadata; repair surfaces require an analyzable root, and VS Code displays root-specific recovery guidance.

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

Sequence Diagram(s)

sequenceDiagram
  participant LSPClient
  participant Backend
  participant RefreshScheduler
  participant VSCodeClient
  LSPClient->>Backend: initialize or change workspace folders
  Backend->>RefreshScheduler: invalidate obsolete input
  Backend-->>LSPClient: analysis_status with root state and recovery route
  LSPClient->>Backend: request refresh or repair action
  Backend-->>LSPClient: contained diagnostics or gated response
  LSPClient-->>VSCodeClient: analysis_status notification
  VSCodeClient-->>LSPClient: display root selection or restart guidance
Loading

Possibly related issues

Poem

A rabbit guards the workspace door,
No wandering paths escape anymore.
Roots may shift, old work sleeps,
Safe diagnostics stay in heaps.
“Choose your burrow!” VS Code peeps. 🐇

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 summary and verification, but omits most required template sections like scope, source links, rollback, proof, and traceability. Fill out the template sections: Swarm/source boundary, source links, scope/classification, rollback, spec-test-code traceability, proof, and the remaining checklists.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement typed single-root authority, ambiguity rejection, root-change handling, containment checks, and editor/test coverage required by #1597.
Out of Scope Changes check ✅ Passed The changed files align with the issue scope; the spec, tests, backend, URI checks, and editor updates all support root authority and containment.
Title check ✅ Passed The title clearly names the main behavior change: rejecting ambiguous workspace roots in the LSP.
✨ 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-root-authority

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: 42e90e7600

ℹ️ 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/actions.rs Resolved
Comment thread crates/ripr/src/lsp/capabilities.rs Resolved
@coderabbitai coderabbitai Bot added the codex label Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

@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: 5

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/backend.rs (1)

1897-1965: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

collect_receipt_status doesn't gate on workspace_root_authority().allows_analysis().

Unlike code_action, collect_workspace_status, and collect_repair_packet, this reads self.root and latest_analysis without checking root authority. It happens to degrade safely today only because latest_analysis is cleared as a side effect whenever root authority changes meaningfully (Line 751) — there's no explicit gate here, so a future change to that clearing logic could silently reintroduce stale-root reads.

🤖 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/backend.rs` around lines 1897 - 1965, Update
collect_receipt_status to check workspace_root_authority().allows_analysis()
before reading self.root or latest_analysis, returning the existing
unavailable/no-snapshot response when analysis is not allowed. Match the
authority-gating behavior used by code_action, collect_workspace_status, and
collect_repair_packet, while preserving the current receipt-status construction
for authorized analysis.
🤖 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 785-798: Centralize analysis health resetting by updating
shutdown() to call reset_health_for_input_change() instead of duplicating the
individual field assignments. Preserve the existing shutdown behavior and keep
reset_health_for_input_change() as the single source of truth for clearing
health state.
- Around line 744-777: Update apply_workspace_root_authority so the final
workspace-root authority is constructed once, preserving the RootChanged state
instead of overwriting it with authority afterward. Reuse the changed authority
when the selected root changes, then set_workspace_root_authority and
publish_analysis_status using that final value so collectWorkspaceStatus and
collectRepairPacket can observe RootChanged after the function completes.

In `@crates/ripr/src/lsp/uri.rs`:
- Around line 129-130: Update canonical_or_normalized to avoid treating
normalize_path as sufficient validation when canonicalize fails: resolve and
validate the nearest existing ancestor so ancestor symlinks cannot bypass the
workspace-root check, or defer validation until the actual filesystem access for
edit/command targets. Preserve canonical paths for targets that resolve
successfully.

In `@editors/vscode/src/client.ts`:
- Around line 924-944: Update the root recovery nextStep text in the status
handling branch of the client to make the root_changed refresh action explicit:
instruct users to refresh the saved workspace to obtain current evidence for the
new root, without implying that root selection was required. Preserve the
existing message for other recovery routes.

In `@editors/vscode/test/suite/extension.test.ts`:
- Around line 1037-1061: Add a test alongside the existing typed analysis status
test that emits an analysisStatus notification with root_state set to
root_changed, then assert the client maps it to the stale status and displays
the distinct next-step text. Reuse the existing createControllerTestContext
setup, startup, assertions, and disposal pattern to cover the root_changed
branch in the client status mapping.

---

Outside diff comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 1897-1965: Update collect_receipt_status to check
workspace_root_authority().allows_analysis() before reading self.root or
latest_analysis, returning the existing unavailable/no-snapshot response when
analysis is not allowed. Match the authority-gating behavior used by
code_action, collect_workspace_status, and collect_repair_packet, while
preserving the current receipt-status construction for authorized analysis.
🪄 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: 8b11b2e3-684f-4d17-832c-addad61b689a

📥 Commits

Reviewing files that changed from the base of the PR and between eaa011c and 63a0f8b.

📒 Files selected for processing (12)
  • .ripr/traceability.toml
  • crates/ripr/src/lsp/actions.rs
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/capabilities.rs
  • crates/ripr/src/lsp/gap_artifacts.rs
  • crates/ripr/src/lsp/refresh_scheduler.rs
  • crates/ripr/src/lsp/state.rs
  • crates/ripr/src/lsp/tests.rs
  • crates/ripr/src/lsp/uri.rs
  • docs/specs/RIPR-SPEC-0069-lsp-agent-feedback-use-case.md
  • editors/vscode/src/client.ts
  • editors/vscode/test/suite/extension.test.ts
🔗 Linked repositories identified

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

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

Comment thread crates/ripr/src/lsp/backend.rs Resolved
Comment thread crates/ripr/src/lsp/backend.rs Resolved
Comment thread crates/ripr/src/lsp/uri.rs Resolved
Comment thread editors/vscode/src/client.ts Resolved

@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: 1

Caution

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

⚠️ Outside diff range comments (3)
crates/ripr/src/lsp/backend.rs (2)

1836-1838: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Root-authority denial reuses a health-staleness sentinel reason.

When workspace_root_authority().allows_analysis() is false, collect_repair_packet returns "analysis_snapshot_stale" and collect_receipt_status returns "no_snapshot"/"not_available" — the same generic reasons used for ordinary snapshot staleness. A client can't distinguish "root is ambiguous/unavailable/removed, fix your workspace" from "just wait/refresh", undermining the recovery-guidance goal of the typed root status.

Also applies to: 1899-1913

🤖 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/backend.rs` around lines 1836 - 1838, The root-authority
denial path in collect_repair_packet must use a distinct sentinel reason from
ordinary health staleness, and the corresponding collect_receipt_status branches
must expose matching root-authority-specific reasons. Preserve the existing
staleness reasons when health.allows_current_repairs() is false, while
distinguishing ambiguous, unavailable, or removed workspace roots so clients can
guide workspace recovery.

756-786: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Information Disclosure (CWE-367): Time-of-check Time-of-use (TOCTOU) Race Condition

Reachability: External
● Entry
  crates/ripr/src/lsp/tests.rs:3
  Backend
│
▼
● Sink
  crates/ripr/src/lsp/backend.rs

Serialize root swaps with refreshes crates/ripr/src/lsp/backend.rs:756-786
apply_workspace_root_authority() invalidates the scheduler but awaits diagnostic clears before swapping authority, so an explicit refresh can still start against the old root and later repopulate latest_analysis/publish stale diagnostics after the session has moved. Bind refreshes to a workspace-authority epoch, or recheck the current authority right before publish/commit.

🤖 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/backend.rs` around lines 756 - 786, Serialize
workspace-root changes with refresh execution in apply_workspace_root_authority
and the refresh commit/publish path: invalidate or advance a workspace-authority
epoch before any awaited diagnostic clearing, then have refreshes validate that
epoch/current authority immediately before updating latest_analysis or
publishing diagnostics. Discard results from refreshes started under an older
authority so stale-root analysis cannot be committed or published.
crates/ripr/src/lsp/uri.rs (1)

262-285: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Path Traversal (CWE-22): Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Reachability: Internal

Add a regression test for the symlink-ancestor escape The current tests still only cover lexical .. traversal and foreign absolute paths; add a case that creates a real symlink inside the root pointing outside, then resolves a missing leaf beneath it so canonicalize_with_missing_tail is exercised.

🤖 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/uri.rs` around lines 262 - 285, Extend the URI/path tests
with a temporary root containing a symlink directory that points outside the
root, then check a missing file beneath that symlink through the relevant path
validation flow. Ensure the case exercises canonicalize_with_missing_tail and
asserts the symlink-ancestor escape is rejected, while retaining the existing
lexical and foreign-path assertions.
🤖 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 115-129: The workspace-root authority transitions in
refresh_diagnostics and apply_workspace_root_authority are vulnerable to stale
read-then-write updates. Make each transition atomic under the same
synchronization mechanism, or condition the write on the exact observed
authority/version so a newer did_change_workspace_folders update cannot be
overwritten; preserve the existing transition behavior when no concurrent update
intervenes.

---

Outside diff comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 1836-1838: The root-authority denial path in collect_repair_packet
must use a distinct sentinel reason from ordinary health staleness, and the
corresponding collect_receipt_status branches must expose matching
root-authority-specific reasons. Preserve the existing staleness reasons when
health.allows_current_repairs() is false, while distinguishing ambiguous,
unavailable, or removed workspace roots so clients can guide workspace recovery.
- Around line 756-786: Serialize workspace-root changes with refresh execution
in apply_workspace_root_authority and the refresh commit/publish path:
invalidate or advance a workspace-authority epoch before any awaited diagnostic
clearing, then have refreshes validate that epoch/current authority immediately
before updating latest_analysis or publishing diagnostics. Discard results from
refreshes started under an older authority so stale-root analysis cannot be
committed or published.

In `@crates/ripr/src/lsp/uri.rs`:
- Around line 262-285: Extend the URI/path tests with a temporary root
containing a symlink directory that points outside the root, then check a
missing file beneath that symlink through the relevant path validation flow.
Ensure the case exercises canonicalize_with_missing_tail and asserts the
symlink-ancestor escape is rejected, while retaining the existing lexical and
foreign-path assertions.
🪄 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: 76b8bc29-e600-4831-a541-b8d0b169fd58

📥 Commits

Reviewing files that changed from the base of the PR and between 63a0f8b and 06f1de4.

📒 Files selected for processing (7)
  • crates/ripr/src/lsp/actions.rs
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/capabilities.rs
  • crates/ripr/src/lsp/tests.rs
  • crates/ripr/src/lsp/uri.rs
  • editors/vscode/src/client.ts
  • editors/vscode/test/suite/extension.test.ts
🔗 Linked repositories identified

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

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

Comment thread crates/ripr/src/lsp/backend.rs Resolved
@coderabbitai coderabbitai Bot removed the codex label Jul 14, 2026

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

Caution

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

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

167-182: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Windows containment check breaks for drive-root workspaces; prefer component-wise comparison over manual string concatenation.

If root's canonical form already ends in a separator (e.g. C:\), appending another "\\"/"/" before starts_with produces a double separator that will never match real children, causing every path under a drive-root workspace to be (incorrectly) rejected as outside the root. Using Path/Component-based comparison (lowercasing components) avoids this and matches the non-Windows branch's cleaner starts_with idiom.

♻️ Suggested refactor
 fn paths_equal_or_below(root: &Path, candidate: &Path) -> bool {
-    if cfg!(windows) {
-        root.to_string_lossy()
-            .eq_ignore_ascii_case(&candidate.to_string_lossy())
-            || candidate
-                .to_string_lossy()
-                .to_ascii_lowercase()
-                .starts_with(&(root.to_string_lossy().to_ascii_lowercase() + "\\"))
-            || candidate
-                .to_string_lossy()
-                .to_ascii_lowercase()
-                .starts_with(&(root.to_string_lossy().to_ascii_lowercase() + "/"))
-    } else {
-        candidate == root || candidate.starts_with(root)
-    }
+    if cfg!(windows) {
+        let root_components: Vec<_> = root
+            .components()
+            .map(|c| c.as_os_str().to_string_lossy().to_ascii_lowercase())
+            .collect();
+        let candidate_components: Vec<_> = candidate
+            .components()
+            .map(|c| c.as_os_str().to_string_lossy().to_ascii_lowercase())
+            .collect();
+        candidate_components.len() >= root_components.len()
+            && candidate_components[..root_components.len()] == root_components[..]
+    } else {
+        candidate == root || candidate.starts_with(root)
+    }
 }
🤖 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/uri.rs` around lines 167 - 182, Update
paths_equal_or_below for Windows to compare normalized Path components
case-insensitively instead of lowercased string prefixes with manually appended
separators. Preserve equality and descendant containment, including children of
drive-root paths such as C:\, while keeping the existing non-Windows behavior
unchanged.
crates/ripr/src/lsp/backend.rs (3)

768-806: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Move the root-transition side effects behind the epoch guard

apply_workspace_root_authority can still invalidate the scheduler, clear diagnostics, and reset health even when a concurrent call wins the epoch race and this update returns early. That leaves a superseded transition able to commit destructive side effects with no later republish to restore them. Serialize the full read/decide/write sequence, or delay those side effects until after the stable epoch check.

🤖 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/backend.rs` around lines 768 - 806, The root-transition
side effects in apply_workspace_root_authority currently occur before confirming
that authority_epoch is still current. Serialize the full read/decide/write
sequence or move refresh_scheduler.invalidate_input,
clear_all_diagnostic_uris/diagnostic publishing, and
reset_health_for_input_change after the stable epoch guard, ensuring superseded
updates return without destructive side effects.

118-132: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Re-selecting the root here should go through apply_workspace_root_authority

self.set_workspace_root_authority(WorkspaceRootAuthority::selected(root.clone())) bypasses workspace_root_epoch, so a concurrent did_change_workspace_folders can still overwrite a newer root selection between the read and this write. That reintroduces the race this refactor was meant to close.

🔧 Suggested fix
-                self.set_workspace_root_authority(WorkspaceRootAuthority::selected(root.clone()));
-                self.publish_analysis_status().await;
+                self.apply_workspace_root_authority(WorkspaceRootAuthority::selected(root.clone()))
+                    .await;
🤖 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/backend.rs` around lines 118 - 132, Update the
RootChanged/Full branch in the analysis flow to re-select the workspace root
through apply_workspace_root_authority instead of calling
set_workspace_root_authority directly. Preserve the existing root value and
publish_analysis_status behavior, while ensuring the centralized epoch-aware
application path prevents concurrent workspace-folder changes from overwriting
the selection.

83-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Avoid seeding the root as already-selected here crates/ripr/src/lsp/backend.rs:83-99 If Backend::new starts from the process cwd and initialize() resolves a different workspace root, the first authority update becomes RootChanged, which blocks the first interactive refresh until an explicit full refresh. Seed it as unavailable, or skip change classification for the constructor bootstrap root.

🤖 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/backend.rs` around lines 83 - 99, Initialize
Backend::new’s workspace_root authority as unavailable rather than selected from
the constructor’s root, so initialize() can classify the resolved workspace root
as the initial authority without producing a blocking RootChanged update.
Preserve the existing root storage and workspace-root update behavior for
subsequent changes.
🤖 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.

Outside diff comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 768-806: The root-transition side effects in
apply_workspace_root_authority currently occur before confirming that
authority_epoch is still current. Serialize the full read/decide/write sequence
or move refresh_scheduler.invalidate_input, clear_all_diagnostic_uris/diagnostic
publishing, and reset_health_for_input_change after the stable epoch guard,
ensuring superseded updates return without destructive side effects.
- Around line 118-132: Update the RootChanged/Full branch in the analysis flow
to re-select the workspace root through apply_workspace_root_authority instead
of calling set_workspace_root_authority directly. Preserve the existing root
value and publish_analysis_status behavior, while ensuring the centralized
epoch-aware application path prevents concurrent workspace-folder changes from
overwriting the selection.
- Around line 83-99: Initialize Backend::new’s workspace_root authority as
unavailable rather than selected from the constructor’s root, so initialize()
can classify the resolved workspace root as the initial authority without
producing a blocking RootChanged update. Preserve the existing root storage and
workspace-root update behavior for subsequent changes.

In `@crates/ripr/src/lsp/uri.rs`:
- Around line 167-182: Update paths_equal_or_below for Windows to compare
normalized Path components case-insensitively instead of lowercased string
prefixes with manually appended separators. Preserve equality and descendant
containment, including children of drive-root paths such as C:\, while keeping
the existing non-Windows behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a1da9db9-6008-486b-9572-f540cbe386c8

📥 Commits

Reviewing files that changed from the base of the PR and between 06f1de4 and 7063eda.

📒 Files selected for processing (2)
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/uri.rs
🔗 Linked repositories identified

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

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

@EffortlessSteven
EffortlessSteven merged commit 559699d into main Jul 14, 2026
23 of 24 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/lsp-root-authority branch July 14, 2026 04:59
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Verified the current head against the remaining root-authority review inputs and pushed commit 681418b. The refresh request now carries the workspace-authority epoch; root transitions are serialized with final diagnostic publication/commit; constructor state is unavailable until initialize; RootChanged recovery uses the central authority transition; Windows containment compares normalized path components; test harnesses explicitly initialize authority. Full LSP tests: 287 passed. Clippy, formatting, and diff checks pass. Existing review threads are all resolved; advisory Codecov/rate-limit signals remain non-blocking.

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.

lsp: reject ambiguous workspace roots and enforce root-contained projections

1 participant