Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Issue
Other
Bug Fixes 🐛Issue
Other
Documentation 📚
Internal Changes 🔧
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ Patch coverage is 88.04%. Project has 1684 uncovered lines. Files with missing lines (22)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 64.79% 65.83% +1.04%
==========================================
Files 39 39 —
Lines 4723 4929 +206
Branches 0 0 —
==========================================
+ Hits 3060 3245 +185
- Misses 1663 1684 +21
- Partials 0 0 —Generated by Codecov Action |
| issueId: string | ||
| ): Promise<SentryEvent> { | ||
| return apiRequest<SentryEvent>( | ||
| `/organizations/${orgSlug}/issues/${issueId}/events/latest/`, | ||
| { | ||
| schema: SentryEventSchema, | ||
| } | ||
| `/organizations/${orgSlug}/issues/${issueId}/events/latest/` | ||
| ); |
There was a problem hiding this comment.
Bug: The getLatestEvent function lacks schema validation for the API response, unlike similar functions, risking runtime errors from malformed data.
Severity: MEDIUM
Suggested Fix
Restore the schema validation by adding schema: SentryEventSchema to the apiRequest call within the getLatestEvent function. This will align it with the implementation of the getEvent function and ensure response integrity.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/lib/api-client.ts#L424-L428
Potential issue: The `getLatestEvent` function in `api-client.ts` has had its schema
validation removed. This is inconsistent with other high-level API methods in the file,
which use Zod schemas to ensure runtime safety. Without validation, if the Sentry API
returns a malformed response, such as one missing `dateCreated` or
`contexts.trace.trace_id`, the function will not fail fast. Instead, it will return
incomplete data. Downstream code in `src/commands/issue/view.ts`, which relies on these
properties for the `--spans` feature, may then fail silently or produce incorrect
output.
Closes #83