t3code icon indicating copy to clipboard operation
t3code copied to clipboard

fix(web): preserve POSIX path casing in file links

Open AksharP5 opened this issue 4 months ago • 2 comments

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.txt could therefore be treated as Project/probe.txt inside the workspace and open the wrong file in the right-panel preview.

Fixes #4804

UI Changes

Before — outside sibling misclassified

A lowercase sibling link is displayed as Project/probe.txt and opens the uppercase workspace file

After — outside sibling remains absolute

The lowercase sibling link preserves its absolute path

After — inside-workspace display remains relative

An exact-case workspace file still displays as Project/probe.txt

Before/after interaction recording

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 passed
  • Targeted lint passed for the changed files
  • vp run --filter @t3tools/shared typecheck passed
  • vp run --filter @t3tools/web typecheck passed

Checklist

  • [x] This PR is small and focused
  • [x] I explained what changed and why
  • [x] I included before/after screenshots for the UI behavior
  • [x] I included a video for the interaction change

Model: GPT-5.6 Sol | Harness: Codex in T3 Code

[!NOTE]

Fix POSIX path casing preservation in file links for workspace-relative display

  • Adds resolveWorkspaceRelativePath to filePathDisplay.ts to compute workspace-relative paths with correct case sensitivity: exact-match for POSIX, case-insensitive for Windows and UNC paths.
  • Refactors formatWorkspaceRelativePath to preserve drive roots (e.g. C:/) and filesystem roots (/) in display output instead of collapsing them.
  • Extracts normalizePathCaseForComparison into packages/shared/src/path.ts as a reusable utility; Windows/UNC paths are lowercased and backslash-normalized, POSIX paths are returned unchanged.
  • Updates markdown-links.ts to use resolveWorkspaceRelativePath for workspaceRelativePath in link metadata, replacing a local helper that unconditionally lowercased paths.
  • Behavioral Change: POSIX file links are now case-sensitive — previously, paths were always lowercased for comparison, which could cause mismatches on case-sensitive filesystems.

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) and normalizePathCaseForComparison in @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 workspace Project/) is no longer treated as in-workspace, so preview routing and relative labels match the real path.

Reviewed by Cursor Bugbot for commit dce9bffc36d1bcf2a9d86a1e0f0690883b58b495. Bugbot is set up for automated code reviews on this repo. Configure here.

AksharP5 avatar Jul 29 '26 00:07 AksharP5

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 79227a84-6fb2-4530-9c5a-dd2227c3fbfb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • [ ] 🔍 Trigger review

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.

❤️ Share

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

coderabbitai[bot] avatar Jul 29 '26 00:07 coderabbitai[bot]

Approvability

Verdict: 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.

macroscopeapp[bot] avatar Jul 29 '26 01:07 macroscopeapp[bot]