diff --git a/packages/mcp-core/src/api-client/schema.test.ts b/packages/mcp-core/src/api-client/schema.test.ts index 4ab11b43..b46c6895 100644 --- a/packages/mcp-core/src/api-client/schema.test.ts +++ b/packages/mcp-core/src/api-client/schema.test.ts @@ -32,6 +32,31 @@ describe("IssueSchema", () => { expect(result).toEqual(errorIssue); }); + it("should allow issues with null lastSeen", () => { + const staleIssue = { + id: "321", + shortId: "TEST-321", + title: "Intermittent crash", + firstSeen: "2025-01-01T00:00:00Z", + lastSeen: null, + count: 0, + userCount: 0, + permalink: "https://sentry.io/issues/321/", + project: { + id: "1", + name: "stale-project", + slug: "stale-project", + }, + status: "resolved", + culprit: "stale.ts", + type: "error", + }; + + const result = IssueSchema.parse(staleIssue); + + expect(result.lastSeen).toBeNull(); + }); + it("should parse a regressed performance issue", () => { // Anonymized payload from real regressed issue (issue #633) const regressedIssue = { diff --git a/packages/mcp-core/src/api-client/schema.ts b/packages/mcp-core/src/api-client/schema.ts index de23c85d..4647db18 100644 --- a/packages/mcp-core/src/api-client/schema.ts +++ b/packages/mcp-core/src/api-client/schema.ts @@ -194,7 +194,7 @@ export const IssueSchema = z shortId: z.string(), title: z.string(), firstSeen: z.string().datetime(), - lastSeen: z.string().datetime(), + lastSeen: z.string().datetime().nullable(), count: z.union([z.string(), z.number()]), userCount: z.union([z.string(), z.number()]), permalink: z.string().url(),