Skip to content

fix(devkit): scaffold zod@^4 — fresh apps fail npm install against published sdk - #293

Merged
blove merged 1 commit into
mainfrom
blove/scaffold-zod4
Jul 6, 2026
Merged

fix(devkit): scaffold zod@^4 — fresh apps fail npm install against published sdk#293
blove merged 1 commit into
mainfrom
blove/scaffold-zod4

Conversation

@blove

@blove blove commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

P0 found by production smoke: every fresh `npm create dawn-ai-app` + `npm install` fails with ERESOLVE. The app templates pin `zod@^3.24.0`, but published `@dawn-ai/sdk` (0.8.5) declares `peerOptional zod@^4.0.0` — npm's strict peer resolution rejects the tree. `--legacy-peer-deps` is not an escape hatch (it skips peer installs → `@langchain/core` unresolvable at runtime).

Why CI never saw it: the generated-app harness installs with pnpm, which tolerates unmet optional peers. The break only manifests with npm against the real registry — exactly the new-user path.

Fix: templates scaffold `zod@^4.0.0` (research + basic), harness fixtures updated. Template code uses only `z.object`/`z.string` (both majors); `@langchain/core` accepts `^3.25.76 || ^4`. Validated manually against the real registry: with `^4` the strict npm install succeeds and `dawn check`/`dev` run.

Tests

  • create-dawn-ai-app 5/5, devkit 9/9, full generated-app lane 15/15 (scaffold-tree comparisons + publish-lifecycle via test registry).

Follow-up (separate)

Consider widening sdk's peer to `^3.25.76 || ^4` for existing zod-3 apps — this PR fixes the broken new-user funnel without touching published semantics.

🤖 Generated with Claude Code

…published sdk

Production smoke found every fresh `npm create dawn-ai-app` broken at
`npm install`: the templates pin zod@^3.24.0 but the published
@dawn-ai/sdk declares peerOptional zod@^4, which npm's strict peer
resolution rejects (ERESOLVE). Invisible to CI because the harness
installs with pnpm, which tolerates unmet optional peers. Verified
against the real registry: with zod@^4 the strict install succeeds
(@langchain/core accepts ^3.25.76 || ^4; template code uses only
z.object/z.string, present in both majors).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dawnai Ready Ready Preview, Comment Jul 6, 2026 3:02pm

Request Review

@blove
blove enabled auto-merge (squash) July 6, 2026 15:01

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 1m 17s —— View job


Code Review

  • Gather context
  • Read diff and changed files
  • Analyze for correctness, security, type-safety, test coverage
  • Post findings

This PR looks correct and the fix is well-scoped. A few notes:

Root cause confirmed. packages/sdk/package.json:42-48 declares peerDependencies: { zod: "^4.0.0" } with optional: true. npm's strict resolver still rejects a ^3.24.0 install when an optional peer is declared as ^4 — the PR description is accurate.

Zod API usage is safe across majors. Template source files use only z.object, z.string, z.string().default(), and z.string().describe() — all stable in both v3 and v4. No breaking surface introduced.

Fixture coverage is complete. All four locations that pinned zod@^3.24.0 were updated (app-basic template, app-research template, basic.expected.json, custom-app-dir.expected.json). The remaining fixtures (*-runtime.expected.json, handwritten-runtime.expected.json) don't snapshot package.json dependencies so no changes needed there.

Changeset is correct. Both @dawn-ai/devkit and create-dawn-ai-app tagged as patch is the right bump for a dependency version fix.

One gap to be aware of (not a blocker): the PR only covers new scaffolds. Existing apps that were generated with zod@^3.24.0 still have the mismatch against the published SDK. The PR description calls this out as a follow-up (widening the SDK peer to ^3.25.76 || ^4), which is the right call — that's a published-package semantic change that deserves its own review.

No correctness bugs, no security issues, no type-safety problems. The test assertions match the template changes. Good to merge.

@blove
blove merged commit ef2e583 into main Jul 6, 2026
9 checks passed
@blove
blove deleted the blove/scaffold-zod4 branch July 6, 2026 15:12
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