fix(web): preserve POSIX path casing in file links - #4805
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8356a0a to
22c08d6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 22c08d6. Configure here.
ApprovabilityVerdict: Needs human review This bug fix changes path comparison behavior from unconditional case-insensitivity to platform-aware handling (POSIX case-sensitive, Windows case-insensitive). While well-tested, changes to core path resolution logic that affect runtime behavior warrant human review. You can customize Macroscope's approvability policy. Learn more. |
|
Note 🤖 GPT-6 Astra (preview) responding on behalf of Theo This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened. Closing in favor of the smaller case-policy change in #9309, where review continues. Both address POSIX file-link containment. The filesystem-root and encoded trailing-space cases are recorded there for the shared resolver update, without taking this PR's broader path rewrite or treating every double-slash path as Windows UNC. |

What Changed
Markdown file links now use the shared project-path comparison policy for workspace containment. POSIX paths remain case-sensitive, while Windows drive and UNC paths remain case-insensitive.
The same containment result now drives both tooltip formatting and click routing.
Why
On POSIX, link containment lowercased both paths. A link to a case-distinct sibling such as
project/probe.txtcould therefore be treated asProject/probe.txtinside the workspace and open the wrong file in the right-panel preview.Fixes #4804
UI Changes
Before — outside sibling misclassified
After — outside sibling remains absolute
After — inside-workspace display remains relative
t3PR.mp4
Verification
vp test run packages/shared/src/path.test.ts apps/web/src/markdown-links.test.ts apps/web/src/filePathDisplay.test.ts— 54 tests passedvp run --filter @t3tools/shared typecheckpassedvp run --filter @t3tools/web typecheckpassedChecklist
Model: GPT-5.6 Sol | Harness: Codex in T3 Code
Note
Fix POSIX path casing preservation in file links for workspace-relative display
resolveWorkspaceRelativePathto filePathDisplay.ts to compute workspace-relative paths with correct case sensitivity: exact-match for POSIX, case-insensitive for Windows and UNC paths.formatWorkspaceRelativePathto preserve drive roots (e.g.C:/) and filesystem roots (/) in display output instead of collapsing them.normalizePathCaseForComparisoninto packages/shared/src/path.ts as a reusable utility; Windows/UNC paths are lowercased and backslash-normalized, POSIX paths are returned unchanged.resolveWorkspaceRelativePathforworkspaceRelativePathin link metadata, replacing a local helper that unconditionally lowercased paths.Macroscope summarized 2a250cb.
Note
Medium Risk
Changes core path comparison used for link preview routing and display; behavior shifts on case-sensitive filesystems but is covered by expanded tests.
Overview
Fixes workspace containment for markdown file links and tooltips so POSIX paths stay case-sensitive, while Windows drive and UNC paths stay case-insensitive.
Adds shared
resolveWorkspaceRelativePath(used by display formatting and link metadata) andnormalizePathCaseForComparisonin@t3tools/shared/path, replacing logic that always lowercased paths for comparison. Display formatting now keeps drive and filesystem roots (e.g.C:/,/) and handles UNC share roots correctly.A link to a case-distinct sibling (e.g.
project/vs workspaceProject/) is no longer treated as in-workspace, so preview routing and relative labels match the real path.Reviewed by Cursor Bugbot for commit dce9bff. Bugbot is set up for automated code reviews on this repo. Configure here.