Skip to content

fix: make generated app validation portable to Windows - #1425

Merged
kang-heewon merged 11 commits into
trunkfrom
fix/1321-cross-platform-scaffold
Jul 22, 2026
Merged

fix: make generated app validation portable to Windows#1425
kang-heewon merged 11 commits into
trunkfrom
fix/1321-cross-platform-scaffold

Conversation

@kang-heewon

@kang-heewon kang-heewon commented Jul 18, 2026

Copy link
Copy Markdown
Member

Outcome

The published scaffold now resolves packaged template URLs through platform-aware file paths, including encoded spaces and Windows drive URLs. Machine-readable success output exposes executable command, args, and cwd fields instead of shell-escaped strings, while human output retains platform-specific navigation guidance.

Generated SaaS, AI-SaaS, SPA, and admin validation scripts use declared package binaries with portable quoting and no inline POSIX environment assignments or direct node_modules binary paths. Generated-app smoke execution supports Windows command shims, and CI now runs a packed CLI from a Windows path containing spaces plus the SaaS contract snapshot, contract verification, doctor, typecheck, and build path.

This resolves the P1 scaffold portability gap without adding dependencies or promising package-manager support beyond pnpm.

Fixes #1321

Verification

  • pnpm --filter create-croco-app test — 111/111
  • focused generated-smoke and CI workflow suites — 48/48
  • pnpm --filter create-croco-app typecheck
  • pnpm build --filter=create-croco-app...
  • packed tarball execution from a path containing spaces — project generated with structured JSON next steps
  • goal-saas-api generated-app case — contract snapshot, contract verification, doctor, typecheck, build, test, demo flow, and failure drill passed
  • pnpm strict-contract-typecheck — 590 baseline diagnostics matched
  • pnpm check
  • pre-push pnpm test — 226/226 tasks
  • pre-push pnpm typecheck — 225/225 tasks
  • independent adversarial review — CLEAR

Review gates

  • Correctness/regression: PASS — encoded-space and Windows-drive fixtures cover template resolution; JSON output has direct execution fields; packed contents generate successfully from a spaced path; the representative SaaS validation path and existing package tests pass.
  • API/security/compatibility/release: PASS — failure diagnostics and recovery remain covered and unchanged; the intentional machine-output contract change has a minor changeset; dependencies, lockfile, package manifests, and 111 public API snapshots are unchanged.
  • Maintainability/minimality: PASS — the implementation uses fileURLToPath, existing declared binaries, and one Windows .cmd execution boundary; template edits are limited to portable command forms and CI evidence.

The Windows runner result is intentionally left to the new required CI job; no issue-scoped local validation gap remains.

Summary by CodeRabbit

  • 새 기능

    • 생성 완료 결과에서 다음 실행 단계가 명령어/인자/작업 경로를 포함한 구조화된 형식으로 제공됩니다.
    • 운영체제에 맞는 경로 이동 및 실행 안내가 더 정확해졌습니다.
  • 버그 수정

    • POSIX 호환 셸 없이도 Windows에서 앱 생성·검증이 정상 동작합니다.
    • 공백/특수문자 및 Windows 드라이브 경로 환경에서 템플릿 경로와 후속 명령 처리 정확도가 개선되었습니다.
    • 계약·DI·OpenAPI 관련 스크립트 실행 호환성이 향상되었습니다.
  • 테스트

    • Windows 및 다양한 경로 형식에 대한 생성/스모크 검증 범위가 확대되었습니다.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kang-heewon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ddccd192-6c56-4276-87b0-a5291fc00982

📥 Commits

Reviewing files that changed from the base of the PR and between dd5f368 and 745b722.

📒 Files selected for processing (8)
  • .changeset/portable-croco-scaffolds.md
  • packages/create-croco-app/src/cli-result.ts
  • packages/create-croco-app/src/tests/cli-result.spec.ts
  • packages/openapi-spec/src/libs/loadControllers.ts
  • packages/openapi-spec/src/tests/loadControllers.spec.ts
  • packages/rpc-codegen/src/libs/loadRoutes.ts
  • packages/rpc-codegen/src/tests/loadRoutes.spec.ts
  • tsconfig/contract-strict.baseline.json
📝 Walkthrough

Walkthrough

create-croco-app이 Windows 경로와 명령 실행을 지원하도록 CLI 결과, 템플릿 스크립트, 계약 로더, smoke 실행기를 수정했습니다. Windows 패키징 검증 잡과 관련 테스트, changeset도 추가되었습니다.

