Repository navigation
ref(api): promote Telemetry Experience release endpoints to spectacular public docs (sentry-api-schema#76) - #118005
Conversation
Pilot for getsentry/sentry-api-schema#76. This endpoint was documented publicly only via the legacy hand-maintained api-docs/ spec (sentence operationId, no summary), while its source method was PRIVATE and already carried a fully-migrated @extend_schema (token operation_id + summary + params + typed responses + examples). - flip GET publish_status PRIVATE -> PUBLIC so the decorator drives the spec - delete the legacy api-docs/paths/releases/organization-release-commits.json and its $ref in api-docs/openapi.json Generated spec now emits operationId=listOrganizationReleaseCommits + summary='List an Organization Release's Commits' (was the sentence with no summary). summary == old operationId, so the docs slug is unchanged.
… spectacular public docs Migrates the rest of the team's release endpoints off the legacy hand-maintained api-docs/ system onto drf-spectacular decorators (13 ops across 6 files), completing the set started by the org-release-commits pilot. For each: flip publish_status -> PUBLIC so the decorator drives the spec, and delete the legacy api-docs path file + its $ref. Decorator parity work surfaced by the build: - list/update release-file ops still had sentence operation_ids -> tokens + summaries - createOrganizationRelease body fields (projects/headCommits/refs) needed help_text descriptions - the two file delete()s needed Response[None] (PUBLIC endpoints can't use bare Response) Summaries equal the old legacy operationIds, so docs slugs are unchanged. Verified: spectacular --validate --fail-on-warn passes; all 14 release ops emit token operationIds; 216 public ops total (unchanged); ids unique. Excludes commitfiles (owned by Issues) and deploys (unowned).
…motion
The api docs endpoint tests validate real responses against the (now stricter,
decorator-driven) schemas, exposing two inaccuracies the loose legacy schemas
had masked:
- CommitSerializer emits author={} for authorless commits, but
CommitSerializerResponse.author only allowed a populated Author. Allow an
EmptyAuthor ({}) alongside Author so the published schema matches reality.
- The release-file upload apidocs tests forced SERVER_NAME=us.sentry.io, which
only matched the legacy POST's operation-level region server. The endpoint now
uses the standard global server (still region-templated), so drop the forced
host to match every other endpoint test.
Verified: spectacular --validate --fail-on-warn clean; the 4 previously-failing
ops pass; full releases apidocs suite (19) + commit-consumer tests (4) green.
…sponse
The release-commits endpoints serialize via the Commit registry, where
CommitWithReleaseSerializer wins — so the response includes a 'releases'
field that the declared CommitSerializerResponse omitted. The api docs tests
didn't catch it because OpenAPI response validation ignores undeclared extra
fields.
- declare list[CommitSerializerResponseWithReleases] on both release-commits
endpoints so 'releases' is part of the published contract
- make CommitReleaseSerializerResponse.ref/url/dateReleased nullable to match
what the serializer actually returns (None for releases without them)
- give the apidocs tests one authored + one authorless commit so both the
populated-author and empty-author ({}) shapes are actually validated
Verified: spectacular --validate --fail-on-warn clean; releases apidocs suite
(19) + commit-consumer tests (4) green.
The release-commits response now declares CommitSerializerResponseWithReleases (releases required), so the LIST_RELEASE_COMMITS example needs a releases entry or openapi-examples-validator (validate-api-examples / api docs test) fails with 'must have required property releases'. Verified: validate-api-examples reports no errors; releases apidocs suite (19) green.
|
Why are we making all of these public? I have too little context on these endpoints to even tell if they are ready to be public and if we are ready to commit to maintaining them and not breaking them. Keeping them private gives us that freedom, but once they are public, it's way harder to do work on them |
|
@vgrozdanic Heyaaa! i know you're travelling that's why i didn't bother you (yet). from my understanding:
so basically, this PR moves them to our new convention. |
|
maybe we can loop someone else that has more context on this? |
|
example of them being already published https://docs.sentry.io/api/releases/list-an-organizations-releases/ |
|
@betegon let me see if i can find the team behind this, because i think it was a mistake that we (telemetry experience) are put as owners for these endpoints. If we don't manage to find anyone, I can find some time at the end of the week to look into this to understand what's happening |
|
@vgrozdanic i talked with @shellmayr and told me the same! also talked with @gricha and he will review this one. thanks for the help |
|
So these endpoints having been public and having been out there for a while means there's a good chance someone depends on them and we should make sure they are backwards compatible. looking at openapi-diff job, i am worried esp. on some of the input parameters that it wouldn't be - can you run an agent pass to identify backwards incompatible changes that may have slipped in? On the ownership part I think if we don't have a good team for it, we can add community ownership behind blocking lint so no new endpoints are added there. |
gricha
left a comment
There was a problem hiding this comment.
let's do a pass on backwards comaptibility
|
Ran the agent pass. This PR changes zero runtime behavior. The diff against
No serializer or view logic changed — e.g. The four diffs a tool like
So no backwards-incompatible changes to the API. The only downstream effect is that the generated |
gricha
left a comment
There was a problem hiding this comment.
Approved but check the actual writes you're doing on CommitAuthor
| author = CommitAuthor.objects.create( | ||
| organization_id=project.organization_id, name="Test Author", email=self.user.email | ||
| ) |
There was a problem hiding this comment.
you're adding this write in two places, is this intentional? the original comment mentions no runtime changes, but this has actual implications.
There was a problem hiding this comment.
intentional! added it in two places because one it's at project level and the other one at org level.
added them because we were only testing created author-less commits, so they only go through the {} part
There was a problem hiding this comment.
now we go through both empty and not empty. it doesn't have any runtime changes, the api returns the same, we just m
What changed is only the documented response type (CommitSerializerResponse → CommitSerializerResponseWithReleases): the endpoints were under-documenting before, declaring the trimmed parent while returning the fuller shape at runtime
Builds the MCP against the latest published SDK (was ^0.232.0). 0.250.0 carries the now-explicit token operationIds for the release endpoints promoted in getsentry/sentry#118005 (and everything merged since), so the SDK names the MCP uses are backed by explicit `@extend_schema` tokens rather than normalizer-derived from sentence operationIds. No code changes: all 35 SDK functions the client uses keep byte-identical signatures. Verified — workspace tsc clean (0 source errors), mcp-core suite 1164 pass / 0 fail.
…ar public docs (sentry-api-schema#76) (#118005) ## What Migrates **all of Telemetry Experience's release endpoints** off the legacy hand-maintained `api-docs/` system onto drf-spectacular `@extend_schema` decorators — so their public docs entries get clean token `operationId`s + `summary`s (instead of the legacy sentence operationIds with no summary). Pilot + full team sweep for getsentry/sentry-api-schema#76. **14 operations across 7 source files / 7 legacy files:** | Path | methods | tokens | | --- | --- | --- | | `…/releases/` | GET, POST | listOrganizationReleases, createOrganizationRelease | | `…/releases/{version}/files/` | GET, POST | listOrganizationReleaseFiles, uploadOrganizationReleaseFile | | `…/releases/{version}/files/{file_id}/` | GET, PUT, DELETE | get/update/deleteOrganizationReleaseFile | | `…/releases/{version}/commits/` | GET | listOrganizationReleaseCommits | | `…/projects/…/releases/{version}/commits/` | GET | listProjectReleaseCommits | | `…/projects/…/releases/{version}/files/` | GET, POST | listProjectReleaseFiles, uploadProjectReleaseFile | | `…/projects/…/releases/{version}/files/{file_id}/` | GET, PUT, DELETE | get/update/deleteProjectReleaseFile | For each op: flip `publish_status` → `PUBLIC` so the decorator drives the spec, and delete the legacy `api-docs/paths/releases/*.json` file + its `$ref` in `api-docs/openapi.json`. ## Decorator-parity work surfaced by the build Promoting to PUBLIC turns on the spec-completeness checks, which required: - 4 list/update file ops still had **sentence `operation_id`s** → tokens + summaries - `createOrganizationRelease`'s request body fields (`projects`, `headCommits`, `refs`) needed **`help_text`** descriptions - the two file `delete()`s needed **`Response[None]`** (PUBLIC endpoints can't use bare `Response`) ## Slug preservation Each `summary` equals the endpoint's old **legacy** `operationId` verbatim, so `slugify(summary || operationId)` is unchanged — no docs-URL/SEO breakage. ## Verification `make build-deprecated-docs` + `sentry django spectacular --validate --fail-on-warn`: - all 14 ops emit token `operationId` + `summary` - **216 public ops total (unchanged)** — nothing added or lost, just relocated source-of-truth - operationIds unique across `src/sentry` ## Scope notes / sign-off This **promotes these endpoints to officially PUBLIC** (a public-API stability commitment) — but they're already de-facto public via the legacy docs, so this aligns source with reality. Flagging @getsentry/telemetry-experience as owner. Excluded: the `commitfiles` endpoint (owned by Issues, and has no decorator yet) and `deploys` (unowned, already de-listed). Those are tracked in the issue for their owners. --- ## Old → new doc parity (no regression) Verified each op's **old** legacy `api-docs/` definition against the **new** decorator output in the generated spec. **Nothing dropped on any of the 14** — params/responses are a strict superset (the decorators document params and error codes the legacy files omitted). | Method · path | Params dropped | Params added | Resp codes added | Body kept | Verdict | | --- | --- | --- | --- | --- | --- | | GET `…/releases/` | — | `environment` | — | n/a | ✅ | | POST `…/releases/` | — | — | `208`, `401` | ✅ | ✅ | | GET `…/releases/{version}/files/` | — | `checksum`, `query` | `401` | n/a | ✅ | | POST `…/releases/{version}/files/` | — | — | `400`, `401`, `409` | ✅ | ✅ | | GET `…/releases/{version}/files/{file_id}/` | — | — | `401` | n/a | ✅ | | PUT `…/releases/{version}/files/{file_id}/` | — | — | `400`, `401` | ✅ | ✅ | | DELETE `…/releases/{version}/files/{file_id}/` | — | — | `401` | n/a | ✅ | | GET `…/releases/{version}/commits/` | — | — | `401` | n/a | ✅ | | GET `…/projects/…/releases/{version}/commits/` | — | — | `401` | n/a | ✅ | | GET `…/projects/…/releases/{version}/files/` | — | `checksum`, `query` | `401` | n/a | ✅ | | POST `…/projects/…/releases/{version}/files/` | — | — | `400`, `401`, `409` | ✅ | ✅ | | GET `…/projects/…/releases/{version}/files/{file_id}/` | — | — | `401` | n/a | ✅ | | PUT `…/projects/…/releases/{version}/files/{file_id}/` | — | — | `400`, `401` | ✅ | ✅ | | DELETE `…/projects/…/releases/{version}/files/{file_id}/` | — | — | `401` | n/a | ✅ | **Notes:** - These endpoints were already public (in `openapi-derefed.json` / `@sentry/api`); this only relocates the source of truth from the legacy file to the decorator. No new exposure. - Each `summary` equals the old legacy `operationId` verbatim → docs slug (`slugify(summary || operationId)`) is byte-identical → **same docs URL, no SEO/link change**. - `publish_status` is documentation-only (read solely by the apidocs spec generator) — **no access, permission, or runtime-behavior change**. - One intentional shape change: release-commits responses now declare the full `CommitSerializerResponse` instead of the legacy trimmed `MinimalCommit` — an accuracy improvement (the endpoint always returned the full serializer).
What
Migrates all of Telemetry Experience's release endpoints off the legacy hand-maintained
api-docs/system onto drf-spectacular@extend_schemadecorators — so their public docs entries get clean tokenoperationIds +summarys (instead of the legacy sentence operationIds with no summary). Pilot + full team sweep for getsentry/sentry-api-schema#76.14 operations across 7 source files / 7 legacy files:
…/releases/…/releases/{version}/files/…/releases/{version}/files/{file_id}/…/releases/{version}/commits/…/projects/…/releases/{version}/commits/…/projects/…/releases/{version}/files/…/projects/…/releases/{version}/files/{file_id}/For each op: flip
publish_status→PUBLICso the decorator drives the spec, and delete the legacyapi-docs/paths/releases/*.jsonfile + its$refinapi-docs/openapi.json.Decorator-parity work surfaced by the build
Promoting to PUBLIC turns on the spec-completeness checks, which required:
operation_ids → tokens + summariescreateOrganizationRelease's request body fields (projects,headCommits,refs) neededhelp_textdescriptionsdelete()s neededResponse[None](PUBLIC endpoints can't use bareResponse)Slug preservation
Each
summaryequals the endpoint's old legacyoperationIdverbatim, soslugify(summary || operationId)is unchanged — no docs-URL/SEO breakage.Verification
make build-deprecated-docs+sentry django spectacular --validate --fail-on-warn:operationId+summarysrc/sentryScope notes / sign-off
This promotes these endpoints to officially PUBLIC (a public-API stability commitment) — but they're already de-facto public via the legacy docs, so this aligns source with reality. Flagging @getsentry/telemetry-experience as owner.
Excluded: the
commitfilesendpoint (owned by Issues, and has no decorator yet) anddeploys(unowned, already de-listed). Those are tracked in the issue for their owners.Old → new doc parity (no regression)
Verified each op's old legacy
api-docs/definition against the new decorator output in the generated spec. Nothing dropped on any of the 14 — params/responses are a strict superset (the decorators document params and error codes the legacy files omitted).…/releases/environment…/releases/208,401…/releases/{version}/files/checksum,query401…/releases/{version}/files/400,401,409…/releases/{version}/files/{file_id}/401…/releases/{version}/files/{file_id}/400,401…/releases/{version}/files/{file_id}/401…/releases/{version}/commits/401…/projects/…/releases/{version}/commits/401…/projects/…/releases/{version}/files/checksum,query401…/projects/…/releases/{version}/files/400,401,409…/projects/…/releases/{version}/files/{file_id}/401…/projects/…/releases/{version}/files/{file_id}/400,401…/projects/…/releases/{version}/files/{file_id}/401Notes:
openapi-derefed.json/@sentry/api); this only relocates the source of truth from the legacy file to the decorator. No new exposure.summaryequals the old legacyoperationIdverbatim → docs slug (slugify(summary || operationId)) is byte-identical → same docs URL, no SEO/link change.publish_statusis documentation-only (read solely by the apidocs spec generator) — no access, permission, or runtime-behavior change.CommitSerializerResponseinstead of the legacy trimmedMinimalCommit— an accuracy improvement (the endpoint always returned the full serializer).