Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe autosave matcher now normalizes runtime paths before comparing external file-change paths with edit and markdown-preview tabs. The change supports equivalent forward-slash and backslash WSL UNC paths. A test verifies matching between a WSL terminal-link tab and an external watcher event. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/editor/editor-autosave.test.ts (1)
262-277: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for
markdown-previewmode.
getOpenFilesForExternalFileChangeapplies normalization to botheditandmarkdown-preview, but this test only uses the defaulteditmode. Parameterize the case or add a markdown-preview fixture to protect both modes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ad05c0ab-2963-4832-a436-2b2eb5f543d2
📥 Commits
Reviewing files that changed from the base of the PR and between ced2719 and 1f58ee58b1f604b71d364733063ca424c6ef67f4.
📒 Files selected for processing (2)
src/renderer/src/components/editor/editor-autosave.test.tssrc/renderer/src/components/editor/editor-autosave.ts
1f58ee5 to
476f06a
Compare
Summary
WSL files opened from terminal links use the forward-slash UNC form (
//wsl.localhost/Ubuntu/...), but file watcher events emit the backslash form (\\wsl.localhost\Ubuntu\...). The raw string equality ingetOpenFilesForExternalFileChangenever matched, so the editor tab stayed stale after external edits. This PR folds both sides throughnormalizeRuntimePathForComparison, which already handles separator style, thewsl.localhost/wsl$alias, and distro case folding.Closes #13349.
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAdded a regression test in
editor-autosave.test.tsthat matches a forward-slash UNC tab (//wsl.localhost/Ubuntu/...) against a backslash watcher path (\\wsl.localhost\Ubuntu\...) and asserts the tab is included in the reload set.AI Review Report
The change adds one import and replaces a raw
===comparison with a call to an existing, well-tested normalization function. The main risk reviewed was non-idempotency ofnormalizeRuntimePathForComparisonfor WSL UNC paths — the function is documented as not safe to re-normalize an already-normalized value. The fix calls it on both raw values independently (never on an already-normalized value), so this trap does not apply.Cross-platform compatibility was checked for macOS, Linux, and Windows:
normalizeRuntimePathForComparisononly folds separators and lowercases for Windows drive letters and WSL UNC aliases; POSIX paths are returned with NFC normalization and forward-slash folding only, so macOS/Linux behavior is unchanged.Security Audit
No new command execution, IPC, network access, authentication, secrets, or filesystem path handling beyond passing existing strings through an existing pure comparison-normalization function. No dependency changes.
Notes
The non-idempotency caveat in
cross-platform-path.tsapplies to storing canonical forms; this PR only compares, so it is not affected.