Repository navigation
Commit 053880e
fix(api-client): allow null firstSeen/lastSeen on IssueSchema (#910)
## Summary
Sentry's API can return `null` for `firstSeen` / `lastSeen` on issues
(e.g. when events have aged out), which currently causes
`IssueSchema.parse()` in `SentryApiService.getIssue()` to throw a
`ZodError: Failed to validate keys: lastSeen` and breaks
`get_issue_details` for those issues.
Changes:
- Relax `IssueSchema.firstSeen` and `IssueSchema.lastSeen` to
`z.string().datetime().nullable()`.
- Update `formatIssueOutput` in `internal/formatting.ts` to omit the
"First Seen" / "Last Seen" lines when the values are null (previously
would have emitted `Invalid Date`). The `search-issues` formatter
already handles null via its `formatDate` helper, so no change needed
there.
- Add a regression test for nullable `firstSeen` / `lastSeen`.
Fixes MCP-SERVER-EWN (1136 events / 154 users affected since
2025-11-23).
## Review & Testing Checklist for Human
- [ ] Confirm that returning `null` for `firstSeen`/`lastSeen` in the
issue response is acceptable downstream (i.e. no other consumer of
`IssueSchema` assumes these are always strings). I grepped for
`issue.firstSeen` / `issue.lastSeen` and only found the two formatters;
please sanity-check.
- [ ] Spot-check `get_issue_details` output formatting by pointing at a
real issue where `lastSeen` is null (e.g. one of the events under
MCP-SERVER-EWN).
### Notes
The fix is intentionally minimal — same pattern already used by
`IssueTagValueSchema` for its own `firstSeen`/`lastSeen` fields.
Link to Devin session:
https://app.devin.ai/sessions/95257bed9fb74714955a56f9a5d7b606
Requested by: @dcramer
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Devin <devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <dcramer@gmail.com>1 parent 7b0b2de commit 053880e
3 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
213 | 241 | | |
214 | 242 | | |
215 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
| 309 | + | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1787 | 1787 | | |
1788 | 1788 | | |
1789 | 1789 | | |
1790 | | - | |
1791 | | - | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1792 | 1796 | | |
1793 | 1797 | | |
1794 | 1798 | | |
| |||
0 commit comments