refactor(cli): remove remaining zod usage, migrate to valibot - #1389
Open
jared-outpost[bot] wants to merge 2 commits into
Open
refactor(cli): remove remaining zod usage, migrate to valibot#1389jared-outpost[bot] wants to merge 2 commits into
jared-outpost[bot] wants to merge 2 commits into
Conversation
Completes the zod→valibot migration started in #1370/#1388 and drops the `zod` dependency entirely. Migrated the three coupling categories from #1371: - `@sentry/api/zod` schemas in types/sentry.ts, types/feedback.ts → `@sentry/api/valibot` (v*-prefixed), reworking the .pick/.partial/.shape derivations (valibot has no .extend — composed via object spread). - Central response validator in lib/api/infrastructure.ts + lib/api/logs.ts: z.ZodType → GenericSchema, schema.safeParse → safeParse(schema, data), result.error.issues → result.issues. Sentry telemetry context renamed zod_validation → schema_validation. - Zod-internals introspection in lib/formatters/output.ts rewritten for valibot's runtime shape (.entries/.wrapped/.options + getDescription), incl. pipe/coercion type resolution and nested-wrapper descriptions. Also migrated the ~13 self-contained z.object schema files (types/*, lib/api/*), commands/code-mappings/upload.ts, and the test suites' schema API usage. Verified: tsc clean, biome clean, generated skill docs regenerate unchanged (introspection parity), full lib/types/commands test suites pass. Closes #1371
BYK
marked this pull request as ready for review
August 7, 2026 16:43
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0108cd2. Configure here.
| `Unexpected response format from ${endpoint}`, | ||
| response.status, | ||
| result.error.message | ||
| result.issues.map((issue) => issue.message).join(", ") |
Contributor
There was a problem hiding this comment.
Validation errors omit failing field paths
Low Severity
Valibot issue messages do not include their paths, so joining only issue.message removes the failing field names previously present in ZodError.message. API format failures become ambiguous, especially when several fields produce identical type errors.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 0108cd2. Configure here.
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.


finishes the zod→valibot migration from #1370/#1388 and drops the
zoddependency entirely. covers all three coupling categories in #1371 plus the ~13 self-contained schema files that were still on zod.what changed
@sentry/api/zod→@sentry/api/valibot(types/sentry.ts, types/feedback.ts): switched to thev*-prefixed SDK schemas and reworked the.pick/.partial/.shape/.elementderivations. valibot has no.extend, so extensions are composed viaobject({ ...Base.entries, ... }).z.ZodType<T>→GenericSchema<unknown, T>,schema.safeParse(x)→safeParse(schema, x),result.data/result.error.issues→result.output/result.issues. the Sentry telemetry context key is renamedzod_validation→schema_validation(extractSchemaFields/zodTypeToStringread zod's_def.typeName/.shape; rewritten against valibot's runtime shape (.entries/.wrapped/.options+getDescription()), including pipe/coercion type resolution and descriptions nested under wrapper schemas.z.objectschemas (types/conversation, dashboard, replay, seer; lib/api/proguard, code-mappings, chunk-upload, dart-symbols, debug-files, preprod-artifacts, conversations, dashboards),commands/code-mappings/upload.ts, and the affected test suites' schema API usage.zodfrompackages/cli/package.json+ refreshed the lockfile.testing
tsc --noEmit: cleanbiome check ./src ./test: clean (933 files)test/lib,test/types,test/commandssuites pass (1800+ tests)notes for reviewers
zod_validation→schema_validationin SentrysetContext— if any dashboards/alerts key offzod_validation, they'll need updating.@sentry/apizod peer:@sentry/api@0.256.0still declares an optionalzod: ^3.24.0peer. with the CLI's direct zod dep removed, transitive zod (from AI SDKs) floats to v4, so pnpm prints a benign unmet-optional-peer warning. install and--frozen-lockfileboth succeed; our usage goes through the valibot entrypoint so zod isn't needed at runtime.nullableonAIConversationDetailsSchema.title, andReplayViewOutputSchemaaccidentally spreading the list-item base instead of the details schema (droppingclicks/replay_type).Closes #1371