Skip to content

fix: three bug fixes — xcode report JSON.parse, upgrade response.json(), seer schema validation - #1349

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-49e9
Draft

fix: three bug fixes — xcode report JSON.parse, upgrade response.json(), seer schema validation#1349
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-49e9

Conversation

@cursor

@cursor cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Three defensive bug fixes for crash-prone code paths discovered via codebase analysis.


1. fix(react-native): guard JSON.parse of sourcemap report file

Root cause: In src/commands/react-native/xcode.ts, JSON.parse(readFileSync(reportPath)) is called on a file written by an external React Native subprocess. If the subprocess crashes or exits before writing the report, this throws an unhelpful ENOENT or SyntaxError.

Reproduction: Trigger an Xcode build where the Metro bundler script fails before writing sourcemap-report.json (e.g., Metro crash, Hermes misconfiguration, build timeout).

Fix: Wrap in try/catch, log at debug level, and return { status, pair: null } — the same graceful fallback used when the report lacks required fields.


2. fix(upgrade): wrap response.json() to catch non-JSON responses

Root cause: In src/lib/upgrade.ts, fetchLatestFromGitHub and fetchLatestFromNpm call response.json() after checking response.ok, but a CDN outage or corporate proxy can return HTML with a 200 status code. The resulting SyntaxError escapes as an unhandled exception.

Reproduction: Run sentry cli upgrade behind a corporate proxy that serves a login page at 200 OK, or during a CDN outage returning HTML.

Fix: Wrap response.json() in try/catch and throw a proper UpgradeError('network_error', ...) with descriptive messages.


3. fix(seer): validate autofix response with existing Zod schema

Root cause: In src/lib/api/seer.ts, getAutofixState calls apiRequestToRegion<AutofixResponse> without passing the existing AutofixResponseSchema. If the API returns malformed data, the code crashes when accessing data.autofix properties instead of failing with a schema validation error.

Reproduction: Call sentry issue explain when the Seer API returns an unexpected response shape (e.g., during a deploy with schema changes).

Fix: Pass schema: AutofixResponseSchema to apiRequestToRegion, enabling runtime validation using the already-defined Zod schema.

Open in Web View Automation 

cursoragent and others added 3 commits August 3, 2026 12:07
…LI-RN-XCODE)

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…CLI-UPGRADE)

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…LI-SEER)

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1349/

Built to branch gh-pages at 2026-08-03 12:10 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

1 participant