This repository was archived by the owner on Nov 16, 2026. It is now read-only.
Repository navigation
feat(sdk): Default collapse=adjacentEvents on getProjectEvent - #113
Merged
Merged
Conversation
getsentry/sentry#129123 documented the collapse query parameter on the project event-details endpoint. Apply the same client-side default as getOrganizationIssueEvent so the SDK skips the next/previous-event lookups unless the caller passes collapse; collapse: [] restores them. Co-Authored-By: BYK <[email protected]>
sentry-junior
Bot
requested review from
BYK,
MathurAditya724 and
betegon
as code owners
October 28, 2026 23:56
BYK
approved these changes
Oct 28, 2026
2 tasks done
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Oct 29, 2026
Task 8.2 of the `unify-sentry-api-layer` change (#1669): the MCP's issue and event reads in `SentryApiService` now call `@sentry/api` operations instead of building `requestJSON(apiPath`...`)` URLs by hand. The calls go through the existing `sdkClient()` bridge, the same one the organization, team, and project lists use. The SDK only builds the path and query. The MCP still owns auth, host and region routing, retries, the `ApiError` mapping (HTTP status kept), and Zod parsing. The bridge also rejects any URL that doesn't match the `apiPath` result, so path-traversal protection is unchanged. When 6.1 lands, that bridge is the one place to swap in the injected fetch. Tool output and snapshots don't change. **Events** - `getEventForIssue` → `getOrganizationIssueEvent`. Since 0.421.0, `@sentry/api` sends `collapse=adjacentEvents` by default (getsentry/sentry-api-schema#112, server side getsentry/sentry#129094), so the hand-added `?collapse=adjacentEvents` from #1705 is gone. The existing request test still checks the parameter for `latest`, `oldest`, `recommended`, and a hex ID. The generated `event_id` type lists only the three aliases, so a hex ID needs a narrow cast. - `listEventsForIssue` → `listOrganizationIssueEvents`. It no longer sends `sort`. The generated operation has no such parameter, and `GroupEventsEndpoint` ignores it: results always come back `-timestamp` first. `search_issue_events` still uses its sort for the Discover link. Tests now check that link instead of the ignored query parameter. - `listEventAttachments` → `listProjectEventAttachments`. `getEventAttachment` reuses it for the metadata lookup. - The MCP never calls the project event details endpoint, so there was no explicit `collapse` to keep. `getProjectEvent` defaults it anyway as of 0.423.0 (getsentry/sentry-api-schema#113). **Issues** - `listIssues`, `getIssue`, `getIssueTagValues`, `getIssueExternalLinks`, `listIssueIntegrations`, and `getAutofixState` now use their operations. `listIssues` still sends `query=` when it's empty, because Sentry applies `is:unresolved` only when the parameter is missing. A new test covers this. The two link lists share a small `collectAllPages` walker with `listIssueLinkPages`, which the Sentry App lists still use. The external-issues operation has no `per_page`, so that call relies on Sentry's default page size of 100, which is what it used to send. **Still on `requestJSON`/`request()`** - No `@sentry/api` operation: issue notes (`createIssueComment`, `listIssueComments`), `getIssueActivity`, `getIssueUserReports`, `getEventCommitters`. - Writes: `updateIssue`, `linkNativeExternalIssue`, `unlinkNativeExternalIssue`, `unlinkSentryAppExternalIssue`, `startAutofix`. `sdkClient()` only forwards GETs. Letting it forward write bodies now would be replaced by the 6.1 transport anyway. The generated types also don't fit yet: `updateOrganizationIssue` marks every body field required, and `deleteOrganizationIssueIntegration` types `externalIssue` as a number. - The attachment download (`?download=1`) and its redirect probe stay on `request()`, because they read binary data or the redirect URL rather than JSON. The pnpm catalog moves `@sentry/api` from 0.420.0 to 0.423.0, the latest published version. #1712 makes the same bump, so either PR can land first. Regenerating the CLI's `api-schema.json` and `idempotent-operations.json` against 0.423.0 produced no changes. <!-- junior-request-attribution:start --> via **BYK**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A707535afec19b080fa2f8ef966a9edba --> -- [View Junior Session in Sentry](https://sentry.sentry.io/explore/conversations/agent%3A707535afec19b080fa2f8ef966a9edba/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #112. getsentry/sentry#129123 added a documented
collapsequery parameter (adjacentEvents) toGET /api/0/projects/{org}/{project}/events/{event_id}/, now in the synced schema. This applies the same client-side default asgetOrganizationIssueEvent.getProjectEventnow sendscollapse=adjacentEventsunless the caller passescollapse. The server then skips the next/previous-event lookups, andnextEventID/previousEventIDcome backnull.collapse: []sends nothing and restores them. Standalone, bound, andnarrowError_variants all behave the same way, and the generated JSDoc and README table state the default.The two operations share one map entry, so the build-time schema validation from #112 now covers both. The test that asserted
getProjectEventsends nocollapsenow asserts the default and the opt-out.This is a behavior change for callers that read
nextEventID/previousEventIDfromgetProjectEventwithout passingcollapse.via BYK.
--
View Junior Session in Sentry