Skip to content

fix(shared): match Windows home paths case-insensitively in file links - #19627

Open
hogeheer499-commits wants to merge 1 commit into
pingdotgg:mainfrom
hogeheer499-commits:fix/windows-home-link-case-20261014
Open

hogeheer499-commits wants to merge 1 commit into
pingdotgg:mainfrom
hogeheer499-commits:fix/windows-home-link-case-20261014

Conversation

@hogeheer499-commits

@hogeheer499-commits hogeheer499-commits commented Oct 14, 2026 •

Copy link
Copy Markdown

Problem

A Markdown or terminal file link such as ~/notes.md:3 stays unresolved when a valid Windows cwd spells its home segment users or uSeRs instead of Users. This breaks an already supported file-link path on ordinary case-insensitive Windows filesystems.

Reproduction: resolvePathLinkTarget("~/notes.md:3", "C:\\users\\alice\\project") returns ~/notes.md:3; expected C:\\users\\alice\\notes.md:3.

Change

Add the i flag to the existing Windows home-path regex in packages/shared/src/fileLinks.ts, with two regression cases. The matched path keeps its original casing and line suffix. POSIX handling and the unknown-home fallback remain unchanged. No client or product-default changes.

Scope and approval

One cause in the existing shared resolver: case-sensitive detection of a supported Windows home path. This is submitted under the very small, focused obvious-bug exception; it adds no capability or workflow. The one-character production change remains absent from checked main@ab3a3cd1.

Related #18345/#18458 concern mobile call sites, and #19201 concerns clipboard formatting; none supplies this shared Windows matcher fix. This PR stands on its own.

Verification

  • Original production code (main@348f217a) with the new fixtures: 2 fail, 21 pass. Patched file-link and related path suites: 59 pass (23 + 36).
  • Native Windows, Node 24.17.0: original and patched TypeScript helpers tested against a real file under the home directory and a valid cwd spelled uSeRs. Original leaves the tilde unresolved and cannot find the file; patched reads the expected contents and preserves line 3. This is helper/file-access evidence, not a packaged UI click test.
  • Rechecked 15 October: head a1f9d1c merges cleanly with main@ab3a3cd1. The same 59 path tests pass in an isolated combination with fix(server): queued preview actions no longer start after their deadline, except recording stop #16941 (compatibility check, not a dependency). Shared/server typechecks, targeted lint, formatting and git diff --check pass.
vp test run packages/shared/src/fileLinks.test.ts packages/shared/src/path.test.ts
vp run --filter @t3tools/shared typecheck

Not tested: packaged desktop UI, mobile or native macOS. Fork CI awaits maintainer authorization.

Code: GPT-6.1-Sol (ultra) in Codex. Independent source/evidence review, without rerunning tests: GPT-6.1-Sol (xhigh) in Codex. The original PR wording was reviewed with Opus 5.5 (xhigh) in Claude Code via T3 Code; this update was prepared with GPT-6.1-Sol in Codex.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 14, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at a1f9d1c

Macroscope's review found this PR approvable — This is a small, well-tested fix that makes ~/ file links resolve from mixed-case Windows Users paths while preserving existing behavior. Its production impact is confined to the shared path-resolution helper, with no changes to defaults, schemas, deployment, or security-sensitive logic.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e7ab3828-de17-46c9-b5db-e057ed4abe52
📥 Commits

Reviewing files that changed from the base of the PR and between 348f217 and a1f9d1c.

📒 Files selected for processing: 2
  • packages/shared/src/fileLinks.test.ts
  • packages/shared/src/fileLinks.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The Windows user-home path match in inferHomeFromCwd is now case-insensitive. Tests cover lowercase and mixed-case user-directory paths and cwd values that do not match the supported forms.

Changes: Windows home-path matching

Layer / File(s) Summary
Match Windows home paths
packages/shared/src/fileLinks.ts, packages/shared/src/fileLinks.test.ts
The Windows user-directory path match is case-insensitive. Tests cover lowercase and mixed-case paths, and verify that ~/notes.md:3 remains unchanged for the specified cwd values.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Suggested reviewers: noojuno

Merge Risk: ⚪ Minimal · up to a1f9d

The focused path-resolution change is mergeable with no identified functional or operational risk.

### Architecture Summary

Architecture risk: 🔵 Low · up to a1f9d

The change affects 1 system.

Changed systems: packages/shared

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/shared (library) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/shared/src/fileLinks.test.ts: Added Windows home-path cases with lowercase and mixed-case user-directory components, plus expectations that the home path remains unchanged for three cwd values that do not match the tested supported forms.
  • observed — Modified behavior in packages/shared/src/fileLinks.ts: The Windows Users path match in inferHomeFromCwd is now case-insensitive; previously, paths with different casing did not match.
Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: case-insensitive Windows home-path matching for shared file links.
Description check Passed The description includes all required sections. It explains the problem, expected behavior, implementation, scope approval, focused verification, observed results, and untested areas.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@hogeheer499-commits hogeheer499-commits changed the title fix(shared): home file links resolve from mixed-case Windows paths fix(shared): match Windows home paths case-insensitively in file links Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant