Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions packages/cli/src/lib/api/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import {
type EventAttachmentDetailsResponse,
type GetOrganizationIssueEventData,
getOrganizationIssueEvent,
getProjectEvent,
listOrganizationIssueEvents,
Expand Down Expand Up @@ -44,13 +43,6 @@ export async function getLatestEvent(
issueId: string,
): Promise<SentryEvent> {
const config = await getOrgSdkConfig(orgSlug);
// `collapse=adjacentEvents` lets Sentry skip the next/previous-event Snuba
// lookups; the CLI never reads `nextEventID` or `previousEventID`. The
// generated query type omits `collapse`, so the intersection keeps the
// server-supported parameter without weakening the generated client type.
const query: NonNullable<GetOrganizationIssueEventData["query"]> & {
collapse: string[];
} = { collapse: ["adjacentEvents"] };

const result = await getOrganizationIssueEvent({
...config,
Expand All @@ -59,7 +51,6 @@ export async function getLatestEvent(
issue_id: issueId,
event_id: "latest",
},
query,
});

return unwrapResult<SentryEvent>(result, "Failed to get latest event");
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/test/lib/api-client.coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,6 @@ describe("events.ts", () => {
const req = new Request(input!, init);
expect(req.url).toContain("/organizations/test-org/issues/");
expect(req.url).toContain("/events/latest/");
expect(new URL(req.url).searchParams.getAll("collapse")).toEqual([
"adjacentEvents",
]);
return new Response(JSON.stringify(event), {
status: 200,
headers: { "Content-Type": "application/json" },
Expand Down
8 changes: 8 additions & 0 deletions packages/toolkit-core/src/response-cache/tiers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ describe("classifyUrl", () => {
).toBe("volatile");
});

it("keeps project events volatile when adjacent events are collapsed", () => {
expect(
classifyUrl(
`${API}/projects/acme/backend/events/deadbeef/?collapse=adjacentEvents`,
),
).toBe("volatile");
});

it("reuses full traces for at most 60 seconds, since spans can still arrive", () => {
const url = `${API}/organizations/acme/trace/${TRACE_ID}/?limit=100`;
expect(classifyUrl(url)).toBe("volatile");
Expand Down
5 changes: 3 additions & 2 deletions packages/toolkit-core/src/response-cache/tiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ const URL_TIER_PATTERNS: readonly [TtlTier, readonly RegExp[]][] = [
/\/trace-logs\//,
// Full traces gain spans as they arrive
/\/trace\/[0-9a-f]{32}\//,
// Project event details embed `nextEventID`/`previousEventID` and user
// reports, and reprocessing can change them for the same ID
// Project event details embed user reports (and `nextEventID`/
// `previousEventID` unless collapsed), and reprocessing can change them
// for the same ID
/\/projects\/[^/]+\/[^/]+\/events\/[^/?]+\/?(?:\?|$)/,
],
],
Expand Down
Loading