[world-local,world-vercel,world-postgres] Fix zod v3/v4 schema mismatch crash#1588
[world-local,world-vercel,world-postgres] Fix zod v3/v4 schema mismatch crash#1588VaguelySerious merged 1 commit intomainfrom
Conversation
…es to match @workflow/world schemas @workflow/world/queue.ts exports schemas created with zod/v4 (native). When consumers (world-local, world-vercel, world-postgres) import these schemas and embed them in z.object() calls using zod v3 compat, the v3 internal _parse() method is called on v4-native schemas which don't have it, causing "keyValidator._parse is not a function". Fix by changing all queue-related files that import v4-native schemas from @workflow/world to also use zod/v4. Closes #1587 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 52fe35a The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 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❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (59 failed)mongodb (2 failed):
redis (2 failed):
turso (55 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
workflow with 1 step💻 Local Development
▲ Production (Vercel)
workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details. |
karthikscale3
left a comment
There was a problem hiding this comment.
AI review: Approve — the fix is correct, minimal, and low-risk. Three observations:
-
Dead code in
world-vercel/src/queue.ts: After this change, the v3 fallback check (typeof MessageWrapper.encode === 'function') will always betruesinceMessageWrapperis now created with v4'sz. The fallback path is dead code — cleanup opportunity. -
Broader inconsistency:
@workflow/worldhas onlyqueue.tsusingzod/v4while all other files usezodv3 compat. If more files migrate to v4-only features in the future, the same class of mismatch bug could recur. Worth considering a lint rule or a comment warning consumers. -
Regression test is good — directly validates that v4-native schemas compose correctly with v4's
z.object(), which is the exact scenario that was broken.
Zod compat testing resultsChecked out the branch, built and tarballed the workflow package, then created a fresh Next.js project with Normal setups: no issueUnder standard pnpm, pnpm +
Reproducible with
|
…1-refresh * origin/main: (21 commits) Fix node-module-error plugin matching identifiers in multi-line comments (#1554) fix(swc-plugin): use binding name for class expression method registrations (#1599) fix(builders): override `sideEffects: false` for discovered workflow/step/serde entries (#1598) [world-vercel] align header names to `x-vercel-workflow-*` convention (#1602) [docs] Add vercel world consumer function security documentation (#1543) Make `start()` types `unknown` when `deploymentId` is provided (#1367) fix(next): stop force-setting WORKFLOW_PUBLIC_MANIFEST=1 during next dev (#1597) Version Packages (beta) (#1593) [docs] Tidy world API docs and document new stream helpers (#1581) Rename 'Workflow Development Kit' / 'DevKit' to 'Workflow SDK' (#1595) [world] Use zod/v4 in queue files to match @workflow/world schemas (#1588) [ai] Fix fatal stream errors surfacing as [object Object] (#1589) [web] Fix server crash on unmatched routes (#1590) docs: rename 'Complex Example' to 'Instance Methods as Steps' (#1592) Version Packages (beta) (#1563) [core] Extend flow route duration to "max" and fail runs where replay takes too long (#1567) fix: check target run capabilities before encrypting hook payloads (#1572) [core] Combine initial run fetch, event fetch, and run_started event creation (#1569) [docs] Split World API docs into sub-pages, update skill.md (#1457) [nitro] Preserve workflow step registration side effects (#1386) ... # Conflicts: # skills/workflow/SKILL.md
Closes #1587
Summary
@workflow/world/queue.tsexports schemas created withzod/v4(native). Whenworld-local,world-vercel, andworld-postgresimport these schemas and embed them insidez.object()calls usingzod(v3 compat layer), the v3 internal._parse()method is called on v4-native schemas which lack it, causingTypeError: keyValidator._parse is not a function.@workflow/worldto also useimport { z } from 'zod/v4'.world-localthat validates the schema compatibility.Test plan
workflow@4.2.0-beta.75+zod@^3.25world-localtests pass (262 existing + 1 new regression test)🤖 Generated with Claude Code