Skip to content

chore(deps): bump zod + react-hook-form - #7074

Merged
KATT merged 10 commits into
mainfrom
12-23-zod
Dec 23, 2025
Merged

KATT merged 10 commits into
mainfrom
12-23-zod

Conversation

@KATT

@KATT KATT commented Dec 23, 2025 •

Copy link
Copy Markdown
Member

bump zod - ref #7073 (review)

Summary by CodeRabbit

  • Chores

    • Upgraded Zod to v4 across the repo and updated related form/resolver packages and typings.
    • Minor environment default adjusted (TYPEDOC).
  • Documentation

    • Added a new "zod v4" async-iterable validation example in subscriptions docs.
  • Chores / Examples

    • Removed one experimental react-hook-form factory/example from the demo app.
  • Notes

    • Tests and snapshots updated to reflect new validation error formatting; no other user-facing behavior changes expected.

✏️ Tip: You can customize this high-level summary in your review settings.

@KATT
KATT requested review from a team as code owners December 23, 2025 12:39
@railway-app

railway-app Bot commented Dec 23, 2025 •

Copy link
Copy Markdown

πŸš… Deployed to the pr-afb247-7074 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-sse-chat 😴 Sleeping (View Logs) Web Dec 23, 2025 at 2:59 pm
next-prisma-websockets-starter 😴 Sleeping (View Logs) Dec 23, 2025 at 2:54 pm

@coderabbitai

coderabbitai Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Monorepo-wide Zod upgrade to v4 with dependent package bumps, TypeScript typing adjustments in React Hook Form integrations, updated resolver options, many test snapshot updates to new error shapes, documentation addition for zAsyncIterable (zod v4), some import-path fixes, and removal of a React Hook Form factory example file.

Changes

Cohort / File(s) Summary
Monorepo package.json bumps
package.json, packages/next/package.json, packages/react-query/package.json, packages/server/package.json, packages/tanstack-react-query/package.json, packages/upgrade/package.json, www/package.json, www/og-image/package.json, examples/*/package.json, examples/.test/*/package.json, examples/.experimental/next-app-dir/package.json, packages/tests/package.json
Bumped zod from ^3.25.51 β†’ ^4.2.1 across many manifests; some example manifests also updated react-hook-form, @hookform/resolvers, and zod-form-data.
React Hook Form / Zod typings & resolver updates
examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx, examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx, examples/next-formdata/src/pages/react-hook-form.tsx
Tightened Zod generic parameterization (removed middle any), changed hook generics to use TInput extends FieldValues, switched useForm generics to TInput, and added { raw: true } to zodResolver; refactored formRef handling in one example.
Removed example files / UI entry
examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormFactoryExample.lib.tsx, examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormFactoryExample.tsx, examples/.experimental/next-app-dir/src/app/server-action/page.tsx
Deleted a form factory implementation and its consumer example; removed the example from the page's components list.
Documentation: zAsyncIterable (Zod v4) example
www/docs/server/subscriptions.md
Added a new zod v4 zAsyncIterable example (v4 signature without middle any) and reorganized v4/v3 example sections.
Tests: snapshots & error shape updates
packages/tests/server/*, packages/tests/server/adapters/*, packages/tests/server/errorFormatting.test.ts, packages/tests/server/errors.test.ts, packages/tests/server/httpSubscriptionLink.test.ts, packages/tests/server/index.test.ts, packages/tests/server/input.test.ts, packages/tests/server/streaming.test.ts, packages/tanstack-react-query/test/queryOptions.test.tsx, packages/server/src/unstable-core-do-not-import/procedureBuilder.test.ts
Updated inline snapshots and expectations to match Zod v4 error formatting (messages now prefixed with "Invalid input: ..."), removed some received/expected fields, adjusted type references, and simplified a test assertion to use snapshot matching.
Zod import/compat adjustments
packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts, www/og-image/utils/zodParams.ts
Switched import paths between 'zod', 'zod/v3', and 'zod/v4' where needed for compatibility with examples/tests.
API/type signature adjustments (tests/helpers)
packages/tests/server/zAsyncIterable.ts
Changed internal Zod type parameter shapes for zAsyncIterable helper signatures (removed the middle any in several ZodType generics).
Small runtime/config change
www/src/utils/env.js
TYPEDOC env default changed from string '1' to boolean true in env parsing.

Sequence Diagram(s)

(Skipped β€” changes are dependency/type updates, tests, docs, example refactors and deletions; no new multi-component runtime control flow to diagram.)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

  • chore: simplify ciΒ #6905 β€” related changes around example removals and example-tree modifications that overlap with deleted example files in this PR.

Suggested labels

♻️ autoupdate

Suggested reviewers

  • juliusmarminge

Poem

🐰 I hopped through packages, bumped Zod with delight,
Types trimmed and docs expanded under moonlight.
Snapshots updated, examples tidied neat,
I nibbled through imports and left tests complete. ✨πŸ₯•

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description does not follow the repository template, missing the 'Changes' section and checklist items required by the contributing guidelines. Expand the description to include the 'Changes' section explaining the zod upgrade implications and complete the checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (1 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately describes the main changes across the PR: updating zod and react-hook-form dependencies in package.json files and related code adaptations.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 12-23-zod

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

@vercel

vercel Bot commented Dec 23, 2025 •

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
next-prisma-starter Ready Ready Preview Dec 23, 2025 2:42pm
og-image Ready Ready Preview, Comment Dec 23, 2025 2:42pm

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx (1)

12-25: Zod v4 type signature is correct, but @hookform/resolvers does not support Zod v4.

The change from z.ZodType<any, any, TInput> to z.ZodType<any, TInput> is accurate for Zod v4's simplified generics. However, @hookform/resolvers/zod has unresolved compatibility issues with Zod v4: multiple GitHub issues report TypeScript type errors and runtime failures. The react-hook-form team is still tracking this in open issues with no official Zod v4-compatible resolver released yet.

Either keep Zod at v3, switch to React Hook Form's Standard Schema integration, or apply a custom resolver wrapper until official Zod v4 support lands in @hookform/resolvers.

♻️ Duplicate comments (6)
packages/react-query/package.json (1)

115-115: Zod v4 upgrade verified in devDependencies.

The version bump is consistent with the monorepo-wide upgrade. Since this is in devDependencies, verify that test code using Zod has been updated for v4 compatibility.

packages/tanstack-react-query/package.json (1)

77-77: Zod v4 upgrade verified in devDependencies.

The version bump is consistent with the monorepo-wide upgrade.

examples/.test/ssg/package.json (1)

23-23: Zod v4 upgrade verified.

The version bump is consistent with the monorepo-wide upgrade.

www/package.json (1)

65-65: Zod v4 upgrade verified.

The version bump is consistent with the monorepo-wide upgrade.

examples/lazy-load/package.json (1)

16-16: Zod v4 upgrade verified.

The version bump is consistent with the monorepo-wide upgrade.

examples/lambda-api-gateway-streaming/package.json (1)

17-17: Zod v4 upgrade verified.

The version bump is consistent with the monorepo-wide upgrade.

🧹 Nitpick comments (1)
www/og-image/utils/zodParams.ts (1)

1-1: Using Zod v3 compatibility layer.

This file intentionally uses the zod/v3 subpath export to maintain v3 API compatibility rather than migrating to v4. This is a valid approach provided by Zod v4 for gradual migration.

Consider migrating to the v4 API in a follow-up to maintain consistency across the codebase and benefit from v4 improvements.

πŸ“œ Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 305f6d2 and cd72b19.

β›” Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
πŸ“’ Files selected for processing (39)
  • examples/.experimental/next-app-dir/package.json
  • examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx
  • examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx
  • examples/.test/diagnostics-big-router/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/.test/monotest-api/package.json
  • examples/.test/ssg-infinite-serialization/package.json
  • examples/.test/ssg/package.json
  • examples/cloudflare-workers/package.json
  • examples/express-minimal/package.json
  • examples/express-server/package.json
  • examples/fastify-server/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • examples/lambda-api-gateway/package.json
  • examples/lambda-url/package.json
  • examples/lazy-load/package.json
  • examples/minimal-content-types/server/package.json
  • examples/minimal-react/server/package.json
  • examples/minimal/package.json
  • examples/next-big-router/package.json
  • examples/next-edge-runtime/package.json
  • examples/next-formdata/package.json
  • examples/next-minimal-starter/package.json
  • examples/next-prisma-starter/package.json
  • examples/next-prisma-todomvc/package.json
  • examples/next-prisma-websockets-starter/package.json
  • examples/next-sse-chat/package.json
  • examples/standalone-server/package.json
  • examples/vercel-edge-runtime/package.json
  • package.json
  • packages/next/package.json
  • packages/react-query/package.json
  • packages/server/package.json
  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • packages/tanstack-react-query/package.json
  • packages/upgrade/package.json
  • www/og-image/package.json
  • www/og-image/utils/zodParams.ts
  • www/package.json
🧰 Additional context used
πŸ““ Path-based instructions (5)
**/*.test.ts

