Skip to content

fix(types): align schema types with Sentry API#169

Merged
betegon merged 2 commits intomainfrom
fix/schema-type-mismatches
Feb 4, 2026
Merged

fix(types): align schema types with Sentry API#169
betegon merged 2 commits intomainfrom
fix/schema-type-mismatches

Conversation

@betegon
Copy link
Member

@betegon betegon commented Feb 4, 2026

Summary

Fixes ZodError when parsing issues with annotations by aligning the CLI's Zod schemas with the official Sentry API schema.

Issue: https://sentry.sentry.io/issues/7237665256/

Changes

  1. annotations - Changed from string[] to {displayName, url}[] to match the actual API response structure
  2. sdk.name / sdk.version - Made nullable to match API schema (defensive fix)

Both issues were identified by comparing our types against /Users/bete/code/sentry-api-schema/openapi-derefed.json.

Test Plan

  • bun run typecheck passes
  • bun run lint passes
  • bun test test/types passes
  • Verified against the original failing issue

The Sentry API returns annotations as objects with displayName and url
fields, not strings. This was causing ZodError when parsing issues with
annotations.

Closes CLI-R
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (issue) Replace --org/--project flags with /ID syntax by BYK in #161

Bug Fixes 🐛

  • (types) Align schema types with Sentry API by betegon in #169
  • Added nullable in substatus's zod validation by MathurAditya724 in #157

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Codecov Results 📊

❌ Patch coverage is 75.00%. Project has 2024 uncovered lines.
✅ Project coverage is 69.22%. Comparing base (base) to head (head).

Files with missing lines (29)
File Patch % Lines
human.ts 31.80% ⚠️ 684 Missing
resolve-target.ts 10.74% ⚠️ 291 Missing
oauth.ts 25.10% ⚠️ 194 Missing
upgrade.ts 39.76% ⚠️ 153 Missing
api-client.ts 74.21% ⚠️ 138 Missing
resolver.ts 3.23% ⚠️ 120 Missing
errors.ts 5.94% ⚠️ 95 Missing
migration.ts 47.44% ⚠️ 82 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 39.02% ⚠️ 25 Missing
utils.ts 87.43% ⚠️ 24 Missing
version-check.ts 76.00% ⚠️ 18 Missing
detector.ts 87.79% ⚠️ 16 Missing
schema.ts 64.10% ⚠️ 14 Missing
auth.ts 94.78% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
arg-parsing.ts 93.41% ⚠️ 6 Missing
upgrade.ts 93.83% ⚠️ 5 Missing
index.ts 95.06% ⚠️ 4 Missing
colors.ts 91.84% ⚠️ 4 Missing
telemetry.ts 97.20% ⚠️ 4 Missing
env-file.ts 97.17% ⚠️ 3 Missing
sentry-urls.ts 88.00% ⚠️ 3 Missing
alias.ts 98.56% ⚠️ 2 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
java.ts 97.22% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    69.20%    69.22%    +0.02%
==========================================
  Files           57        57         —
  Lines         6565      6576       +11
  Branches         0         0         —
==========================================
+ Hits          4543      4552        +9
- Misses        2022      2024        +2
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon marked this pull request as ready for review February 4, 2026 13:50
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

The Sentry API defines sdk.name and sdk.version as nullable fields.
Making them nullable prevents potential ZodError if the API returns
null values for these fields.

Also updates the formatter to handle null values gracefully instead
of displaying 'null null'.
@betegon betegon force-pushed the fix/schema-type-mismatches branch from 51d6bc7 to 0696572 Compare February 4, 2026 13:58
@kingkong0905
Copy link

Thank. I got the same issue with this one today and cant not using cli

@betegon betegon merged commit 3dffbf4 into main Feb 4, 2026
24 checks passed
@betegon betegon deleted the fix/schema-type-mismatches branch February 4, 2026 14:15
@betegon
Copy link
Member Author

betegon commented Feb 4, 2026

@kingkong0905 sorry you hit this one. we'll probably do a release today with this patch ;)

Thanks for using the CLI!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants