Skip to content

fix(web_core): use error.issues instead of error.errors for Zod 4 compatibility - #3825

Open
Varun-S10 wants to merge 4 commits into
a2ui-project:mainfrom
Varun-S10:fix/issue-3812
Open

Varun-S10 wants to merge 4 commits into
a2ui-project:mainfrom
Varun-S10:fix/issue-3812

Conversation

@Varun-S10

Copy link
Copy Markdown
Collaborator

Description

This PR updates @a2ui/web_core validation error handling to read error.issues instead of the deprecated error.errors alias across payload-validator.ts and processing/adapters/base.ts, and updates formatZodIssue in format-zod-issue.ts to match issue codes via string literals without relying on the Zod 3 runtime z.ZodIssueCode object. This prevents TypeError crashes when downstream projects resolve Zod 4 and ensures A2uiValidationError diagnostics surface cleanly across both Zod 3 and Zod 4. It also adds unit tests covering Zod 4 error shapes in message-processor.test.ts.

Fixes #3812

Pre-launch Checklist

One time:

For this PR:

  • I have updated the relevant CHANGELOG.md file.
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.

If you need help, consider asking for advice on the discussion board.

@github-project-automation github-project-automation Bot moved this to Todo in A2UI Nov 2, 2026
@Varun-S10 Varun-S10 self-assigned this Nov 2, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the codebase to support Zod 4 by replacing references to ZodError.errors with ZodError.issues, utilizing string literals instead of z.ZodIssueCode enums, and handling nested 2D issue arrays for invalid_union errors. Additionally, corresponding unit tests have been added to verify these changes. There are no review comments, so I have no feedback to provide.

@Varun-S10

Copy link
Copy Markdown
Collaborator Author

Hi @gspencergoog, Could you please take a look?

@gspencergoog gspencergoog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request updates @a2ui/web_core validation error formatting to use ZodError.issues instead of ZodError.errors, replaces z.ZodIssueCode enum reads with string literals, and adds fallback handling for Zod 4's 2D errors array on invalid_union issues. These changes improve forward compatibility with Zod 4 without introducing regressions. As verified through code inspection of google3's colinhacks_zod (v3.25.76) and local runtime execution, all changes are fully backward-compatible with Zod 3 used in google3.

🤖 Agent-generated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@a2ui/web_core 0.14.0: validation errors throw TypeError under zod 4 (result.error.errors is undefined)

2 participants