Repository navigation
feat(apidocs): Publish dashboard revision endpoints - #130358
Merged
Merged
Conversation
Mark the dashboard revision list and restore endpoints PUBLIC and document them, so they reach the public API schema and the generated @sentry/api client that the Sentry CLI uses. Revisions have been GA since their feature flag was removed. Describe the revision response fields, and declare restore non-idempotent: each call records a new pre-restore revision and an audit log entry. The agent token permission matrix covers every public operation, so it now builds a dashboard revision for the restore route's revision_id placeholder. Refs #130351
BYK
approved these changes
Nov 7, 2026
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Nov 7, 2026
… revision operations (#2093) Next batch of moving the CLI onto `@sentry/api` generated operations (follows #2073, #2075, #2078, #2090). `@sentry/api` 1.49.0 publishes three endpoints the CLI already calls: | CLI function | Endpoint | Operation | Published by | | --- | --- | --- | --- | | `listTraceLogs` (`log list --trace`, `trace logs`) | `GET /organizations/{org}/trace-logs/` | `listOrganizationTraceLogs` | getsentry/sentry#130357 | | `listDashboardRevisionsPaginated` (`dashboard revisions`) | `GET /organizations/{org}/dashboards/{id}/revisions/` | `listOrganizationDashboardRevisions` | getsentry/sentry#130358 | | `restoreDashboardRevision` (`dashboard restore`) | `POST /organizations/{org}/dashboards/{id}/revisions/{rev}/restore/` | `restoreOrganizationDashboardRevision` | getsentry/sentry#130358 | These calls stop using `apiRequestToRegion` and behave the same as before: - The CLI's valibot schemas still validate each response, so schema mismatches still fail as "Unexpected response format". - Region routing goes through `getOrgSdkConfig`. - Pagination still uses the Link-header cursors, including the previous cursor for revisions. - 401/403 errors are still enriched by `unwrapResult`. - On the wire, `traceId` and `sort` are sent as single repeated params, the same as before. - The dashboard and revision ids are passed as strings with the same cast `getDashboard` uses. The SDK URL-encodes them the way the old code did. All three operations have `experimental: false`. Bumping to 1.49.0 also pulls in the 1.47.0 regen and 1.48.0's `experimental` flag. Typecheck and generated docs don't change. ### Still on the helpers | Call site | Endpoint | Waiting on | | --- | --- | --- | | `issues.ts` `getSharedIssue` (raw fetch) | `GET /shared/issues/{share_id}/` | getsentry/sentry#130359 merged after the 1.49.0 regen, so it needs the next release | | `releases.ts` set-commits | `GET /organizations/{org}/releases/{version}/previous-with-commits/` | same as above (#130359) | | `org-auth-tokens.ts` (3 sites) | list/create/delete `/organizations/{org}/org-auth-tokens/` | getsentry/sentry#130360 (auto-merging) | | `projects.ts` dsn-lookup | `GET /organizations/{org}/dsn-lookup/` | getsentry/sentry#130367 | | `auth.ts` | `GET /api/0/` (control silo) | getsentry/sentry#130369 | | `users.ts` | `GET /auth/` → `GET /users/me/` | getsentry/sentry#130368 | | `organizations.ts` | `GET /users/me/regions/` | #2091 replaces it with `listOrganizations` | | `traces.ts` / `logs.ts` | `GET /projects/{org}/{project}/trace-items/{id}/` | sentry publish PR still to come | | `preprod-artifacts.ts` | build assemble, snapshot archive status and trigger, snapshot create (zstd body) | sentry publish PRs still to come | | `projects.ts` | `GET /projects/?query=dsn:` fallback for old self-hosted servers | not public; needs a decision (see below) | These are the agreed exceptions: `trials.ts` (`/customers/*` and the product-trial PUT), snapshot `upload-options` and archive `?download`, `downloadBuildArtifact`'s install URL, chunk-upload server URLs, and `rawApiRequest` for `sentry api`. **Needs a decision:** the self-hosted DSN fallback from #2090 calls `GET /projects/?query=dsn:`, which isn't in the public schema. It needs to be added to the exception list for the lint rule, or dropped once old self-hosted versions age out. ### Testing - `pnpm run tsc` and `pnpm run lint` pass. - `pnpm run test` fails only on the 5 file-permission tests that also fail on `main` in the sandbox (`completions` ×2, `upgrade`, `db/resilient`, `dsn/code-scanner`), plus `@sentry/cli3to4`, whose codemod binary needs GLIBC 2.35. - Added unit tests for the revision list (cursors, schema rejection) and for restore (operation args, error naming). The trace-logs test now checks `traceId` and `sort` on the wire. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A80220b9d4c297e2a971f05dcb03af515 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515/?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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Publishes the two dashboard revision endpoints the Sentry CLI calls, so they reach the public OpenAPI schema and the generated
@sentry/apiclient. Refs #130351, where the endpoints were proposed for publishing. In the Slack thread that led to it, revisions were confirmed to be "here to stay".GET /organizations/{org}/dashboards/{dashboard_id}/revisions/OrganizationDashboardRevisionsEndpointlistOrganizationDashboardRevisionsPOST /organizations/{org}/dashboards/{dashboard_id}/revisions/{revision_id}/restore/OrganizationDashboardRevisionRestoreEndpointrestoreOrganizationDashboardRevisionWhy now: the list endpoint landed in #113084 (2026-04-17) and restore in #113176 (2026-04-21). Both have been GA since the
dashboards-revisionsflag was removed in #116969 (2026-06-05). Neither endpoint has a feature gate.What changed
publish_statusgoes fromPRIVATEtoPUBLIC. Both already hadowner = ApiOwner.DASHBOARDS, so the ownership allowlist doesn't change.DashboardRevisionResponsenow has field descriptions, and itscreatedByuses a newDashboardRevisionCreatedByResponseTypedDict instead of an untypeddict. The new type matches the five keys the serializer builds:id,name,email,avatarType,avatarUrl.OffsetPaginator, socursor+per_page), newest first, and capped at 10 kept revisions (DashboardRevision.RETENTION_LIMIT).DashboardDetailsModelSerializer, the same type as GET/PUT on the dashboard). It is documented with 400 (unsupported snapshot version or validation errors), 403 (no edit access, viacheck_object_permissions), 404, and 409 (title conflict).idempotent_methods = frozenset(). Each call records a newpre-restorerevision and an audit log entry, so it isn't safe to resend.Response[T]arms, as flake8 S022 requires for published methods. The restore validation error path now goes throughas_validation_errors, with no runtime change.test_organization_agent_token.pybuilds its permission matrix from every public operation. It now creates a dashboard revision for the newrevision_idplaceholder.Schema check: I ran
make build-api-docsand diffedopenapi-derefed.jsonagainst master. The only path changes are these two added operations, plus the newDashboardRevisionListResponsecomponent. The "(Optional) Shows the difference between the prod and dev schema" check is expected to fail on a schema-changing PR.Tests run locally
make build-api-docsandpnpm run validate-api-examples: passpytest tests/apidocsplus the revisions, restore and dashboard details endpoint tests: 364 passedpytest tests/sentry/seer/endpoints/test_organization_agent_token.py: 321 passed, 23 xfailed (the restore row needed the new placeholder)prek runand mypy (--stage pre-push) on the changed files: passvia @BYK.
--
View Session [Sentry]