Repository navigation
chore(deps): move to the zod 4 package and keep the v3 API via zod/v3 - #3774
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: a48fcb3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
E2E Test Results✅ All tests passed • 474 passed • 1 skipped • 1155s
Tests ran across 4 shards in parallel. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (4 lines, under the 30-line bar for Tier 4), touches the query rendering engine lightly (2 lines, under the 150-line bar for Tier 4), 3 file(s) in private internal-tooling packages, excluded from the line count Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
e1909e7 to
99c0365
Compare
e1909e7 to
6b1295f
Compare
6b1295f to
0d8939e
Compare
3e4b1f2 to
612943f
Compare
612943f to
0f355e8
Compare
Bump zod from 3.25 to ^4.6.6 in api, app, common-utils and hdx-eval, and switch every import to 'zod/v3' so schemas keep the zod 3 API without a migration. yarn dedupe collapses the transitive zod 4 copies to 4.6.7. zod-express-middleware and @hookform/resolvers 3.9 only import zod in their type declarations; patch those to 'zod/v3' so they accept v3 schemas.
0f355e8 to
97d31e8
Compare
With the zod 4 package installed, 'zod' resolves to the v4 API, and editor auto-imports pick it. v4 schemas don't compose with the shared v3 schemas and throw a different ZodError class, so restrict 'zod', 'zod/v4' and 'zod/mini' in api, app, common-utils and hdx-eval. Enabling no-restricted-imports made four leftover eslint-disable directives for it (from the old relative-import rule) report as unused; keep their reasons as plain comments.
Summary
Stacked on #3773.
Zod 4.6.6 has been patched for a significant bug. Migrating every schema to the zod 4 API is a large change across the repo. This PR moves to the zod 4 package and keeps the zod 3 API through its
zod/v3subpath.zodfrom3.25to^4.6.6in api, app, common-utils and hdx-eval.yarn dedupe zodcollapses the transitive zod 4 copies (MCP SDK, knip and others) to 4.6.7, so the lockfile has a single zod.from 'zod'imports tofrom 'zod/v3'. No schema code changes.yarn patches forzod-express-middleware@1.4.0and@hookform/resolvers@3.9.0. Both only import zod in their.d.tsfiles, so each patch changes that one import tozod/v3. Without them, every route validator and form resolver fails to type check against the zod 4 root types.References