You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6450743
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(cli): migrate replay SDK validator from zod to valibot (#1388)
---
first pass on #1371 — removing the remaining zod usage after the valibot
migration (#1370).
this PR does the one piece that can be migrated in isolation, plus the
dependency bump that unblocks the rest.
## what changed
- **bump `@sentry/api` `^0.253.0` → `^0.256.0`.** required: 0.256.0 is
the first release that actually ships the `./valibot` entrypoint —
0.253–0.255 advertise it in their `exports` map but ship no
`valibot.js`.
- **`lib/api/replays.ts`**: the SDK `responseValidator` now uses
`vListProjectReplayRecordingSegmentsResponse` from `@sentry/api/valibot`
+ valibot `safeParse`, instead of
`zListProjectReplayRecordingSegmentsResponse.safeParseAsync` from
`@sentry/api/zod`. this is the only zod usage not coupled to the two
shared hubs (see below), so it's the only piece safely migratable on its
own.
- **`types/sentry.ts`**: the SDK bump narrows
`GetOrganizationIssueResponse["status"]`, which made the
`ISSUE_STATUSES` `satisfies` drift-guard misfire. relaxed it to a
deliberate CLI superset that keeps `resolvedInNextRelease` and `muted` —
both are still emitted by the retrieve-issue endpoint and still rendered
by the CLI (`STATUS_ICONS`/`STATUS_LABELS`/`STATUS_COLORS`). **no
rendering behavior changes.**
- regenerated skill reference docs (`event.md`, `issue.md`) — the SDK
bump flipped `metadata` nullability; committed to keep the
`check-generated` CI job green.
## tested
- `tsc --noEmit`: clean
- `biome check` on changed files: clean
- `vitest run test/lib/api/replays test/types/sentry
test/lib/formatters`: 1001 passed
## follow-ups (remaining zod, tracked in #1371)
the rest can't be split cleanly because two shared hubs force an
all-or-nothing migration of the schemas that flow through them:
- **`lib/api/infrastructure.ts`** — `schema?: z.ZodType<T>` +
`.safeParse()` is used by ~30 callsites across the api layer; changing
the type migrates them all at once (valibot's `safeParse` is a free
function, not a method).
- **`lib/formatters/output.ts`** —
`extractSchemaFields`/`zodTypeToString` read zod internals
(`_def.typeName`, `.shape`, union `.options`) for ~16 commands'
`--help`/`--fields` docs; valibot's runtime shape
(`.type`/`.entries`/`.wrapped`) is different and needs a rewrite.
- the `@sentry/api/zod` schemas in `types/sentry.ts` +
`types/feedback.ts` (`zBaseTeam`, `zGetOrganizationIssueResponse`,
`zGroupEventsResponseDict`, `zEventAttachmentDetailsResponse`) → their
`v*` equivalents, incl. reworking the
`.pick`/`.partial`/`.extend`/`.shape`/`.describe` derivations.
- the ~13 self-contained `z.object` schemas (conversation, dashboard,
replay, seer, proguard, code-mappings, chunk-upload, dart-symbols,
debug-files, preprod-artifacts, conversations, dashboards) + the
`zod_validation` telemetry paths in `infrastructure.ts`/`logs.ts`.
once all of the above land, the `zod` dependency can be dropped
entirely.
⚠️ maintainer note: the `@sentry/api` 0.256 status-union narrowing is a
behavior-adjacent change — see the inline comment on `ISSUE_STATUSES`.
---
---------
Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
0 commit comments