Skip to content

fix(lsp): one path-identity owner; no Unix backslash aliasing or non-UTF-8 URI collapse (#9504) - #9622

Merged
EffortlessSteven merged 7 commits into
mainfrom
claude/9504-path-identity
Oct 22, 2026
Merged

EffortlessSteven merged 7 commits into
mainfrom
claude/9504-path-identity

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #9504
Acceptance delta (one sentence): LSP URI, hover, gap-artifact, input-fingerprint and adapter-path comparators share one output::path::path_identity_key owner, so Unix a%5Cb.rs no longer aliases a/b.rs and distinct non-UTF-8 paths stay distinct and round-trip through file URIs.

Scope

  • output/path.rs: path_identity_key_on/path_identity_key (separator rule, one ASCII fold, byte-exact non-UTF-8 key) and path_display_lossy (display-only).
  • lsp/uri.rs: \ is a separator only on Windows hosts; non-UTF-8 Unix paths encode and decode byte-exactly (round trip); a drive/UNC-shaped text containing \ is refused at emission on non-Windows hosts; comparisons use the shared key.
  • Migrated identity/comparison sites: input_identity.rs root fingerprint, state.rs unavailable-adapter paths, backend.rs root-relative components, hover.rs/gap_artifacts.rs normalize_path, edit_cage case-collision key.
  • Display-only sites (lossy, commented as such): uri::display_path, hover::display_hover_path, backend glob root.
  • Deliberately left: baseline keys (output/baseline*.rs, stored-string compatibility; follow-up Baseline keys: decide path-identity compatibility with output::path::path_identity_key #9666), config/*, app/*, edit-cage inline-test-region (outside the LSP scope).
  • Changelog fragment lists the behavior changes.

Proof

  • cargo xtask precommit passes at head; focused lsp/output::path/edit_cage tests: 1221 passed.
  • Negative experiments: restoring the old unconditional \ rewrite and to_string_lossy fails the %5C alias and non-UTF-8 tests; new tests also pin C:\a\b.rs vs C:/a/b.rs, /w/a\b vs /w/a/b input fingerprints, non-UTF-8 root pairs, UNC refusal, and that a Windows-produced report root /w\sub\proj fails closed on Unix.
  • Windows: not runnable locally. Windows separator handling is unchanged by construction (cfg!(windows) still rewrites \). A cfg(windows) regression test lives in lsp::gap_artifacts::tests, which the existing Windows advisory subset already runs; no workflow change. Windows %5C URIs from Windows clients still separate on Windows only.

Claim Boundary

Not claimed: NFC/NFD or Unicode case equivalence (#9623); baseline-key compatibility (#9666). A Windows-produced %5C URI or backslash report root read on Unix now fails to match instead of aliasing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ukjh8o9wyxm7PSKcCNNX6Q

… non-UTF-8 URI collapse (#9504)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ukjh8o9wyxm7PSKcCNNX6Q
@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 self-assigned this Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 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 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 107 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: 11e9c3c5-c769-47b6-a565-e377d5a50105
📥 Commits

Reviewing files that changed from the base of the PR and between 7ed8a4a and b3c3749.

📒 Files selected for processing: 10
  • changelog.d/9504-path-uri-identity.md
  • crates/ripr/src/edit_cage/mod.rs
  • crates/ripr/src/lsp/backend.rs
  • crates/ripr/src/lsp/gap_artifacts.rs
  • crates/ripr/src/lsp/hover.rs
  • crates/ripr/src/lsp/input_identity.rs
  • crates/ripr/src/lsp/state.rs
  • crates/ripr/src/lsp/tests.rs
  • crates/ripr/src/lsp/uri.rs
  • crates/ripr/src/output/path.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Confirmed findings

  • Gap-artifact path identity differs from hover on macOS for ASCII case variants, despite the PR claiming one shared identity owner.
  • Unix encoded backslashes remain literal filename data rather than becoming directory separators.
  • Non-UTF-8 Unix paths are emitted from exact bytes and cannot collapse through lossy U+FFFD conversion.

Verification questions

  • Confirm the strongest remaining uncertainty is platform and automated-sensor corroboration rather than a demonstrated source defect.
  • Confirm the non-UTF-8 test directly distinguishes both URI spelling and identity, but only exercises Unix and does not prove the non-Unix refusal branch.
  • Confirm non-UTF-8 Unix paths are encoded from raw bytes and distinct bytes produce distinct URI strings, but decoding remains fail-closed.
  • Confirm the owner cannot supply byte-exact identity for non-UTF-8 URI text: normalized_file_uri_path admits UTF-8 only, then file_uris_match_on reconstructs Paths and asks the owner for a key.
  • Confirm windows separator preservation is claimed for Windows and UNC spellings, but the added cross-host test only covers a drive path and does not exercise UNC spelling.
  • Confirm the packet demonstrates several changed routes but does not prove no unscanned sibling comparators retain local normalization or lossy path handling.
  • Confirm a repository-wide inventory of sibling path comparators was not supplied, so completeness beyond the named LSP/output routes is unproven.

Refuted

  • Lossy conversion causes arbitrary non-UTF-8 files to share one URI and expose or alias file contents.; refuted because: Emission and shared identity keys retain exact bytes; decoding intentionally returns None, so distinct paths fail closed rather than map to a file.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

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

Bounded independent #9504 counterexample review at e6fffc6. The publication ownership refresh found this existing candidate, so I did not push or open a rival PR and left this branch untouched.

Residual Unix alias requiring owner disposition — lsp/uri.rs:67,93-94,299-302. On Linux, the shared native owner distinguishes the relative paths C:\a\b.rs (one literal filename) and C:/a/b.rs (three components), but file_uri_for_path emits file:///C:/a/b.rs for both. Likewise, file:///C:/a%5Cb.rs and file:///C:/a/b.rs decode to the same path and match. The new cross-host drive compatibility test explicitly retains this exception; it does not prove native Unix filename identity for drive-shaped names. Please distinguish native Path emission from Windows wire compatibility, or explicitly fail closed for ambiguous native spellings, and pin the chosen boundary with a discriminating test. Do not present the ordinary /w/a%5Cb.rs control as proving this case.

Minimal reproduction inside the URI module on Unix:

let literal = ["C:", "a", "b.rs"].join("\\");
let nested = ["C:", "a", "b.rs"].join("/");
assert_ne!(
    crate::output::path::path_identity_key(Path::new(&literal)),
    crate::output::path::path_identity_key(Path::new(&nested)),
);
assert_eq!(
    file_uri_for_path(Path::new(&literal))?,
    file_uri_for_path(Path::new(&nested))?,
); // observed alias

Native Windows proof remains missing. The normal merge-ready Windows advisory subset selects cargo test -p ripr --lib lsp::gap_artifacts (workflow line 784); it does not execute the new URI/output test names. Compilation/Clippy and cross-host boolean tests cannot establish the issue's Windows-runtime acceptance. Place a real Windows consumer regression in an already selected route or obtain the appropriate supported native run, then inspect the named test's actual execution. I have not requested CI or changed readiness/labels on this owned candidate.

Controls and limits. A bounded Linux executable including unchanged copies of this exact head's production URI and output/path modules passed the ordinary Unix backslash negative/control and distinct FF/FE URI control; the FF/FE emissions return Ok and both decodes return None, as disclosed by the PR. No full Cargo suite or Windows run was performed for this head. The source still promises every Ok emission round-trips (uri.rs:77-82), which should be reconciled with that intentional non-UTF-8 behavior. The existing automated review's macOS gap/hover split claim is refuted at this head: both delegate to the same path_identity_key -> host_paths_case_insensitive predicate; this is source inspection, not native macOS execution. Provider quota comments are missing review, not clearance.

Reviewed head: e6fffc6, re-read unchanged immediately before submission preparation.
Current fetched main: ad83c6b.
Probe executable SHA-256: d6a1f42abf959e3f2e6e9b7125b829eb68f71ee513788ab482ce2034b1e69248; standalone native exit 0.
Disposition: REPAIR_REQUIRED for the demonstrated identity exception pending explicit acceptance/repair, and REVIEW_INCOMPLETE for native Windows/hosted/current integration proof. This is a bounded counterexample handoff, not cumulative merge clearance. Please continue through this existing candidate.

…, fail closed on Windows spellings on Unix (#9504)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ukjh8o9wyxm7PSKcCNNX6Q
…sion narrowing (#9504)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ukjh8o9wyxm7PSKcCNNX6Q
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 22, 2026 12:49
@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!

Copy link
Copy Markdown
Member Author

Review of record, head 505871f

Angles: (1) correctness/edge cases and spec parity, (2) tests/regressions/consumers at e6fffc6, then a delta review of the repair at 7f27879, plus an independent counterexample review that found the C:\a\b.rs vs C:/a/b.rs Unix alias.

Findings and resolutions: incomplete owner migration (input_identity fingerprint, state.rs, backend.rs, edit_cage) fixed with a collision negative test; non-UTF-8 URIs now round-trip on Unix; drive/UNC-shaped backslash spellings are refused at emission on Unix with an assert_ne regression; Windows consumer test added in lsp::gap_artifacts::tests, which the Windows advisory subset already runs; behavior changes (ASCII-only fold, no \ rewrite on Unix hover/report roots) pinned and listed in the changelog. Delta review found no blockers or majors; 505871f only corrects a test comment and adds the non-ASCII case-collision note. Deliberately left: baseline keys (#9666), display-only lossy strings, minors in #9698, NFC/NFD in #9623.

Gap: Windows branches rely on hosted advisory CI. Merging when routed CI is green on this head.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Head 505871f: paste-macos-latest failed to compile ripr (E0425 subject at crates/ripr/src/agent/artifact.rs:719). That file is not in this diff; main itself does not compile since #9632 and #9547 interacted. Fix PRs #9699 and #9701 are open from other lanes. Once one lands I will merge main here, re-apply merge-ready, and re-check.


Generated by Claude Code

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

Independent bounded review for #9698 at 505871f (tree 9fc146e854ce72de3819633691646f5bb7f488fe, merge-base f0397266d11e87fa38c8f846305f0d86eb99f338). The existing #9622 writer remains responsible for the candidate; no candidate edits, competing implementation, CI request, label/readiness change, or merge was performed.

Two existing #9698 P2 findings are verified on this exact candidate.

  1. non_utf8_path_from_file_uri omits the UTF-8 drive admission/normalization at normalize_decoded_uri_path: file:///C:/a%FF yields raw bytes 2f 43 3a 2f 61 ff rather than 43 3a 2f 61 ff; file:///C:x%FF is admitted as 2f 43 3a 78 ff, whereas the UTF-8 file:///C:x is refused. The empty-authority, localhost, and file:/ forms all reproduce this asymmetry. A repair should share the ASCII structural drive rules without lossy conversion or case-folding non-UTF-8 bytes.
  2. is_foreign_windows_spelling falsely refuses the legitimate Unix relative filename a:b\c.rs. A real owned filesystem fixture with exactly those filename bytes was created/read successfully. Narrowing that guard alone is insufficient: file:///a:b%5Cc.rs is still refused by the drive-relative decoder. The current encoder also returns that wire spelling for /a:b\c.rs, followed by a None decode. The explicit file:///./a:b%5Cc.rs control is admitted; an absolute fixture under a normal workspace prefix also round-trips. Reconcile emission and decoder disambiguation together while preserving refusal of actual drive-relative and foreign drive/UNC forms. This does not establish a Windows filesystem access vulnerability.

Observed local proof (native Linux x86_64, Rust 1.95.0):

  • Unchanged candidate: cargo test --locked -p ripr --lib lsp::uri::tests -- --nocapture — native exit 0, 32 passed, 0 failed, 12,704 filtered out.
  • Unchanged candidate: cargo test --locked -p ripr --lib output::path::tests::path_identity_key -- --nocapture — native exit 0, 2 passed, 0 failed, 12,734 filtered out.
  • A separate executable compiled unchanged complete production lsp/uri.rs, output/path.rs, and bounded_input.rs snapshots, with the verbatim display-helper excerpt needed by output/path and the candidate's locked dependency artifacts. It called production methods directly, reproduced both findings, and passed 17 byte-identity/refusal controls (distinct FF/FE and A/a+FF remain distinct even with the host-fold flag, ordinary Unix backslashes remain distinct from separators, exact byte round trips, and traversal/NUL/foreign-authority/query/fragment refusal). Its exit 0 means the counterexamples were reproduced, not that #9698 is repaired. Probe SHA-256: 60c450bae7732b665c256a950269f860d08ac9886096c151845c5b2526f3c3b4; JSON observations SHA-256: 2ce3e7d196c503fce1a3b8b08abf44e0ed2c274e67a44b1f768d6fe6b6b4a92f. Native test executable SHA-256: 64a55007746d7854c1b9a784ae1459ac7496bb6b6ea86409edfa34908c5db0ee.

Native Windows evidence, now observed rather than inferred: job 119833822390 checks out this PR head for the production subset and logs lsp::gap_artifacts::tests::windows_uri_identity_uses_backslash_separator_and_ascii_fold ... ok, 85 passed, 0 failed, and subset-gap-artifacts: PASS. This closes the earlier missing evidence for that named drive/separator/ASCII-fold consumer control. It does not execute the non-UTF-8 Unix branch or prove all Windows behavior.

Integration evidence and continuation: the old required run 39781555293 compiled synthetic merge 39742c8f2b5219339e2a6353f57a53fbe9afe08c and failed with E0425 subject at artifact.rs:719; its Schema producer sweep was skipped. This is historical combined-tree failure, not candidate-source attribution or current qualification. The repair of record #9701 has since merged as 7ed8a4af6df05a45dea9a19da36c65ca8b457af6 (13:34:28 UTC); refreshed main has repaired artifact blob 3b1d5e733d6c6f709020db14f8da155c428c79d4. The existing #9622 owner can now integrate that accepted prerequisite as already planned, review affected composition, and request the installed qualification route once. A fresh applicable Schema sweep must actually execute before qualification is claimed.

Inspected: complete PR diff; URI codec/admission/containment; shared path-key owner; diagnostic URI emission, workspace-root intake, saved-file digest and path-match consumers; existing tests/changelog; Windows selected workflow and actual logs; reviews, threads and Conversation ownership. No new public schema shape, workflow, release, or analyzer-classification change was proposed.

Disposition: #9698 acceptance remains unrepaired; these are the already tracked P2 residuals, not a new blanket blocker claim for #9622. REVIEW_INCOMPLETE for merge clearance, pending the existing owner's current composition/proof and final published-head judgment. No repair-candidate, release, source-sync, or full-platform qualification claim. All other scoped holds remain intact.

Comment thread crates/ripr/src/lsp/uri.rs Resolved
Comment thread crates/ripr/src/lsp/uri.rs Resolved

Copy link
Copy Markdown
Member Author

Review of record, head b3c3749

Angles: delta review of 505871f..b3c3749 (uri.rs drive admission on the byte route, ./ disambiguation, narrowed foreign-spelling refusal) on top of the earlier records at e6fffc6, 7f27879 and 505871f, plus the independent review that verified both P2 findings.

Findings and resolutions: both P2s (#9698) are repaired and pinned by non_utf8_drive_forms_follow_the_utf8_admission_rules and legitimate_drive_shaped_unix_names_round_trip (full emit-then-decode round trip, file:///a:b%5Cc.rs and file:///C:x still refused, C:\a\b.rs vs C:/a/b.rs still do not alias). The delta review found no blockers or majors: the ./ strip applies only to a drive-relative-shaped first segment and runs after the .. check, Windows branches are unchanged, and the focused lsp::uri and output::path tests passed (55) on the author's run. Both inline threads answered and resolved. Remaining minors (extra non-UTF-8 and X:x\y test cases, weak case-fold assertion on the byte route, /./a:b literal-spelling round trip) stay in #9698.

Gap: Windows branches rely on hosted advisory CI, which observed windows_uri_identity_uses_backslash_separator_and_ascii_fold passing on the previous head. Merging when routed CI is green on this head.


Generated by Claude Code

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

Confirmed findings

  • Lane topic is JS worker handoff / async capture / GC / detach / transfer. The diff is synchronous Rust path-identity ownership (crates/ripr/src/output/path.rs and lsp/uri.rs et al.). No JS, Worker, postMessage, SharedArrayBuffer, transferable, or wasm-bindgen surface is touched, so this lane has no actionable findings. The non_utf8_file_uri_for_path byte route is local std::path mapping, not a worker boundary.
  • Percent-decoded NUL and parent segments are rejected before URI paths reach path matching or workspace projection.

Verification questions

  • Confirm non-UTF-8 Unix URI decoding preserves exact bytes without conflating them through U+FFFD or ASCII case folding.
  • Confirm windows-specific behavior is asserted by cfg(windows) tests but remains dependent on hosted Windows execution.
  • Confirm windows branches (file_uris_match_on, paths_equal_or_below_on, file_uri_for_path Windows \ rewrite, and windows_uri_identity_uses_backslash_separator_and_ascii_fold) rely on the hosted Windows advisory subset; no new sibling path on Unix, but Windows proof is observation-only here.

Refuted

  • Non-UTF-8 paths may be exposed through lossy display or matching, creating an alias/info-disclosure primitive.; refuted because: Identity and URI decoding retain exact bytes; lossy conversion is restricted to explicitly display/glob text, and distinct raw-byte paths have distinct URI spellings and do not match.
  • ub-worker-handoff is a category mismatch: the entire diff is synchronous Rust path/URI identity ownership, with no Worker/postMessage/SharedArrayBuffer/wasm-bindgen or async capture touched.
  • Box/Vec allocation failure inside path_identity_key_on's non-UTF-8 hex-key loop could collapse distinct byte paths under OOM and constitute an active-view aliasing hazard.; refuted because: path_identity_key_on is infallible (returns String, not Option), so an allocation failure aborts the process rather than returning a shorter key; the NUL prefix and per-byte format! also make partial/empty output structurally impossible. Calibrated as refuted false-premise per lane instructions.
  • Box::from(slice) allocation failure does not return None; recoverable fallback claims are dropped.

Evidence gaps

  • Windows-specific identity semantics are asserted by cfg(windows) tests but not executed by the available evidence.
  • Windows execution is not corroborated in the available packet despite platform-specific assertions being added.
  • Model proof intent was rejected by deterministic validation.

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