Fix Windows path normalization in target plans#443
Conversation
|
Opened the matching bug report as #444 for the ugig bug-fix trail. This PR fixes that Windows path normalization issue. |
Greptile SummaryThis PR fixes cross-platform path separator bugs exposed when running the target adapter test suite on Windows, applying two complementary strategies depending on the target type.
Confidence Score: 5/5Safe to merge; the changes are narrowly scoped to path-joining helpers and file-list normalisation with no effect on runtime logic outside of dry-run/plan output. All five targets apply targeted, well-understood fixes (platform sep replacement for file lists; POSIX-aware join wrappers for plan paths). The previously flagged planPath regressions in browser-safari and plugin-vscode are resolved. The remaining native join calls for expectedPackage/artifact in the Roku and web-static targets produce mixed separators in their JSON output but do not break any currently tested behaviour. tv-roku/src/index.ts and web-static/src/index.ts — expectedPackage, artifact, and manifest write-path still use native join, leaving the plan/manifest JSON with mixed path styles on Windows. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ctx.outDir / ctx.projectDir] --> B{isWindowsPath?}
B -->|Yes - contains backslash or drive letter| C[native join / resolve]
B -->|No - POSIX-style path| D[posix.join / posix.resolve]
C --> E[Plan / Manifest output]
D --> E
F[listFiles root, dir] --> G[relative root, path]
G --> H[.split sep .join '/']
H --> I[POSIX-normalised file list]
I --> E
style C fill:#f9d,stroke:#c66
style D fill:#cfc,stroke:#6a6
style H fill:#cfc,stroke:#6a6
Reviews (2): Last reviewed commit: "Address path normalization review" | Re-trigger Greptile |
|
Fixed the review items in a54d0ea: �rowser-safari now uses the path-preserving helper for the dry-run plan path, plugin-vscode uses it for the dry-run plan file path, and the Windows-path heuristic no longer treats // POSIX paths as Windows. Re-ran the five targeted test files (30 passed) and typechecks for the touched target packages. |
Summary
/separators on Windows for Roku and static web outputs/repo/...to\repo\...on WindowsWhy
Running the target adapter tests on Windows exposed cross-platform path handling bugs: generated manifests and mocked command cwd values contained backslashes even where the package contract/tests expect portable POSIX-style paths.
Validation
pnpm exec vitest run packages/targets/tv-roku/src/index.test.ts packages/targets/web-static/src/index.test.ts packages/targets/pkg-jsr/src/index.test.ts packages/targets/plugin-vscode/src/index.test.ts packages/targets/browser-safari/src/index.test.ts-> 30 passedpnpm --filter @profullstack/sh1pt-target-tv-roku typecheckpnpm --filter @profullstack/sh1pt-target-web-static typecheckpnpm --filter @profullstack/sh1pt-target-pkg-jsr typecheckpnpm --filter @profullstack/sh1pt-target-plugin-vscode typecheckpnpm --filter @profullstack/sh1pt-target-browser-safari typecheckFor the ugig bug-fix bounty: this PR fixes Windows-only path separator failures found while running the test suite locally.