πŸ“„ CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)

**/*.test.ts: ALWAYS use await using ctx = testServerAndClientResource(...) in tests that need both server and client setup
NEVER use the deprecated routerToServerAndClientNew() in tests
Import testServerAndClientResource from @trpc/client/__tests__/testClientResource
Create fresh mock instances per test using a factory (e.g., getMockFetch())
Do not use global mocks that persist across tests
Configure mocks via the client callback in testServerAndClientResource options
Use ctx.client from the test resource for making tRPC calls
Access server URLs via ctx.httpUrl and ctx.wssUrl
Configure server options via the server property in testServerAndClientResource options
Configure client options via the client callback in testServerAndClientResource options
Use descriptive test names that explain the behavior under test
Focus test names on what the test validates, not just what it does
Use proper TypeScript typing for mocks
Clear mocks between tests when needed
Use factory functions for mock creation to ensure isolation

Files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
**/*.{ts,tsx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Always use import type for type-only imports
Separate type imports from value imports
Avoid overzealous object destructuring; prefer direct property access
Object destructuring is acceptable when a variable is used 3+ times
Prefer array destructuring
Avoid sparse array destructuring
Never destructure in function parameter declarations
Avoid destructuring potentially nullish nested properties
Maximum 3 parameters per function; use options objects when more
Type parameter names must match /^(T|$)(A-Z)?[0-9]*$/
Prefix unused variables, parameters, and caught errors with _
Prefer namespace imports for validation libraries and large modules (e.g., import * as z from 'zod', import * as React from 'react')
Follow import order: test helpers, tRPC test imports, third-party, then relative
Never import from @trpc/*/src; import from the package root instead
Do not use Symbol.dispose or Symbol.asyncDispose; use makeResource()/makeAsyncResource()
Always use await using for resource cleanup
Prefer makeResource()/makeAsyncResource() over manual disposal logic
Avoid non-null assertions (!)
Use proper type guards and optional chaining instead of non-null assertions
Switch statements must be exhaustive for union types
Rely on TypeScript inference; avoid unnecessary explicit return/output types
Use explicit types at public API boundaries, for complex generic constraints, or when inference is insufficient/ambiguous
Use the satisfies operator to retain inference while enforcing shapes
Use as const for literal type inference when appropriate
Prefer explicit typing over any
Use type assertions sparingly
Leverage TypeScript strict mode features

Files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • www/og-image/utils/zodParams.ts
**/*.{ts,tsx,md,mdx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)

Files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • www/og-image/utils/zodParams.ts
{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do not use Testing Library waitFor; use vi.waitFor instead
Tests may use non-null assertions
Tests may have unused variables
Tests may allow floating promises

Files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
packages/**/*.{ts,tsx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

No console.log in packages; use proper logging instead

Files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
🧠 Learnings (25)
πŸ““ Common learnings
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer namespace imports for validation libraries and large modules (e.g., `import * as z from 'zod'`, `import * as React from 'react'`)
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer namespace imports for validation libraries and large modules (e.g., `import * as z from 'zod'`, `import * as React from 'react'`)

Applied to files:

  • package.json
  • examples/standalone-server/package.json
  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • examples/lambda-url/package.json
  • examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx
  • examples/next-formdata/package.json
  • examples/lambda-api-gateway/package.json
  • www/og-image/package.json
  • examples/next-edge-runtime/package.json
  • www/og-image/utils/zodParams.ts
  • examples/next-big-router/package.json
  • packages/upgrade/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx
  • examples/.test/diagnostics-big-router/package.json
  • packages/next/package.json
πŸ“š Learning: 2025-02-12T16:56:46.960Z
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6262
File: examples/minimal-react/client/package.json:16-17
Timestamp: 2025-02-12T16:56:46.960Z
Learning: In examples and codemods targeting future versions, dependencies may intentionally use upcoming versions (e.g., React v19) or `next` tags, even if those versions haven't been officially released yet.

Applied to files:

  • examples/.experimental/next-app-dir/package.json
  • examples/.test/ssg-infinite-serialization/package.json
  • examples/next-formdata/package.json
  • examples/next-minimal-starter/package.json
  • www/og-image/package.json
  • examples/next-edge-runtime/package.json
  • examples/next-sse-chat/package.json
  • examples/next-big-router/package.json
  • examples/next-prisma-starter/package.json
  • examples/next-prisma-todomvc/package.json
  • examples/.test/diagnostics-big-router/package.json
  • packages/next/package.json
πŸ“š Learning: 2025-06-09T14:01:20.033Z
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.

Applied to files:

  • examples/.experimental/next-app-dir/package.json
  • examples/standalone-server/package.json
  • examples/lambda-url/package.json
  • packages/tanstack-react-query/package.json
  • examples/.test/monotest-api/package.json
  • examples/lambda-api-gateway/package.json
  • examples/vercel-edge-runtime/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/express-server/package.json
  • examples/minimal-content-types/server/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • examples/minimal/package.json
  • examples/lazy-load/package.json
  • examples/express-minimal/package.json
  • examples/minimal-react/server/package.json
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Import both 'trpc/react-query' as rq (legacy) and 'trpc/tanstack-react-query' as trq (modern) when writing migration tests

Applied to files:

  • examples/.experimental/next-app-dir/package.json
  • examples/standalone-server/package.json
  • examples/lambda-url/package.json
  • packages/tanstack-react-query/package.json
  • examples/.test/monotest-api/package.json
  • examples/lambda-api-gateway/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/express-server/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • packages/react-query/package.json
  • examples/express-minimal/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Never import from `trpc/*/src`; import from the package root instead

Applied to files:

  • examples/standalone-server/package.json
  • examples/lambda-url/package.json
  • examples/lambda-api-gateway/package.json
  • examples/vercel-edge-runtime/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/express-server/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • examples/lazy-load/package.json
  • examples/express-minimal/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Import createTRPCReact from 'trpc/react-query' (legacy API)

Applied to files:

  • examples/standalone-server/package.json
  • examples/express-server/package.json
  • examples/express-minimal/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPC()` for TanStack React Query hooks access in components under test

Applied to files:

  • examples/standalone-server/package.json
  • packages/tanstack-react-query/package.json
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Import `testServerAndClientResource` from `trpc/client/__tests__/testClientResource`

Applied to files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • examples/lambda-api-gateway/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/minimal/package.json
  • examples/lazy-load/package.json
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Do NOT import legacy-only helpers like createAppRouter from './__testHelpers' in upgrade-package tests

Applied to files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • examples/.test/monotest-api/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/.test/diagnostics-big-router/package.json
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : NEVER use the deprecated `routerToServerAndClientNew()` in tests

Applied to files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Do NOT import `testReactResource` from `./test/__helpers` (wrong path)

Applied to files:

  • packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts
  • packages/tanstack-react-query/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Follow import order: test helpers, tRPC test imports, third-party, then relative

Applied to files:

  • examples/lambda-url/package.json
  • examples/.test/monotest-api/package.json
  • examples/lambda-api-gateway/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/lambda-api-gateway-streaming/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React testing utilities with `import * as React from 'react';`

Applied to files:

  • packages/tanstack-react-query/package.json
  • examples/.test/ssg/package.json
  • examples/next-prisma-starter/package.json
  • examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React Query types from `tanstack/react-query` as needed

Applied to files:

  • packages/tanstack-react-query/package.json
  • examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import TanStack React Query utilities from the package source via `../src`

Applied to files:

  • packages/tanstack-react-query/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Render via `ctx.renderApp()` and rerender via `ctx.rerenderApp()` instead of custom providers

Applied to files:

  • packages/tanstack-react-query/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Do NOT import legacy helpers like `createAppRouter` from `./__testHelpers`

Applied to files:

  • packages/tanstack-react-query/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Use explicit types at public API boundaries, for complex generic constraints, or when inference is insufficient/ambiguous

Applied to files:

  • examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx
πŸ“š Learning: 2025-02-19T20:31:52.088Z
Learnt from: barelyhuman
Repo: trpc/trpc PR: 6530
File: packages/upgrade/src/bin/cli.ts:218-222
Timestamp: 2025-02-19T20:31:52.088Z
Learning: The CLI options `trpcFile` and `trpcImportName` in `packages/upgrade/src/bin/cli.ts` are temporary and planned to be removed in favor of using automatically discovered references from the TypeScript program.

Applied to files:

  • examples/lambda-api-gateway/package.json
  • examples/vercel-edge-runtime/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/lazy-load/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPCClient()` for direct (vanilla) tRPC client access in tests

Applied to files:

  • examples/lambda-api-gateway/package.json
  • examples/.test/monotest-api-router01/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Import getUntypedClient from 'trpc/client' when an untyped client is needed

Applied to files:

  • examples/lambda-api-gateway/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Share common functionality through `trpc/server` and keep client/server concerns separate

Applied to files:

  • examples/vercel-edge-runtime/package.json
  • examples/minimal-content-types/server/package.json
  • examples/minimal/package.json
  • examples/lazy-load/package.json
  • examples/minimal-react/server/package.json
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant

Applied to files:

  • examples/.test/monotest-api-router01/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.tsx : Follow React Hooks rules (React Compiler compatible patterns)

Applied to files:

  • examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx
🧬 Code graph analysis (1)
examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx (1)
examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx (1)
  • useZodForm (12-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint and auto-fix
  • GitHub Check: typecheck
  • GitHub Check: build
  • GitHub Check: unit and integration tests
πŸ”‡ Additional comments (31)
examples/.test/ssg-infinite-serialization/package.json (1)

23-23: No code adjustments needed for this Zod v4 upgrade in this example.

While Zod v4 does include breaking changes, this example only uses .default() in a compatible pattern (setting output values when input is undefined). The other breaking changes mentionedβ€”z.record() requiring both schemas, z.function() API redesign, string validators as standalone functions, and z.number() restrictionsβ€”are not used in this codebase. The current .default() usage with z.number().default(3) and .default({}) works as intended in v4.

packages/server/src/unstable-core-do-not-import/clientish/serialize.test.ts (1)

1-1: LGTM!

The import path change from zod/v4 to zod correctly aligns with Zod v4 now being the primary export. All schema methods used in the tests (z.json(), z.object(), z.tuple(), etc.) are available in the v4 API.

examples/minimal-react/server/package.json (1)

13-13: LGTM!

Standard Zod version bump as part of the monorepo-wide upgrade.

examples/next-prisma-websockets-starter/package.json (1)

57-57: LGTM!

Standard Zod version bump. The example's dependencies (tRPC, superjson, Next.js) are compatible with Zod v4.

package.json (1)

75-75: LGTM!

Root-level Zod version bump ensures consistent versioning across the monorepo.

examples/next-big-router/package.json (1)

21-21: LGTM!

Standard Zod version bump for the next-big-router example.

examples/express-minimal/package.json (1)

21-21: LGTM!

Standard Zod version bump for the express-minimal example.

examples/cloudflare-workers/package.json (1)

13-13: LGTM!

Standard Zod version bump for the cloudflare-workers example.

examples/lambda-api-gateway/package.json (1)

18-18: LGTM - Consistent Zod v4 upgrade.

The version bump aligns with the monorepo-wide upgrade to Zod v4.2.1.

examples/next-edge-runtime/package.json (1)

19-19: LGTM - Consistent upgrade.

The Zod v4.2.1 upgrade aligns with the monorepo-wide update.

examples/.test/monotest-api-router01/package.json (1)

19-19: LGTM - Consistent test package upgrade.

The Zod v4.2.1 upgrade is consistent with the monorepo-wide update.

examples/.test/diagnostics-big-router/package.json (1)

18-18: LGTM - Upgrade with related type adjustments.

The Zod v4.2.1 upgrade is consistent. The AI summary indicates related type adjustments have been made in form handling code (Form.tsx, ReactHookFormExample.tsx) to accommodate Zod v4's type changes, which demonstrates proper migration effort.

packages/server/package.json (1)

223-223: LGTM - Zod v4.2.1 upgrade is compatible with server tests.

Verified that server-side tests use standard Zod patterns (z.object, z.string, z.number, z.array, z.tuple, z.union, z.lazy, z.promise, z.map, z.set, z.enum, and type modifiers) which are all stable in Zod v4.x. The comprehensive schema serialization test exercises a broad range of Zod features with no compatibility concerns.

examples/next-minimal-starter/package.json (1)

20-20: No action requiredβ€”code is already Zod v4 compatible.

The example code does not exhibit any of the breaking change patterns warned about. The schema uses .finite() and .nonnegative() on number validation, which are the correct patterns for Zod v4. Error customization, .default() behavior, and record schema are not used in this example, so no changes are needed.

www/og-image/package.json (1)

14-14: The 'zod/v3' import path is a documented backwards compatibility layer in Zod v4.2.1 and does not require verification. The Zod library explicitly provides permanent subpath exports ('zod/v3' and 'zod/v4') to support safe coexistence of multiple Zod versions. The code in zodParams.ts functions correctly with this import.

Consider updating the import style to use namespace imports (import * as z from 'zod/v3') to align with the project's coding guidelines for validation libraries.

Likely an incorrect or invalid review comment.

packages/next/package.json (1)

140-140: Verify Zod v4 compatibility in test suite, particularly around error handling changes.

Zod v4 introduces breaking changes that may affect test code: the error customization API changed from per-schema options (message, required_error, invalid_type_error) to a single error option; ZodError methods (.format(), .flatten(), .formErrors) were removed; and transform/refine semantics changed. If @trpc/next tests use Zod schemas with error customization or error formatting, ensure patterns are migrated to Zod v4 equivalents.

examples/lambda-url/package.json (1)

17-17: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/fastify-server/package.json (1)

26-26: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/.experimental/next-app-dir/package.json (1)

35-35: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 is consistent with the monorepo-wide bump. The AI summary indicates related TypeScript changes were made in Form.tsx and ReactHookFormExample.tsx within this example to accommodate zod v4 API changes.

examples/standalone-server/package.json (1)

21-21: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/.test/monotest-api/package.json (1)

20-20: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/vercel-edge-runtime/package.json (1)

13-13: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/minimal/package.json (1)

17-17: Dependency upgrade looks good.

The zod upgrade to ^4.2.1 aligns with the monorepo-wide version bump.

examples/next-prisma-todomvc/package.json (1)

38-38: Remove generic verification concerns; no breaking changes apply to this example.

The zod upgrade in this example uses only basic patterns (z.object, z.string, z.boolean, z.uuid, .optional(), .min()) that are fully compatible with v4. The files referenced (Form.tsx, ReactHookFormExample.tsx) are in a different example directory and don't define zod schemas. None of the five breaking changes mentioned (z.number/infinite values, .default()/.prefault(), z.record() key schema, enum changes, z.function() redesign) appear in the actual code being upgraded.

Likely an incorrect or invalid review comment.

packages/upgrade/package.json (1)

51-51: LGTM!

The Zod v4 upgrade for this devDependency aligns with the monorepo-wide bump. Since this package only exposes upgrade scripts as a binary (per learnings), the impact is contained to development tooling.

examples/express-server/package.json (1)

21-21: LGTM!

Standard Zod v4 upgrade for the express server example.

examples/minimal-content-types/server/package.json (1)

13-13: LGTM!

Consistent with the monorepo-wide Zod v4 upgrade.

examples/next-sse-chat/package.json (1)

34-34: LGTM!

Zod v4 upgrade aligns with the monorepo-wide dependency bump.

examples/next-prisma-starter/package.json (1)

46-46: LGTM!

Standard Zod v4 upgrade for the Next.js + Prisma starter example.

examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsx (2)

5-5: LGTM on the import addition.

Adding FieldValues to the imports supports the updated generic constraint pattern.


15-28: Good refactor away from internal Zod type accessors.

The change from TSchema['_input'] to an explicit TInput extends FieldValues constraint is a solid improvement:

  1. Avoids relying on Zod's internal _input property which may change between versions
  2. Provides explicit FieldValues constraint for react-hook-form compatibility
  3. Now consistent with the useZodForm implementation in Form.tsx

The { raw: true } resolver option ensures raw form values are passed to validation.

Comment thread examples/next-formdata/package.json Resolved
@pkg-pr-new

pkg-pr-new Bot commented Dec 23, 2025 •

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@7074

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@7074

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@7074

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@7074

@trpc/tanstack-react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/tanstack-react-query@7074

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@7074

commit: 422e5a4

@KATT KATT closed this Dec 23, 2025
@KATT KATT reopened this Dec 23, 2025
@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / pr-afb247-7074 December 23, 2025 13:17 Destroyed
trpc-bot
trpc-bot previously approved these changes Dec 23, 2025

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
packages/tanstack-react-query/test/queryOptions.test.tsx (1)

10-10: Use namespace import for Zod per coding guidelines.

The import should use a namespace import instead of named destructuring to align with the project's established patterns for validation libraries.

πŸ”Ž Proposed fix
-import { z } from 'zod';
+import * as z from 'zod';

Based on coding guidelines and learnings.

🧹 Nitpick comments (4)
packages/tests/server/adapters/fastify.test.ts (1)

125-138: Consider using Object.prototype.toString.call(input) for more robust FormData validation.

The current type assertion (input as object) is a pragmatic workaround for Zod 4's stricter typing of validator parameters. However, Object.prototype.toString.call(input) is safer and more idiomatic, avoiding potential issues if input is null or undefined.

The code is compatible with Zod 4.2.1 and the existing test confirms the validation works correctly. The suggested change would improve robustness without affecting functionality.

Also note: The coding guidelines prefer namespace imports for validation libraries (import * as z from 'zod' on line 25).

packages/tests/server/zAsyncIterable.ts (1)

3-3: Use namespace import for Zod.

Per coding guidelines, prefer namespace imports for validation libraries.

Suggested fix
-import { z } from 'zod';
+import * as z from 'zod';
www/docs/server/subscriptions.md (1)

244-327: Good addition of the Zod v4 example.

The v4 example correctly demonstrates the updated ZodType signature with two type parameters. Providing both v3 and v4 examples helps users during the migration period.

One minor consideration: the import style import { z } from 'zod' could be changed to import * as z from 'zod' to match the project's coding conventions for validation libraries, though this is optional for documentation.

examples/next-formdata/src/pages/react-hook-form.tsx (1)

35-35: Consider documenting the type assertions.

The as any casts are necessary here because the resolver receives FormData (via raw: true) rather than the parsed object that TypeScript expects. A brief comment explaining this non-standard usage would help future readers understand why the escape hatches are needed.

πŸ“œ Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 10e23c9 and 77fad3c.

β›” Files ignored due to path filters (2)
  • packages/tanstack-react-query/test/__snapshots__/queryOptions.test.tsx.snap is excluded by !**/*.snap
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
πŸ“’ Files selected for processing (18)
  • examples/.experimental/next-app-dir/package.json
  • examples/next-formdata/package.json
  • examples/next-formdata/src/pages/react-hook-form.tsx
  • packages/react-query/package.json
  • packages/server/src/unstable-core-do-not-import/procedureBuilder.test.ts
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/tests/package.json
  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/errors.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/streaming.test.ts
  • packages/tests/server/zAsyncIterable.ts
  • www/docs/server/subscriptions.md
  • www/src/utils/env.js
βœ… Files skipped from review due to trivial changes (2)
  • packages/server/src/unstable-core-do-not-import/procedureBuilder.test.ts
  • packages/tests/server/streaming.test.ts
🧰 Additional context used
πŸ““ Path-based instructions (7)
**/*.{ts,tsx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Always use import type for type-only imports
Separate type imports from value imports
Avoid overzealous object destructuring; prefer direct property access
Object destructuring is acceptable when a variable is used 3+ times
Prefer array destructuring
Avoid sparse array destructuring
Never destructure in function parameter declarations
Avoid destructuring potentially nullish nested properties
Maximum 3 parameters per function; use options objects when more
Type parameter names must match /^(T|$)(A-Z)?[0-9]*$/
Prefix unused variables, parameters, and caught errors with _
Prefer namespace imports for validation libraries and large modules (e.g., import * as z from 'zod', import * as React from 'react')
Follow import order: test helpers, tRPC test imports, third-party, then relative
Never import from @trpc/*/src; import from the package root instead
Do not use Symbol.dispose or Symbol.asyncDispose; use makeResource()/makeAsyncResource()
Always use await using for resource cleanup
Prefer makeResource()/makeAsyncResource() over manual disposal logic
Avoid non-null assertions (!)
Use proper type guards and optional chaining instead of non-null assertions
Switch statements must be exhaustive for union types
Rely on TypeScript inference; avoid unnecessary explicit return/output types
Use explicit types at public API boundaries, for complex generic constraints, or when inference is insufficient/ambiguous
Use the satisfies operator to retain inference while enforcing shapes
Use as const for literal type inference when appropriate
Prefer explicit typing over any
Use type assertions sparingly
Leverage TypeScript strict mode features

Files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/src/pages/react-hook-form.tsx
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
  • packages/tests/server/zAsyncIterable.ts
**/*.{ts,tsx,md,mdx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)

Files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/src/pages/react-hook-form.tsx
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
  • packages/tests/server/zAsyncIterable.ts
  • www/docs/server/subscriptions.md
{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do not use Testing Library waitFor; use vi.waitFor instead
Tests may use non-null assertions
Tests may have unused variables
Tests may allow floating promises

Files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
packages/**/*.{ts,tsx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

No console.log in packages; use proper logging instead

Files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
  • packages/tests/server/zAsyncIterable.ts
**/*.tsx

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.tsx: Follow React Hooks rules (React Compiler compatible patterns)
Use the JSX runtime (no need to import React for JSX)
Prefer function components

Files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/src/pages/react-hook-form.tsx
**/*.test.ts

πŸ“„ CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)

**/*.test.ts: ALWAYS use await using ctx = testServerAndClientResource(...) in tests that need both server and client setup
NEVER use the deprecated routerToServerAndClientNew() in tests
Import testServerAndClientResource from @trpc/client/__tests__/testClientResource
Create fresh mock instances per test using a factory (e.g., getMockFetch())
Do not use global mocks that persist across tests
Configure mocks via the client callback in testServerAndClientResource options
Use ctx.client from the test resource for making tRPC calls
Access server URLs via ctx.httpUrl and ctx.wssUrl
Configure server options via the server property in testServerAndClientResource options
Configure client options via the client callback in testServerAndClientResource options
Use descriptive test names that explain the behavior under test
Focus test names on what the test validates, not just what it does
Use proper TypeScript typing for mocks
Clear mocks between tests when needed
Use factory functions for mock creation to ensure isolation

Files:

  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
packages/tanstack-react-query/**/*.test.tsx

πŸ“„ CodeRabbit inference engine (.cursor/rules/tanstack-react-query-tests.mdc)

packages/tanstack-react-query/**/*.test.tsx: ALWAYS use await using ctx = testReactResource(...) to set up TanStack React Query tests
Import testReactResource from the local path ./__helpers
Do NOT import testReactResource from ./test/__helpers (wrong path)
Do NOT import legacy helpers like createAppRouter from ./__testHelpers
Use ctx.useTRPC() for TanStack React Query hooks access in components under test
Use ctx.useTRPCClient() for direct (vanilla) tRPC client access in tests
Use ctx.optionsProxyClient when testing client-side options proxy
Use ctx.optionsProxyServer when testing server-side options proxy
Render via ctx.renderApp() and rerender via ctx.rerenderApp() instead of custom providers
Import testing utilities from @testing-library/react
Import user interaction utilities from @testing-library/user-event when simulating interactions
Import React Query types from @tanstack/react-query as needed
Import TanStack React Query utilities from the package source via ../src
Import React testing utilities with import * as React from 'react';

Files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
🧠 Learnings (39)
πŸ““ Common learnings
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer namespace imports for validation libraries and large modules (e.g., `import * as z from 'zod'`, `import * as React from 'react'`)
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Import both 'trpc/react-query' as rq (legacy) and 'trpc/tanstack-react-query' as trq (modern) when writing migration tests
πŸ“š Learning: 2025-06-09T14:01:20.033Z
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.

Applied to files:

  • packages/tests/package.json
  • packages/react-query/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to {**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Tests may use non-null assertions

Applied to files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant

Applied to files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Do NOT import `testReactResource` from `./test/__helpers` (wrong path)

Applied to files:

  • packages/tests/server/adapters/awsLambda.test.tsx
  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/tests/server/index.test.ts
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Use proper TypeScript typing for mocks

Applied to files:

  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Focus test names on what the test validates, not just what it does

Applied to files:

  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Use descriptive test names that explain the behavior under test

Applied to files:

  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to {**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Tests may allow floating promises

Applied to files:

  • packages/tests/server/errorFormatting.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : NEVER use the deprecated `routerToServerAndClientNew()` in tests

Applied to files:

  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Access server URLs via `ctx.httpUrl` and `ctx.wssUrl`

Applied to files:

  • packages/tests/server/httpSubscriptionLink.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Configure server options via the `server` property in `testServerAndClientResource` options

Applied to files:

  • packages/tests/server/httpSubscriptionLink.test.ts
  • packages/tests/server/input.test.ts
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React Query types from `tanstack/react-query` as needed

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/react-query/package.json
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React testing utilities with `import * as React from 'react';`

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/react-query/package.json
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import TanStack React Query utilities from the package source via `../src`

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.optionsProxyClient` when testing client-side options proxy

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Do NOT import legacy helpers like `createAppRouter` from `./__testHelpers`

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.optionsProxyServer` when testing server-side options proxy

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import testing utilities from `testing-library/react`

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPC()` for TanStack React Query hooks access in components under test

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Render via `ctx.renderApp()` and rerender via `ctx.rerenderApp()` instead of custom providers

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : ALWAYS use `await using ctx = testReactResource(...)` to set up TanStack React Query tests

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Use konn for test lifecycle management

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Manage test resources with konn(): call createAppRouter() in beforeEach and ctx?.close?.() in afterEach

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Use queryClient, db, and resolvers exposed by createAppRouter instead of redefining them

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • packages/react-query/package.json
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Import createTRPCReact from 'trpc/react-query' (legacy API)

Applied to files:

  • packages/tanstack-react-query/test/queryOptions.test.tsx
  • examples/next-formdata/package.json
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Import both 'trpc/react-query' as rq (legacy) and 'trpc/tanstack-react-query' as trq (modern) when writing migration tests

Applied to files:

  • packages/react-query/package.json
  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Create the tRPC React client with createTRPCReact<typeof appRouter>()

Applied to files:

  • examples/next-formdata/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Wrap components with a custom App that provides trpc.Provider (legacy) and QueryClientProvider

Applied to files:

  • examples/next-formdata/package.json
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPCClient()` for direct (vanilla) tRPC client access in tests

Applied to files:

  • examples/next-formdata/package.json
πŸ“š Learning: 2025-02-12T16:56:46.960Z
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6262
File: examples/minimal-react/client/package.json:16-17
Timestamp: 2025-02-12T16:56:46.960Z
Learning: In examples and codemods targeting future versions, dependencies may intentionally use upcoming versions (e.g., React v19) or `next` tags, even if those versions haven't been officially released yet.

Applied to files:

  • examples/next-formdata/package.json
  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer namespace imports for validation libraries and large modules (e.g., `import * as z from 'zod'`, `import * as React from 'react'`)

Applied to files:

  • examples/next-formdata/package.json
  • examples/next-formdata/src/pages/react-hook-form.tsx
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Do NOT import legacy-only helpers like createAppRouter from './__testHelpers' in upgrade-package tests

Applied to files:

  • packages/tests/server/index.test.ts
  • packages/tests/server/input.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Import `testServerAndClientResource` from `trpc/client/__tests__/testClientResource`

Applied to files:

  • packages/tests/server/index.test.ts
  • packages/tests/server/errors.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Configure client options via the `client` callback in `testServerAndClientResource` options

Applied to files:

  • packages/tests/server/input.test.ts
πŸ“š Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Configure mocks via the `client` callback in `testServerAndClientResource` options

Applied to files:

  • packages/tests/server/input.test.ts
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import `testReactResource` from the local path `./__helpers`

Applied to files:

  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : ALWAYS import createAppRouter from './__testHelpers' (not '__helpers')

Applied to files:

  • examples/.experimental/next-app-dir/package.json
πŸ“š Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Use testing-library/react for rendering in upgrade-package tests

Applied to files:

  • examples/.experimental/next-app-dir/package.json
🧬 Code graph analysis (2)
examples/next-formdata/src/pages/react-hook-form.tsx (1)
examples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsx (1)
  • useZodForm (12-25)
packages/tests/server/adapters/fastify.test.ts (1)
packages/server/src/unstable-core-do-not-import/procedureBuilder.ts (1)
  • input (502-508)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: E2E-tests (.test/internal-types-export)
  • GitHub Check: E2E-tests (nuxt)
  • GitHub Check: E2E-tests (express-server)
  • GitHub Check: E2E-tests (next-minimal-starter)
  • GitHub Check: E2E-tests (next-formdata)
  • GitHub Check: E2E-tests (minimal-react)
  • GitHub Check: E2E-tests (next-prisma-starter)
  • GitHub Check: E2E-tests (.experimental/next-app-dir)
  • GitHub Check: E2E-tests (next-prisma-todomvc)
  • GitHub Check: e2e-legacy-node (next-prisma-starter, 18.x)
  • GitHub Check: e2e-legacy-node (next-prisma-todomvc, 18.x)
  • GitHub Check: e2e-legacy-node (next-prisma-todomvc, 20.x)
  • GitHub Check: e2e-legacy-node (next-prisma-starter, 20.x)
  • GitHub Check: E2E-tests (Deno) (deno-deploy)
  • GitHub Check: typecheck-www
  • GitHub Check: Release using pkg.pr.new
  • GitHub Check: Test a monorepo using built declaration files
  • GitHub Check: E2E-tests (Bun) (bun, ubuntu-latest)
  • GitHub Check: unit and integration tests
  • GitHub Check: Lint and auto-fix
πŸ”‡ Additional comments (22)
packages/tanstack-react-query/test/queryOptions.test.tsx (1)

278-278: The iterable procedure doesn't use input validation with Zod, so Zod v4 breaking changes won't affect this snapshot. The snapshot captures React Query state transitions (status, fetchStatus) and the yielded data (1, 2, 3) from the generator function, not Zod validation output.

Likely an incorrect or invalid review comment.

examples/.experimental/next-app-dir/package.json (1)

14-14: Coordinated dependency updates for Zod v4 migration look good.

The @hookform/resolvers v5 is designed to work with react-hook-form v7+ and Zod v4, making this a properly synchronized upgrade. Based on learnings, the AI-generated summary confirms related form validation code changes in this example have been updated to match these dependency bumps.

Also applies to: 29-29, 35-35

examples/next-formdata/package.json (1)

12-12: Coordinated dependency updates properly address the Zod v4 migration.

The previous review concern about [email protected] incompatibility with Zod v4 has been resolved by upgrading to ^3.0.1. All four related dependencies (@hookform/resolvers, react-hook-form, zod, zod-form-data) are now aligned for Zod v4 compatibility.

Also applies to: 21-23

packages/tests/package.json (1)

38-38: zod-form-data upgrade aligns with Zod v4 migration.

The zod-form-data v3 upgrade is necessary since v2 only supports Zod v3. This change is consistent with the monorepo-wide Zod v4 upgrade.

packages/tests/server/errorFormatting.test.ts (1)

259-268: LGTM! Correct Zod v4 migration.

The changes correctly reflect Zod v4 updates:

  • Type reference moved to z.core.$ZodFlattenedError<any> (Zod v4 standardized issue format under z.core namespace)
  • Error message updated to "Too small: expected number to be >=10" (new standardized error messaging)

These align with the Zod v4 documentation provided.

packages/tests/server/index.test.ts (1)

125-136: LGTM! Correct Zod v4 error format update.

The inline snapshot correctly reflects Zod v4's new standardized error structure:

  • Added "code": "invalid_type" field (standardized issue format)
  • Updated message to "Invalid input: expected string, received number" (new prefix convention)
  • Removed redundant "received" field from error object

These changes align with the Zod v4 improvements documented.

packages/tests/server/httpSubscriptionLink.test.ts (1)

328-337: LGTM! Consistent Zod v4 error format.

The error snapshot update is consistent with other test files in this PR:

  • Added standardized "code": "invalid_type" field
  • Updated message to "Invalid input: expected number, received string" format
  • Removed redundant fields for cleaner error structure
packages/tests/server/adapters/awsLambda.test.tsx (1)

389-398: LGTM! Correct Zod v4 error format in AWS Lambda adapter test.

The error assertion correctly reflects Zod v4's standardized error structure with the "code": "invalid_type" field and "Invalid input: " message prefix.

packages/tests/server/input.test.ts (4)

88-94: LGTM! Correct Zod v4 error message format.

The error message correctly reflects Zod v4's new format: "Invalid input: expected string, received undefined".


106-113: LGTM! Consistent Zod v4 error format.

Error message correctly updated to match v4 format.


361-406: Verify .prefault() usage in default value test.

This test changed from .default({ foo: 'fooBar' }) to .prefault({ foo: 'fooBar' }). According to Zod v4 documentation:

  • .default() now short-circuits when input is undefined
  • .prefault() maintains Zod v3 behavior (pre-parse defaults)

Questions:

  1. Is this test specifically validating the legacy (prefault) behavior?
  2. Or should it be updated to test the new .default() behavior?
  3. Should there be separate tests for both .default() and .prefault() behaviors?

The test expects undefined input to resolve to { foo: 'fooBar', bar: 'barFoo' } (line 402-405). Please confirm this is the correct expected behavior for .prefault() vs what .default() would produce.


408-445: Verify .prefault() usage in nested defaults test.

Similar to the previous test, this changed from .default({}) to .prefault({}). Please confirm whether this test should validate:

  1. The legacy prefault behavior (as currently implemented)
  2. The new default behavior (which would need changing back to .default())
  3. Both behaviors in separate test cases
packages/tests/server/errors.test.ts (2)

86-96: LGTM! Correct Zod v4 error format.

The error message correctly reflects Zod v4's standardized format with the "code": "invalid_type" field and "Invalid input: " prefix.


136-218: LGTM! Critical Zod v4 API migration - errors β†’ issues.

This correctly migrates to Zod v4's breaking change (line 147):

  • Changed error.cause.errors to error.cause.issues
  • Updated error snapshots to reflect new standardized issue format
  • All error messages now use "Invalid input: " prefix

According to Zod v4 documentation: "New standardized issue formats under the z.core namespace. Errors are easier to inspect through the issues array."

This is a critical breaking change that correctly propagates through the error formatter's data structure.

packages/react-query/package.json (1)

115-116: The Zod v3 pin in react-query is intentional and consistent with the package architecture.

The react-query package (legacy tRPC React library) explicitly pins Zod v3, while its modern counterpart tanstack-react-query uses Zod v4. This is a deliberate separation strategy rather than a technical requirementβ€”zod-form-data@2 supports Zod >=3.11.0, compatible with both v3 and v4. No further action is needed; this exception does not require documentation in the PR description since it reflects the intended difference between the legacy and modern React Query integrations.

packages/tests/server/zAsyncIterable.ts (2)

19-39: LGTM! Correctly updated to Zod v4 type signature.

The z.ZodType parameters have been correctly updated from the v3 three-parameter form (z.ZodType<Output, Def, Input>) to the v4 two-parameter form (z.ZodType<Output, Input>).


41-79: Implementation and type cast look correct.

The async iteration logic properly handles validation of yielded values, tracked envelopes, return values, and ensures cleanup via the finally block. The type cast at the end correctly reflects the Zod v4 two-parameter ZodType signature.

www/docs/server/subscriptions.md (1)

329-413: LGTM! Retaining the v3 example is helpful.

The v3 example with the three-parameter z.ZodType<TYieldIn, any, TYieldOut> signature is correctly preserved for users who haven't yet migrated to Zod v4.

examples/next-formdata/src/pages/react-hook-form.tsx (4)

5-7: LGTM!

Type imports are correctly separated from value imports. The type-only import of z is appropriate here since it's only used for the z.ZodType type annotation.


21-41: Subtle timing dependency in resolver-formRef pattern.

The resolver at line 23 references form.formRef, but formRef is only assigned at line 39 after the form is created. This works because the resolver is called lazily during validation (not during useForm initialization), and by then the assignment has occurred.

The fallback error at lines 25-32 handles the unmounted case, which is good defensive programming. Just be aware this pattern depends on react-hook-form not calling the resolver synchronously during form setup.


51-78: LGTM!

The Page component correctly integrates with the refactored useZodForm hook. The formRef is properly attached to the form element (line 78), enabling the resolver to access the actual FormData during validation.


12-15: Remove this review comment; the stated Zod v4 signature is incorrect.

The review claims "For Zod 4, ZodType<Output, Def, Input> is the typical signature," but Zod v4 (the version used here: ^4.2.1) removes the Def parameter entirely. The actual signature is ZodType<Output, Input> with two generic parameters. This invalidates the analysis and reasoning provided in the comment.

Likely an incorrect or invalid review comment.

Comment thread www/src/utils/env.js Resolved
@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / pr-afb247-7074 December 23, 2025 14:40 Destroyed
trpc-bot
trpc-bot previously approved these changes Dec 23, 2025
@KATT KATT removed the 🚧 wip work in progress label Dec 23, 2025
@KATT KATT changed the title chore(monorepo): bump zod chore(deps): bump zod Dec 23, 2025
@KATT
KATT disabled auto-merge December 23, 2025 14:46
@KATT KATT changed the title chore(deps): bump zod chore(deps): bump zod, react-hook-form Dec 23, 2025
@KATT KATT changed the title chore(deps): bump zod, react-hook-form chore(deps): bump zod + react-hook-form Dec 23, 2025
@KATT
KATT enabled auto-merge (squash) December 23, 2025 14:46
@KATT
KATT merged commit f48ed5c into main Dec 23, 2025
@KATT
KATT deleted the 12-23-zod branch December 23, 2025 15:03
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 24, 2025

This branch was successfully deployed

5 active deployments
Preview – www β€” 422e5a44 Deployed Dec 23, 2025 by vercel[bot]
Preview – examples-todomvc β€” 422e5a44 Deployed Dec 23, 2025 by vercel[bot]
Preview – next-prisma-starter β€” 422e5a44 Deployed Dec 23, 2025 by vercel[bot]
Preview – og-image β€” 422e5a44 Deployed Dec 23, 2025 by vercel[bot]
Preview – trpc-next-app-dir β€” 422e5a44 Deployed Dec 23, 2025 by vercel[bot]
trpc-sse-and-websockets / pr-afb247-7074 β€” 422e5a44 Deployed Dec 23, 2025 by railway-app[bot]
trpc-sse-and-websockets / trpc-pr-7074 β€” cd72b190 Deployed Dec 23, 2025 by railway-app[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants