Skip to content

fix(windows): normalize paths for case-insensitive comparison on Windows#75

Merged
ashmitb95 merged 1 commit into
ashmitb95:mainfrom
zwye:fix/case-insensitive-path-matching
Jul 4, 2026
Merged

fix(windows): normalize paths for case-insensitive comparison on Windows#75
ashmitb95 merged 1 commit into
ashmitb95:mainfrom
zwye:fix/case-insensitive-path-matching

Conversation

@zwye

@zwye zwye commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Windows paths are case-insensitive, but string comparison was case-sensitive. This caused signal routing to fail when workspace folder paths had different case (e.g., 'F:\Github' vs 'f:\Github').

Normalize paths to lowercase on Windows before comparison in:

  • cwdMatchesFolder() in src/routing/cwd.ts
  • Test-CwdInsideFolder in hook/_lib.ps1
  • cwdInsideFolder() in hook/_lib/active.js

This ensures parity across all three path-matching functions.

Summary

  • Fixed case-sensitive path comparison that broke signal routing on Windows
    when workspace folder paths had different casing (e.g., 'F:\Github' vs 'f:\Github')
  • Normalized paths to lowercase on Windows in all three path-matching functions:
    cwdMatchesFolder() (TS), Test-CwdInsideFolder (PS1), and cwdInsideFolder() (JS)

Test plan

  • npm test green locally
  • npm run typecheck && npm run lint && npm run format:check green
  • npm run smoke green (macOS)
  • Sideloaded the produced .vsix into a fresh VS Code profile and confirmed expected behavior
  • If touching hooks or dispatch: ran the /test-notifier skill end-to-end
  • Packaged .vsix and verified notifications on Windows

Notes for reviewer

PowerShell version uses [IO.Path]::DirectorySeparatorChar -eq '\' to detect
Windows for cross-version compatibility (works in both Windows PowerShell 5.x
and PowerShell Core 6+).

Windows paths are case-insensitive, but string comparison was case-sensitive.
This caused signal routing to fail when workspace folder paths had different
case (e.g., 'F:\Github' vs 'f:\Github').

Normalize paths to lowercase on Windows before comparison in:
- cwdMatchesFolder() in src/routing/cwd.ts
- Test-CwdInsideFolder in hook/_lib.ps1
- cwdInsideFolder() in hook/_lib/active.js

This ensures parity across all three path-matching functions.

@ashmitb95 ashmitb95 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Addresses the parity feedback from #73 by fixing all three path-matching functions (TS/PS1/JS). Checks green locally, and the PowerShell Windows-detection via DirectorySeparatorChar is a nice cross-version touch. Merging.

@ashmitb95 ashmitb95 merged commit 1ad8d05 into ashmitb95:main Jul 4, 2026
4 checks passed
@ashmitb95

Copy link
Copy Markdown
Owner

Merged, thanks for splitting this out. Nice work covering all three path-matching functions (TS, PS1, and JS), that parity is exactly what I was hoping for, and the PowerShell DirectorySeparatorChar check for Windows detection is a clean cross-version approach.

Two follow-ups whenever you get to them:

  1. The UTF-8 hook encoding fix (part 1 of the original PR) doesn't seem to be up yet. That one was clean and low-risk, so happy to take it as soon as you open it.
  2. The per-reason signal files + debounce change (part 3) still has the subagent_done double-fire issue from the earlier review. No rush, just flagging it's the one piece still needing a rework before it can land.

Appreciate the contributions.

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.

2 participants