• Will Chen's avatar
    Migrate to Zod v4 (#2415) · f0431145
    Will Chen 提交于
    ## Summary
    - Upgraded zod package from ^3.25.76 to ^4.3.6
    - Updated z.record() calls to use two arguments (key schema, value
    schema) as required by Zod v4
    - Changed ZodError.errors to ZodError.issues (API rename in v4)
    - Fixed type inference issues with complex generics in
    createStreamClient
    
    ## Test plan
    - [x] TypeScript type-checking passes (`npm run ts`)
    - [x] Linting passes (`npm run lint`)
    - [x] Unit tests pass (661/661 tests)
    - [x] E2E tests pass (195/213 tests - 12 failures are pre-existing flaky
    tests unrelated to Zod)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2415">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Medium Risk**
    > Medium risk because this upgrades a core validation library and
    adjusts IPC schema/handler typings; behavioral changes in Zod
    parsing/record typing could surface at runtime if any edge cases differ.
    > 
    > **Overview**
    > Upgrades `zod` from v3 to v4 (and bumps `zod-to-json-schema`),
    updating the lockfile and keeping a nested v3 `zod` for
    `@modelcontextprotocol/sdk`.
    > 
    > Updates IPC validation code to match Zod v4: switches
    `ZodError.errors` to `ZodError.issues`, updates all `z.record(...)`
    usages to the new `z.record(keySchema, valueSchema)` signature, and
    applies a few TypeScript workarounds (notably in `createStreamClient`
    key handling and `registerTypedHandlers` casting) to avoid inference
    breaks under v4.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    2e1becc1b56c343ee969e86de2146e36d255e7ae. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Migrated the codebase to Zod v4. Updated record schemas and error
    handling, plus small type fixes in IPC; no runtime changes expected.
    
    - **Dependencies**
      - Upgraded zod to ^4.3.6.
      - Bumped zod-to-json-schema to 3.25.1.
    
    - **Refactors**
      - Replaced z.record(value) with z.record(key, value) across schemas.
      - Switched ZodError.errors to ZodError.issues in handlers.
    - Improved createStreamClient key typing (string | number) and used
    safer Record<string, unknown> casts.
    - Added an explicit type assertion in registerTypedHandlers for handler
    registration.
    
    <sup>Written for commit 15413b80916c6816f7c24a59815663f502ac9e3d.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    Co-authored-by: 's avatarclaude[bot] <41898282+claude[bot]@users.noreply.github.com>
    f0431145
名称
最后提交
最后更新
.claude 正在载入提交数据...
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
makers 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.oxfmtrc.json 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CLA.md 正在载入提交数据...
CLAUDE.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
lint-staged.config.js 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...
windowsSign.ts 正在载入提交数据...