Changes

크로스 플랫폼 스캐폴드

Layer / File(s) Summary
CLI 결과 계약과 경로 해석
packages/create-croco-app/src/cli-result.ts, packages/create-croco-app/src/options.ts, packages/create-croco-app/src/template-path.ts, packages/create-croco-app/src/tests/*
nextSteps{ command, args, cwd } 구조로 변경되고, 템플릿 경로·Windows 디렉터리 해석·human-readable 명령 출력이 플랫폼별로 처리됩니다.
생성 템플릿과 경로 기반 로더
packages/create-croco-app/templates/*/package.json.hbs, packages/framework-routes/scripts/generate-routes.js, packages/openapi-spec/src/*, packages/rpc-codegen/src/*
생성 스크립트의 POSIX 전용 환경변수 할당과 명시적 실행 경로를 제거하고, 컨트롤러·공통 디렉터리·node_modules 경로 처리를 Windows 호환 방식으로 변경합니다.
생성 템플릿 계약 검증
packages/create-croco-app/src/tests/e2e-generation.spec.ts, packages/create-croco-app/src/tests/templates-build.spec.ts
SaaS 및 AI SaaS 생성 결과의 contract, project-map, DI, doctor 스크립트 기대값과 비이식적 명령 금지 검증을 갱신합니다.
Windows 패키징 및 smoke 실행
.github/workflows/ci.yml, scripts/create-croco-app-generated-smoke.mts, scripts/strict-contract-typecheck.mts, scripts/tests/*
Windows runner에서 패키징된 CLI를 실행하고, corepack.cmd 선택과 조건부 shell 실행 및 contract·doctor validation을 적용합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WindowsCI
  participant CreateCrocoApp
  participant GeneratedProject
  participant SmokeValidation
  WindowsCI->>CreateCrocoApp: 패키징된 CLI 실행
  CreateCrocoApp->>GeneratedProject: 공백 포함 Windows 경로에 scaffold 생성
  SmokeValidation->>GeneratedProject: corepack.cmd로 install 실행
  SmokeValidation->>GeneratedProject: contract 및 doctor validation 실행
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 Windows에서 생성 앱 검증을 포터블하게 만드는 주요 변경을 정확히 요약합니다.
Linked Issues check ✅ Passed 템플릿 경로, 구조화된 nextSteps, 포터블 스크립트, Windows scaffold CI가 #1321의 핵심 요구를 충족합니다.
Out of Scope Changes check ✅ Passed 요약된 변경은 모두 Windows 포터빌리티와 생성 검증 경로 개선에 직접 연결되어 보입니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1321-cross-platform-scaffold

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 8.8μs 30.0ms 8.2μs +7.9% -
CrocoApp lambdaHandler (10 controllers) 245.0μs 50.0ms 258.4μs -5.2% -
Lambda cold-start simulation 425.6μs 80.0ms 418.1μs +1.8% -
Lambda cold-start with headers 389.7μs 80.0ms 369.7μs +5.4% -
Lambda cold-start with binary body 360.4μs 80.0ms 339.1μs +6.3% -
Lambda cold-start with query params 310.5μs 80.0ms 301.3μs +3.1% -
Lambda cold-start with authorizer context 310.8μs 80.0ms 299.8μs +3.7% -
Lambda cold-start realistic scenario 307.4μs 80.0ms 299.2μs +2.7% -
EventBusConfig.start (10 handlers) 1.5μs 10.0ms 1.4μs +5.6% -
EventPublisher.publishNow single event 1.8μs 2.0ms 1.7μs +4.8% -
DefaultHandlerResolver.resolve × 10 0.1μs 5.0ms 0.1μs +0.0% -
Container.get singleton (cold) 76.4μs 5.0ms 70.3μs +8.7% -
Container.register × 50 components 3.4ms 10.0ms 3.2ms +4.6% -
Container.validate (50 components) 3.8ms 20.0ms 3.4ms +12.3% -
Container.get singleton (warm) 1.6μs 500.0μs 1.6μs +0.1% -
TelemetryRuntime.init (lambda preset) 2.3μs 200.0ms 1.1ms -99.8% -
lambdaPreset config creation 1.5μs 2.0ms 1.4μs +5.0% -

Updated: 2026-07-22T18:28:23.572Z · Commit: 3e3b53d

@kang-heewon
kang-heewon force-pushed the fix/1321-cross-platform-scaffold branch from 91b4135 to dd5f368 Compare July 22, 2026 17:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/create-croco-app-generated-smoke.mts (1)

2345-2368: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

검증 실패를 Problem 하위 클래스로 교체하세요.

scripts/create-croco-app-generated-smoke.mts:2345-2368throw new Error(...)는 코딩 가이드라인의 “Throw only Problem subclasses, never generic Error instances”와 RFC 7807 Problem contract에 맞지 않습니다. codecategory를 포함하는 전용 Problem 하위 클래스로 교체하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/create-croco-app-generated-smoke.mts` around lines 2345 - 2368,
Replace the generic Error throws in the generated package validation checks with
a dedicated Problem subclass that includes the required code and category
fields. Update each validation failure in the smoke-test logic around the
engines.node, .nvmrc, README guidance, and runtime-target checks to instantiate
that subclass while preserving the existing messages.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 419-428: Pin the action references in the CI workflow’s checkout,
pnpm setup, and Node.js setup steps to their verified full commit SHAs instead
of the mutable `@v4` tags, and add comments documenting the corresponding action
versions.
- Around line 413-419: Update the windows-scaffold job to declare permissions
with contents read-only, and configure its actions/checkout step with
persist-credentials disabled. Apply both changes specifically to the job and
checkout configuration without altering the remaining workflow steps.

In `@packages/framework-routes/scripts/generate-routes.js`:
- Around line 9-12: Rename the module constant sampleControllerSourcePath to
SAMPLE_CONTROLLER_SOURCE_PATH and update all references, including the
additional affected locations. Change the strings added or modified in this
change to single-quoted literals while preserving the existing behavior.

In `@scripts/create-croco-app-generated-smoke.mts`:
- Line 257: Rename the module constant corepackCommand to COREPACK_COMMAND and
update every reference to use the new SCREAMING_SNAKE_CASE name, preserving the
existing platform-specific command selection.

---

Outside diff comments:
In `@scripts/create-croco-app-generated-smoke.mts`:
- Around line 2345-2368: Replace the generic Error throws in the generated
package validation checks with a dedicated Problem subclass that includes the
required code and category fields. Update each validation failure in the
smoke-test logic around the engines.node, .nvmrc, README guidance, and
runtime-target checks to instantiate that subclass while preserving the existing
messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7d4307b5-31b1-4bd4-b909-221acd65cdc2

📥 Commits

Reviewing files that changed from the base of the PR and between f2ba7b8 and dd5f368.

📒 Files selected for processing (23)
  • .changeset/portable-croco-scaffolds.md
  • .github/workflows/ci.yml
  • packages/create-croco-app/src/cli-result.ts
  • packages/create-croco-app/src/options.ts
  • packages/create-croco-app/src/template-path.ts
  • packages/create-croco-app/src/tests/TemplatePath.spec.ts
  • packages/create-croco-app/src/tests/cli-result.spec.ts
  • packages/create-croco-app/src/tests/e2e-generation.spec.ts
  • packages/create-croco-app/src/tests/options.spec.ts
  • packages/create-croco-app/src/tests/templates-build.spec.ts
  • packages/create-croco-app/templates/admin-console/package.json.hbs
  • packages/create-croco-app/templates/ai-saas/package.json.hbs
  • packages/create-croco-app/templates/saas/package.json.hbs
  • packages/create-croco-app/templates/spa-be-split/package.json.hbs
  • packages/framework-routes/scripts/generate-routes.js
  • packages/openapi-spec/src/libs/loadControllers.ts
  • packages/openapi-spec/src/tests/loadControllers.spec.ts
  • packages/rpc-codegen/src/libs/loadRoutes.ts
  • packages/rpc-codegen/src/tests/loadRoutes.spec.ts
  • scripts/create-croco-app-generated-smoke.mts
  • scripts/strict-contract-typecheck.mts
  • scripts/tests/create-croco-app-generated-smoke.spec.ts
  • tsconfig/contract-strict.baseline.json

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread packages/framework-routes/scripts/generate-routes.js
Comment thread scripts/create-croco-app-generated-smoke.mts
@kang-heewon
kang-heewon merged commit fcb2c3c into trunk Jul 22, 2026
10 checks passed
@kang-heewon
kang-heewon deleted the fix/1321-cross-platform-scaffold branch July 22, 2026 19:24
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.

[create-croco-app] Make the packaged CLI and generated scripts cross-platform

1 participant