Skip to content

Fix Windows path normalization in target plans#443

Open
ayskobtw-lil wants to merge 2 commits into
profullstack:masterfrom
ayskobtw-lil:codex/windows-target-path-normalization
Open

Fix Windows path normalization in target plans#443
ayskobtw-lil wants to merge 2 commits into
profullstack:masterfrom
ayskobtw-lil:codex/windows-target-path-normalization

Conversation

@ayskobtw-lil
Copy link
Copy Markdown

Summary

  • Normalize target manifest file lists to use POSIX / separators on Windows for Roku and static web outputs
  • Preserve POSIX-style fake/project paths in JSR, VS Code, and Safari target plans instead of converting /repo/... to \repo\... on Windows
  • Keep real Windows paths supported by only using POSIX joins when the provided base path is POSIX-style

Why

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 passed
  • pnpm --filter @profullstack/sh1pt-target-tv-roku typecheck
  • pnpm --filter @profullstack/sh1pt-target-web-static typecheck
  • pnpm --filter @profullstack/sh1pt-target-pkg-jsr typecheck
  • pnpm --filter @profullstack/sh1pt-target-plugin-vscode typecheck
  • pnpm --filter @profullstack/sh1pt-target-browser-safari typecheck

For the ugig bug-fix bounty: this PR fixes Windows-only path separator failures found while running the test suite locally.

@ayskobtw-lil
Copy link
Copy Markdown
Author

Opened the matching bug report as #444 for the ugig bug-fix trail. This PR fixes that Windows path normalization issue.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Greptile Summary

This 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.

  • tv-roku and web-static: Normalize the files array in plan/manifest output by replacing the platform sep with / after calling relative, so manifest file lists are always POSIX-style regardless of OS.
  • pkg-jsr, plugin-vscode, and browser-safari: Introduce an isWindowsPath heuristic and a joinLike/resolveLike wrapper family that selects posix.join/posix.resolve for POSIX-style fake paths (used in tests) and native join/resolve for real Windows paths, preserving correct separators in dry-run plan output.

Confidence Score: 5/5

Safe 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

Filename Overview
packages/targets/tv-roku/src/index.ts Fixes listFiles to emit POSIX-separated relative paths by replacing sep with /; expectedPackage and command paths still use native join, leaving mixed separators in the plan JSON.
packages/targets/web-static/src/index.ts Fixes listFiles to emit POSIX-separated relative paths; artifact and the manifest write path still use native join, leaving mixed separators in the manifest JSON on Windows.
packages/targets/pkg-jsr/src/index.ts Adds isWindowsPath guard to packagePath, using posix.join for POSIX-style project dirs and native join for real Windows paths. Clean and targeted fix.
packages/targets/plugin-vscode/src/index.ts Adds isWindowsPath/joinLike helpers; updates packageDir, packageArtifact, and the dry-run planPath to use POSIX joins for POSIX-style inputs. Previously flagged planPath regression is resolved.
packages/targets/browser-safari/src/index.ts Introduces isWindowsPath, joinLike, and resolveLike; updates planPath, buildPlan, and archivePath construction to preserve POSIX paths in dry-run output. Previously flagged planPath regression is now resolved.

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
Loading

Reviews (2): Last reviewed commit: "Address path normalization review" | Re-trigger Greptile

Comment thread packages/targets/pkg-jsr/src/index.ts
Comment thread packages/targets/pkg-jsr/src/index.ts
@ayskobtw-lil
Copy link
Copy Markdown
Author

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.

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.

1 participant