fix(rest/nodejs): answer validation failures with the UCP error envelope - #192
Open
vishkaty wants to merge 2 commits into
Open
fix(rest/nodejs): answer validation failures with the UCP error envelope#192vishkaty wants to merge 2 commits into
vishkaty wants to merge 2 commits into
Conversation
A request rejected by payload validation drew a plain text 422 built from the raw zod issues, while every other protocol error on this server speaks the UCP envelope. checkout-rest.md gives protocol errors one shape, a JSON body carrying code and content, so the platform can act on the rejection. prettyValidation now renders the same pretty diagnostic through ucpErrorResponse as INVALID_REQUEST with status 422, keeping the log output unchanged. A schema guided sweep of 261 request mutations drew 122 of these text rejections before the change and zero after.
damaz91
approved these changes
Aug 20, 2026
17 tasks
|
Hi @vishkaty, thank you for submitting this fix. This is minor, just formatting feedback, but it looks like it's failing Lint test - could you please take a look at "return ucpErrorResponse" and split the arguments across multiple lines. |
Contributor
Author
|
Done, split in bdbf45a and the pinned pre-commit now passes on both files. Thank you for the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A request rejected by payload validation draws a plain text 422 built from the raw zod issues. A validation failure is the only rejection this server still answers as plain text, and the checkout error taxonomy has answered with the UCP envelope since #174. checkout-rest.md gives protocol errors one shape, a JSON body carrying code and content, so a platform can act on the rejection.
Fix
prettyValidation keeps building the same readable diagnostic and now renders it through the existing ucpErrorResponse helper as INVALID_REQUEST with status 422, so the envelope carries the diagnostic as content. Log output is unchanged.
Testing