Skip to content

fix: normalize Windows project file paths#1

Open
VIVEHACKER wants to merge 1 commit intomainfrom
codex/fix-cloud-task-creation-error
Open

fix: normalize Windows project file paths#1
VIVEHACKER wants to merge 1 commit intomainfrom
codex/fix-cloud-task-creation-error

Conversation

@VIVEHACKER
Copy link
Copy Markdown
Owner

Motivation

  • Server-side flows that inspect or write project files were failing when snapshots or inputs used Windows-style absolute paths (drive letters/backslashes), causing downstream operations like computing diffs or detecting package.json to behave incorrectly.
  • Normalize and safely resolve repo-relative paths so preview, sandbox, and session logic work consistently for projects originating from Windows checkouts and cloud (Linux) runners.

Description

  • Add apps/platform-api/src/common/file-path.utils.ts providing normalizeProjectFilePath, resolveProjectFilePath, and matchesProjectFilePath utilities to normalize Windows drive prefixes, convert backslashes, and perform tolerant suffix-based matching.
  • Update preview flow (apps/platform-api/src/modules/preview/preview.service.ts) to detect package.json via matchesProjectFilePath and to write files using resolveProjectFilePath.
  • Update sandbox build flow (apps/platform-api/src/modules/sandbox/sandbox.service.ts) to detect package.json/tsconfig* with matchesProjectFilePath and to write files using resolveProjectFilePath prior to install/build steps.
  • Update session framework detection (apps/platform-api/src/modules/session/session.service.ts) to normalize incoming file paths with normalizeProjectFilePath and to locate package.json using matchesProjectFilePath.

Testing

  • Ran a targeted runtime check with pnpm --filter @ai-platform/platform-api exec ts-node --transpile-only -e "...file-path.utils" which printed normalized examples and validated that a Windows-style path matches package.json, and the check succeeded.
  • Attempted pnpm --filter @ai-platform/platform-api build to validate the service build, but the workspace build failed due to pre-existing TypeScript/Prisma typing errors unrelated to the path-normalization changes.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8517eac88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +20 to +22
export function resolveProjectFilePath(baseDir: string, filepath: string): string {
const normalizedPath = normalizeProjectFilePath(filepath);
return path.join(baseDir, normalizedPath);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Drop the preserved absolute path prefix before joining

When a snapshot contains an absolute file like C:\repo\package.json or /home/alice/repo/package.json, resolveProjectFilePath() writes it to <baseDir>/repo/package.json instead of <baseDir>/package.json. matchesProjectFilePath() still treats that same entry as the root manifest, so startPreview() and runBuild() invoke npm install from the workspace root (apps/platform-api/src/modules/preview/preview.service.ts:75-84, apps/platform-api/src/modules/sandbox/sandbox.service.ts:56-67), where no package.json exists. In the absolute-path cases this patch is meant to support, preview/build still fail.

Useful? React with 👍 / 👎.

VIVEHACKER added a commit that referenced this pull request Mar 20, 2026
Competitor analysis (Lovable, Bolt.new, v0, Replit, Firebase Studio)
identified browser preview and deployment as the #1 gap. Discovered
existing WebContainer + Vercel deploy code is implemented but dormant
due to useEffect dependency bug and snapshot-only deployment constraint.

Spec covers: WebContainer fix, deploy-from-current-state, error logging,
fallback chain. Rev 2 after two rounds of automated spec review.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant