fix(plugins): update path handling to support both POSIX and Windows …#2296
fix(plugins): update path handling to support both POSIX and Windows …#2296utsav1033 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@utsav1033 is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
|
Pulled this and verified it on Windows, where this bug actually bites — it's a real bug and the fix is correct. Reproduced the bug with the pre-fix logic: a Windows absolute path containing The old Verified:
Bonus: the fix also handles cases the tests don't assert yet — forward-slash Windows paths ( Small non-blocking suggestion: since the fix already covers them, adding a Nice catch — exactly the kind of silent path corruption that's easy to miss on macOS/Linux. |
|
Thanks for pulling it and verifying on Windows, appreciate it. |
|
Good catch on the One edge worth a test: a bare drive-relative path like |
|
Thanks. Agreed C:plugin (drive-relative) correctly falls through since it isn't absolute, and it's not a realistic plugin spec, so I'd rather keep this PR scoped to the absolute-path truncation bug and not assert behavior for that edge here. Happy to revisit if it ever comes up as a real case. |
Summary
Fix
normalizePluginSpecso Windows absolute paths are recognized as local plugin specs instead of being parsed as package names.Why
normalizePluginSpeconly treated/-prefixed strings as absolute paths. On Windows, an absolute path likeC:\Users\me\my-plugindoesn't start with/, so it fell through to package-name logic that splits on@. A local plugin path containing@(e.g.C:\Users\me@work\my-plugin) was truncated toC:\Users\me, silently pointing at the wrong location.Issue
Scope
apps/server/src/plugins.ts: recognize both posix and win32 absolute paths vianode:path(posix.isAbsolute/win32.isAbsolute), so the check is correct regardless of host OS.apps/server/src/plugins.test.ts: new unit tests fornormalizePluginSpec.Out of scope
Testing
Ran
bun test src/plugins.test.tstsc --noEmitResult
CI status
cloud-plugins.test.tsEBUSY temp-dir flakes) are present ondevbefore this change. This PR introduces 0 new failures and touches only the two files above.Manual verification
dev,normalizePluginSpec("C:\\Users\\me@work\\my-plugin")returnsC:\Users\me(truncated at@).C:\Users\me@work\my-pluginunchanged.Evidence
Risk
win32.isAbsolutewon't false-positive on package names (they contain no drive letters or backslashes).Rollback