Skip to content

refactor: remove remaining Zod usage after valibot migration #1371

Description

@jared-outpost

Follow-up to #1370 / #1367.

Remaining Zod usage that was intentionally left behind:

  • @sentry/api/zod coupling in src/types/sentry.ts, src/types/feedback.ts, src/lib/api/replays.ts
  • Central response validator in src/lib/api/infrastructure.ts (uses ZodError.issues for telemetry)
  • Zod internals introspection in src/lib/formatters/output.ts (_def.typeName)

These require either upstream valibot schemas, an interop layer, or repo-wide telemetry changes.

Once addressed, we can drop the zod dependency entirely.

Activity

MathurAditya724 commented on Aug 6, 2026

@MathurAditya724
Member

Jared you should shift this issue to https://github.com/getsentry/sentry-api-schema repo

BYK commented on Aug 6, 2026

@BYK
Member

@MathurAditya724 I'll work on the transition over at sentry-api-schema separately. This is to track the removal of Zod from the CLI itself.

self-assigned this
on Aug 6, 2026
added
jaredTrigger the Jared agent to work on stuff
on Aug 7, 2026

BYK commented on Aug 7, 2026

@BYK
Member

Jared, @sentry/api@0.256.0 is out now, check it out and see if we can switch to valibot completely

MathurAditya724 commented on Aug 7, 2026

@MathurAditya724
Member

Can you pick this up and open a PR for it?

jared-outpost commented on Aug 7, 2026

@jared-outpost
ContributorAuthor

@BYK opened a first-pass draft PR for this: #1388.

wanted to flag two things before going further, since one is a behavior-adjacent call and the other affects how we scope the rest:

1. the valibot entrypoint forces an @sentry/api bump — which narrows the issue-status union. the ./valibot export only actually ships a file as of @sentry/api 0.256.0 (0.253–0.255 advertise ./valibot in their exports map but ship no valibot.js). so removing @sentry/api/zod requires bumping ^0.253.0 → ^0.256.0. that bump narrows GetOrganizationIssueResponse["status"] and drops resolvedInNextRelease and muted, which tripped the ISSUE_STATUSES satisfies drift-guard in types/sentry.ts.

in the PR i kept those two statuses (they're still emitted by the retrieve-issue endpoint and still rendered by the CLI via STATUS_ICONS/STATUS_LABELS/STATUS_COLORS) and relaxed the guard to a deliberate superset — no rendering change. but it's your call: keep the superset (my pick, zero UX regression), or strictly follow the narrowed SDK union and drop them from rendering?

2. the "remaining" zod is larger than the three bullets, and can't be split cleanly. there are actually ~18 files still importing zod, and two shared hubs make it effectively all-or-nothing:

  • lib/api/infrastructure.ts — schema?: z.ZodType<T> + .safeParse() is used by ~30 callsites; changing the type migrates them all at once.
  • lib/formatters/output.ts — extractSchemaFields reads zod internals for ~16 commands' --help/--fields docs; valibot's runtime shape differs and needs a rewrite.

the replay SDK validator was the only piece safe to migrate in isolation, so that (plus the unblocking dep bump) is what #1388 does. the rest is a bigger, coordinated change — happy to take it on in a follow-up once you confirm the status-union direction above. full breakdown is in the PR description.

BYK commented on Aug 7, 2026

@BYK
Member

Jared, first pass got merged. Let's finish this off

BYK commented on Aug 7, 2026

@BYK
Member

JARED

BYK commented on Aug 7, 2026

@BYK
Member

JARED DONALD DUNN, get the follow up PR. NOW.

MathurAditya724 commented on Aug 7, 2026

@MathurAditya724
Member

Jared, finish the work which byk is talking about

added
jaredTrigger the Jared agent to work on stuff
and removed
jaredTrigger the Jared agent to work on stuff
on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

jaredTrigger the Jared agent to work on stuff

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions