Repository navigation
Conversation
|
π Deployed to the pr-afb247-7074 environment in trpc-sse-and-websockets
|
WalkthroughMonorepo-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
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
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touchesβ Failed checks (2 warnings)
β Passed checks (1 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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>toz.ZodType<any, TInput>is accurate for Zod v4's simplified generics. However,@hookform/resolvers/zodhas 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/v3subpath 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
β Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (39)
examples/.experimental/next-app-dir/package.jsonexamples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsxexamples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsxexamples/.test/diagnostics-big-router/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/.test/monotest-api/package.jsonexamples/.test/ssg-infinite-serialization/package.jsonexamples/.test/ssg/package.jsonexamples/cloudflare-workers/package.jsonexamples/express-minimal/package.jsonexamples/express-server/package.jsonexamples/fastify-server/package.jsonexamples/lambda-api-gateway-streaming/package.jsonexamples/lambda-api-gateway/package.jsonexamples/lambda-url/package.jsonexamples/lazy-load/package.jsonexamples/minimal-content-types/server/package.jsonexamples/minimal-react/server/package.jsonexamples/minimal/package.jsonexamples/next-big-router/package.jsonexamples/next-edge-runtime/package.jsonexamples/next-formdata/package.jsonexamples/next-minimal-starter/package.jsonexamples/next-prisma-starter/package.jsonexamples/next-prisma-todomvc/package.jsonexamples/next-prisma-websockets-starter/package.jsonexamples/next-sse-chat/package.jsonexamples/standalone-server/package.jsonexamples/vercel-edge-runtime/package.jsonpackage.jsonpackages/next/package.jsonpackages/react-query/package.jsonpackages/server/package.jsonpackages/server/src/unstable-core-do-not-import/clientish/serialize.test.tspackages/tanstack-react-query/package.jsonpackages/upgrade/package.jsonwww/og-image/package.jsonwww/og-image/utils/zodParams.tswww/package.json
π§° Additional context used
π Path-based instructions (5)
**/*.test.ts
π CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)
**/*.test.ts: ALWAYS useawait using ctx = testServerAndClientResource(...)in tests that need both server and client setup
NEVER use the deprecatedrouterToServerAndClientNew()in tests
ImporttestServerAndClientResourcefrom@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 theclientcallback intestServerAndClientResourceoptions
Usectx.clientfrom the test resource for making tRPC calls
Access server URLs viactx.httpUrlandctx.wssUrl
Configure server options via theserverproperty intestServerAndClientResourceoptions
Configure client options via theclientcallback intestServerAndClientResourceoptions
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 useimport typefor 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 useSymbol.disposeorSymbol.asyncDispose; usemakeResource()/makeAsyncResource()
Always useawait usingfor resource cleanup
PrefermakeResource()/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 thesatisfiesoperator to retain inference while enforcing shapes
Useas constfor literal type inference when appropriate
Prefer explicit typing overany
Use type assertions sparingly
Leverage TypeScript strict mode features
Files:
packages/server/src/unstable-core-do-not-import/clientish/serialize.test.tswww/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.tswww/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 LibrarywaitFor; usevi.waitForinstead
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.login 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.jsonexamples/standalone-server/package.jsonpackages/server/src/unstable-core-do-not-import/clientish/serialize.test.tsexamples/lambda-url/package.jsonexamples/.experimental/next-app-dir/src/app/posts/_lib/Form.tsxexamples/next-formdata/package.jsonexamples/lambda-api-gateway/package.jsonwww/og-image/package.jsonexamples/next-edge-runtime/package.jsonwww/og-image/utils/zodParams.tsexamples/next-big-router/package.jsonpackages/upgrade/package.jsonexamples/lambda-api-gateway-streaming/package.jsonexamples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.tsxexamples/.test/diagnostics-big-router/package.jsonpackages/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.jsonexamples/.test/ssg-infinite-serialization/package.jsonexamples/next-formdata/package.jsonexamples/next-minimal-starter/package.jsonwww/og-image/package.jsonexamples/next-edge-runtime/package.jsonexamples/next-sse-chat/package.jsonexamples/next-big-router/package.jsonexamples/next-prisma-starter/package.jsonexamples/next-prisma-todomvc/package.jsonexamples/.test/diagnostics-big-router/package.jsonpackages/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.jsonexamples/standalone-server/package.jsonexamples/lambda-url/package.jsonpackages/tanstack-react-query/package.jsonexamples/.test/monotest-api/package.jsonexamples/lambda-api-gateway/package.jsonexamples/vercel-edge-runtime/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/express-server/package.jsonexamples/minimal-content-types/server/package.jsonexamples/lambda-api-gateway-streaming/package.jsonexamples/minimal/package.jsonexamples/lazy-load/package.jsonexamples/express-minimal/package.jsonexamples/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.jsonexamples/standalone-server/package.jsonexamples/lambda-url/package.jsonpackages/tanstack-react-query/package.jsonexamples/.test/monotest-api/package.jsonexamples/lambda-api-gateway/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/express-server/package.jsonexamples/lambda-api-gateway-streaming/package.jsonpackages/react-query/package.jsonexamples/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.jsonexamples/lambda-url/package.jsonexamples/lambda-api-gateway/package.jsonexamples/vercel-edge-runtime/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/express-server/package.jsonexamples/lambda-api-gateway-streaming/package.jsonexamples/lazy-load/package.jsonexamples/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.jsonexamples/express-server/package.jsonexamples/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.jsonpackages/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.tsexamples/lambda-api-gateway/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/minimal/package.jsonexamples/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.tsexamples/.test/monotest-api/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/.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.tspackages/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.jsonexamples/.test/monotest-api/package.jsonexamples/lambda-api-gateway/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/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.jsonexamples/.test/ssg/package.jsonexamples/next-prisma-starter/package.jsonexamples/.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.jsonexamples/.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.jsonexamples/vercel-edge-runtime/package.jsonexamples/.test/monotest-api-router01/package.jsonexamples/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.jsonexamples/.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.jsonexamples/minimal-content-types/server/package.jsonexamples/minimal/package.jsonexamples/lazy-load/package.jsonexamples/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, andz.number()restrictionsβare not used in this codebase. The current.default()usage withz.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/v4tozodcorrectly 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 inzodParams.tsfunctions 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
FieldValuesto 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 explicitTInput extends FieldValuesconstraint is a solid improvement:
- Avoids relying on Zod's internal
_inputproperty which may change between versions- Provides explicit
FieldValuesconstraint for react-hook-form compatibility- Now consistent with the
useZodFormimplementation inForm.tsxThe
{ raw: true }resolver option ensures raw form values are passed to validation.
@trpc/client
@trpc/next
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
There was a problem hiding this comment.
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 usingObject.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 ifinputis 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
ZodTypesignature 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 toimport * 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 anycasts are necessary here because the resolver receivesFormData(viaraw: 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
β Files ignored due to path filters (2)
packages/tanstack-react-query/test/__snapshots__/queryOptions.test.tsx.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (18)
examples/.experimental/next-app-dir/package.jsonexamples/next-formdata/package.jsonexamples/next-formdata/src/pages/react-hook-form.tsxpackages/react-query/package.jsonpackages/server/src/unstable-core-do-not-import/procedureBuilder.test.tspackages/tanstack-react-query/test/queryOptions.test.tsxpackages/tests/package.jsonpackages/tests/server/adapters/awsLambda.test.tsxpackages/tests/server/adapters/fastify.test.tspackages/tests/server/errorFormatting.test.tspackages/tests/server/errors.test.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/tests/server/streaming.test.tspackages/tests/server/zAsyncIterable.tswww/docs/server/subscriptions.mdwww/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 useimport typefor 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 useSymbol.disposeorSymbol.asyncDispose; usemakeResource()/makeAsyncResource()
Always useawait usingfor resource cleanup
PrefermakeResource()/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 thesatisfiesoperator to retain inference while enforcing shapes
Useas constfor literal type inference when appropriate
Prefer explicit typing overany
Use type assertions sparingly
Leverage TypeScript strict mode features
Files:
packages/tests/server/adapters/awsLambda.test.tsxpackages/tests/server/errorFormatting.test.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tanstack-react-query/test/queryOptions.test.tsxexamples/next-formdata/src/pages/react-hook-form.tsxpackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/tests/server/errors.test.tspackages/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.tsxpackages/tests/server/errorFormatting.test.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tanstack-react-query/test/queryOptions.test.tsxexamples/next-formdata/src/pages/react-hook-form.tsxpackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/tests/server/errors.test.tspackages/tests/server/zAsyncIterable.tswww/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 LibrarywaitFor; usevi.waitForinstead
Tests may use non-null assertions
Tests may have unused variables
Tests may allow floating promises
Files:
packages/tests/server/adapters/awsLambda.test.tsxpackages/tests/server/errorFormatting.test.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tanstack-react-query/test/queryOptions.test.tsxpackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/tests/server/errors.test.ts
packages/**/*.{ts,tsx}
π CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
No
console.login packages; use proper logging instead
Files:
packages/tests/server/adapters/awsLambda.test.tsxpackages/tests/server/errorFormatting.test.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tanstack-react-query/test/queryOptions.test.tsxpackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/tests/server/errors.test.tspackages/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.tsxpackages/tanstack-react-query/test/queryOptions.test.tsxexamples/next-formdata/src/pages/react-hook-form.tsx
**/*.test.ts
π CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)
**/*.test.ts: ALWAYS useawait using ctx = testServerAndClientResource(...)in tests that need both server and client setup
NEVER use the deprecatedrouterToServerAndClientNew()in tests
ImporttestServerAndClientResourcefrom@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 theclientcallback intestServerAndClientResourceoptions
Usectx.clientfrom the test resource for making tRPC calls
Access server URLs viactx.httpUrlandctx.wssUrl
Configure server options via theserverproperty intestServerAndClientResourceoptions
Configure client options via theclientcallback intestServerAndClientResourceoptions
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.tspackages/tests/server/httpSubscriptionLink.test.tspackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/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 useawait using ctx = testReactResource(...)to set up TanStack React Query tests
ImporttestReactResourcefrom the local path./__helpers
Do NOT importtestReactResourcefrom./test/__helpers(wrong path)
Do NOT import legacy helpers likecreateAppRouterfrom./__testHelpers
Usectx.useTRPC()for TanStack React Query hooks access in components under test
Usectx.useTRPCClient()for direct (vanilla) tRPC client access in tests
Usectx.optionsProxyClientwhen testing client-side options proxy
Usectx.optionsProxyServerwhen testing server-side options proxy
Render viactx.renderApp()and rerender viactx.rerenderApp()instead of custom providers
Import testing utilities from@testing-library/react
Import user interaction utilities from@testing-library/user-eventwhen simulating interactions
Import React Query types from@tanstack/react-queryas needed
Import TanStack React Query utilities from the package source via../src
Import React testing utilities withimport * 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.jsonpackages/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.tsxpackages/tests/server/errorFormatting.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/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.tsxpackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/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.tsxpackages/tanstack-react-query/test/queryOptions.test.tsxpackages/tests/server/index.test.tsexamples/.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.tspackages/tests/server/adapters/fastify.test.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/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.tspackages/tests/server/index.test.tspackages/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.tspackages/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.tspackages/tests/server/input.test.tspackages/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.tspackages/tests/server/index.test.tspackages/tests/server/input.test.tspackages/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.tspackages/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.tsxpackages/react-query/package.jsonexamples/next-formdata/package.jsonexamples/.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.tsxpackages/react-query/package.jsonexamples/next-formdata/package.jsonexamples/.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.tsxexamples/next-formdata/package.jsonexamples/.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.tsxexamples/.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.tsxexamples/next-formdata/package.jsonexamples/.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.tsxpackages/react-query/package.jsonexamples/next-formdata/package.jsonexamples/.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.tsxexamples/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.jsonexamples/next-formdata/package.jsonexamples/.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.jsonexamples/.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.jsonexamples/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.tspackages/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.tspackages/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 underz.corenamespace)- 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 objectThese 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 isundefined.prefault()maintains Zod v3 behavior (pre-parse defaults)Questions:
- Is this test specifically validating the legacy (prefault) behavior?
- Or should it be updated to test the new
.default()behavior?- Should there be separate tests for both
.default()and.prefault()behaviors?The test expects
undefinedinput 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:
- The legacy prefault behavior (as currently implemented)
- The new default behavior (which would need changing back to
.default())- 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.errorstoerror.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.corenamespace. Errors are easier to inspect through theissuesarray."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.ZodTypeparameters 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
finallyblock. The type cast at the end correctly reflects the Zod v4 two-parameterZodTypesignature.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
zis appropriate here since it's only used for thez.ZodTypetype annotation.
21-41: Subtle timing dependency in resolver-formRef pattern.The resolver at line 23 references
form.formRef, butformRefis only assigned at line 39 after the form is created. This works because the resolver is called lazily during validation (not duringuseForminitialization), 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
useZodFormhook. TheformRefis 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 theDefparameter entirely. The actual signature isZodType<Output, Input>with two generic parameters. This invalidates the analysis and reasoning provided in the comment.Likely an incorrect or invalid review comment.
|
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. |
bump zod - ref #7073 (review)
Summary by CodeRabbit
Chores
Documentation
Chores / Examples
Notes
βοΈ Tip: You can customize this high-level summary in your review settings.