Registry Mirror
Skip to content

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Nov 29, 2026

Copy link
Copy Markdown
Member

Input validation errors put the raw Standard Schema issues into error.data.issues. Valibot and ArkType issues embed the input (input, nested issues, path segments with input and value). So a deeply nested input made the serializer overflow the stack and handler.handle() reject, and a large input gave a response that grows with the square of its size.

Each issue on the wire now keeps only message and path, where object segments become { key }. Raw issues stay on error.cause (ValidationError). RequestValidationLinkPlugin sends the same shape, so client-side errors match the server's.

Tests in procedure-client.test.ts cover the issue shape and the { key } path segments. The v2 migration guide notes the change. The v1 fix is in #2567.

Input validation errors now send only `message` and `path` in `data.issues`,
with object path segments reduced to `{ key }`; raw issues stay on
`error.cause.issues`.
@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2568

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2568

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@2568

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2568

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@2568

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2568

@orpc/effect

npm i https://pkg.pr.new/@orpc/effect@2568

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@2568

@orpc/hibernation

npm i https://pkg.pr.new/@orpc/hibernation@2568

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2568

@orpc/experimental-lock

npm i https://pkg.pr.new/@orpc/experimental-lock@2568

@orpc/mcp

npm i https://pkg.pr.new/@orpc/mcp@2568

@orpc/msw

npm i https://pkg.pr.new/@orpc/msw@2568

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2568

@orpc/next

npm i https://pkg.pr.new/@orpc/next@2568

@orpc/node

npm i https://pkg.pr.new/@orpc/node@2568

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2568

@orpc/experimental-openapi-inference

npm i https://pkg.pr.new/@orpc/experimental-openapi-inference@2568

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@2568

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@2568

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@2568

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@2568

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@2568

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2568

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2568

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@2568

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2568

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2568

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2568

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2568

commit: 45b4e5a

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Input-validation errors now expose each issue’s message and path. Primitive path segments remain unchanged, while object-valued segments include only their key; other issue and segment details are omitted from the reported error data. Original issues and invalid input remain available in the server-side error cause.
  • Documentation
    • Clarified which validation details appear in error data and which remain available in the server-side cause.

Input validation errors now expose issues with only their message and path. Object-valued path segments retain only their key. The original issues remain available in the server-side ValidationError cause.

Changes: Validation Issue Mapping

Layer / File(s) Summary
Map and document validation issue data
packages/contract/src/plugins/request-validation.ts, packages/server/src/procedure-client.ts, packages/contract/src/plugins/request-validation.test.ts, packages/server/src/procedure-client.test.ts, apps/content/docs/migrations/from-v1.mdx
The request-validation plugin and server procedure client map issues to their message and path. Object path segments retain only key, while primitive segments remain unchanged. Tests check the mapped data, and the migration note describes the change and where full issues remain available.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Merge Risk: Minimal · up to 45b4e

Validation errors now expose only each issue's message and path. This avoids oversized or deeply nested responses, and the full issues stay on the server-side error cause. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changed areas (server and contract) and the main change: validation issues no longer echo raw input. It matches the changeset, which maps issues to message and path with object…
Description check Passed The description states the problem (raw Standard Schema issues echo input, causing stack overflow and quadratic response size). It then explains the fix: issues keep only message and path, object segm…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two changed areas (server and contract) and the main change: validation issues no longer echo raw input. It matches the changeset, which maps issues to message and path with object segments reduced to { key } and keeps raw issues on the ValidationError cause.

Full details: Description check

Explanation

The description states the problem (raw Standard Schema issues echo input, causing stack overflow and quadratic response size). It then explains the fix: issues keep only message and path, object segments become { key }, and raw issues stay on error.cause. It also names the tests, the client plugin change, and the migration guide, all of which match the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: deb86135-d356-4e33-9afd-d42ffd4d34b5
Commits

Reviewing files that changed from the base of the PR and between b16c006 and 45b4e5a.

Files selected for processing: 1

  • packages/contract/src/plugins/request-validation.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

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

ℹ️ No blocking issues — two minor suggestions inline.

Approach: sound — the projection happens where issues are put on the wire, so every server transport (RPC, OpenAPI, batch) gets it from one place, while raw issues remain on error.cause.

Reviewed changes

  • Input issue projection: validateInput maps each Standard Schema issue to { message, path } and reduces object path segments to { key }, dropping embedded input, nested issues, and segment value before serialization.
  • Matching client shape: RequestValidationLinkPlugin applies the same projection so locally thrown BAD_REQUEST errors match server-produced ones.
  • Tests: two new cases cover dropping non-wire fields and normalizing { key } path segments.
  • Docs: from-v1.mdx notes the narrowed data.issues shape and points at error.cause.issues.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment on lines +170 to +175
issues: result.issues.map((issue) => ({
message: issue.message,
path: issue.path?.map((segment) =>
typeof segment === 'object' ? { key: segment.key } : segment,
),
})),

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.

The v1 counterpart fix (#2567) keeps every top-level scalar field (code, type, expected, …) and only drops object/array fields, so a Zod issue on v1 still exposes code while the same issue on v2 loses it. Those scalars are exactly the safe part — nested input/issues are what caused the blowup — so keeping them costs nothing and avoids v1 and v2 exposing different data.issues shapes for the same error. Unless the narrower v2 shape is deliberate, align this with v1 and state the shape in the migration entry.

Comment on lines +63 to +68
issues: result.issues.map((issue) => ({
message: issue.message,
path: issue.path?.map((segment) =>
typeof segment === 'object' ? { key: segment.key } : segment,
),
})),

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.

This projection is duplicated verbatim from validateInput in packages/server/src/procedure-client.ts, and this copy has no test — request-validation.test.ts only asserts expect.any(Array). A change to the public issue shape now has to be made in two packages with nothing catching drift; consider one helper exported from @orpc/contract (next to ValidationError or in schema-utils.ts) and asserting its output once.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 5 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 40 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/fix-ghsa-cxfp-v2-30363d (45b4e5a) with main (a73005b)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
orpc 45b4e5a Commit Preview URL

Branch Preview URL
Nov 29 2026, 02:22 PM

@dinwwwh
dinwwwh merged commit 2ffa735 into main Nov 30, 2026
13 checks passed
dinwwwh added a commit that referenced this pull request Nov 30, 2026
Follow-up to #2568.

- Move the validation issue mapping into `toPublicSchemaIssue` in
`@orpc/contract`, used by `validateInput` in the server and by
`RequestValidationLinkPlugin`.
- Remove the migration-guide note, since v1 ships the same change.
dinwwwh added a commit that referenced this pull request Dec 1, 2026
#2576)

Reverts the fallback added in #2570. When
`codec.encodeError` throws, `StandardHandler.handle` now rejects with
that error instead of returning a plain `INTERNAL_SERVER_ERROR`.

- The fallback hid the failure: it was only recorded on the span, which
most users don't have.
- It saved nothing: the expensive part (e.g. a stack overflow) has
already happened by then.
- Validation issues no longer echo input (#2568,
#2570), so an encoding failure is now usually a bug in the
app's error data, which should surface to root interceptors, logging
plugins and the server framework.
- The error is still recorded on the span when it propagates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant