Repository navigation
feat(apidocs): Describe organization response fields - #129991
Merged
Merged
Conversation
Add ApiDescription to the organization serializer TypedDicts and prune 66 entries from the response coverage baseline. The wording comes from the serializer code, the organization model and options, and the existing request field docs. `role` is typed `str` instead of `Any`; it's `access.role` and is only set when that isn't None. Serialized output doesn't change. Left in the baseline because the code doesn't make the meaning clear: aggregatedDataConsent, planSampleRate, desiredSampleRate, and the shapes of onboarding task `data` and `extraOptions`. Co-Authored-By: BYK <[email protected]>
BYK
approved these changes
Nov 4, 2026
BYK
enabled auto-merge (squash)
November 4, 2026 23:02
BYK
added a commit
that referenced
this pull request
Nov 4, 2026
This is a response coverage gap-fill for the ratchet added in #129972, and it follows #129991 (organization). It adds `ApiDescription` annotations to the response TypedDicts in: - `src/sentry/api/serializers/models/role.py`: `BaseRoleSerializerResponse`, `OrganizationRoleSerializerResponse`, `TeamRoleSerializerResponse` - `src/sentry/api/serializers/models/team.py`: `BaseTeamSerializerResponse`, `_TeamSerializerResponseOptional`, the team SCIM responses - `src/sentry/users/api/serializers/user.py`: `UserSerializerResponse`, `UserSerializerResponseOptional`, `SerializedAvatarFields`, plus the nested email, identity and authenticator types These fix 72 entries in `tests/apidocs/response-coverage-baseline.txt`, and this PR prunes them all. None of these files have fields left in the baseline. **Where the wording comes from** - The serializer code, for example: - `hasAccess`: member, open membership, or an organization role with access to all teams - `emails` and `identities`: when they're included - `canReset2fa`: true only with exactly one active organization - `experiments`: always `{}` - Model help texts (`User.is_managed`, `User.is_suspended`, ...). - How the frontend uses `isRetired`: retired roles can't be assigned to more members. - `allowed` and `is_global` are marked as deprecated aliases. The serializer comments call them "backward compatibility". There are no type changes and no runtime changes. Apart from descriptions, the generated spec matches the published `openapi-derefed.json`. The only other difference is the timezone enum, which comes from the local tz database. **Testing** - `make build-api-docs`, then `python -m sentry.apidocs.response_coverage --prune`: 72 fixed, 0 new. - `pytest tests/apidocs/test_response_coverage.py tests/sentry/apidocs`: 127 passed. - mypy (pre-push) and prek pass on the changed files. Refs getsentry/toolkit#1853 <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A98eff8ed01bc8064aba01279b3ac82c3 --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/agent%3A98eff8ed01bc8064aba01279b3ac82c3/?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]>
BYK
added a commit
that referenced
this pull request
Nov 5, 2026
Next gap-fill after #129991 and #129993: add `ApiDescription` annotations to the organization member response types and prune the response-coverage baseline to match. **What changes** - `organization_member/response.py`: describes the fields of the member, member-with-teams, member-with-roles, SCIM member and member flags responses. The wording comes from the serializers and the existing docs. - `core/endpoints/team_members.py` and `core/endpoints/organization_member_team_details.py`: the `user` override in these responses needs its own description, because the ratchet keys it under `OrganizationMemberResponse.user`. - `tests/apidocs/response-coverage-baseline.txt`: removes the 43 entries this fixes. Only descriptions change. Types and runtime behavior stay the same, and comments that duplicated a new description are gone. **Left in the baseline** - `sso:invalid` and `member-limit:restricted` (member flags): the code sets them but doesn't say what they mean to API consumers. - `invite_link`: declared on the response type, but no serializer sets it. **Verification** - I ran `make build-api-docs` and then `python -m sentry.apidocs.response_coverage --prune`: 43 entries fixed, 0 new. - `tests/apidocs/test_response_coverage.py` and `tests/sentry/apidocs` pass (127 tests). - mypy (pre-push) and ruff pass on the changed files. - In the spec diff against prod, the only changes besides descriptions are ones already on master. The optional prod-vs-dev schema diff check is expected to fail, because descriptions change. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A98eff8ed01bc8064aba01279b3ac82c3 --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/agent%3A98eff8ed01bc8064aba01279b3ac82c3/?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.
First gap-fill PR for the response coverage ratchet (#129972). It adds
ApiDescriptionto the TypedDicts insrc/sentry/api/serializers/models/organization.pyand prunes 66 entries fromtests/apidocs/response-coverage-baseline.txt: 65 missing descriptions and 1 untyped field.These types back the organization details, list and summary responses (
OrganizationWithProjectsAndTeamsin the spec), trusted relays, onboarding tasks, and the status and links objects.Where the wording comes from
allowSuperuserAccessis the inverse of theprevent_superuser_accessflag.pendingAccessRequestscountsOrganizationAccessRequests for the organization's teams.isDynamicallySampledis true when the org or any project samples below 1.PUT /organizations/{org}/for settings that the endpoint also returns, such asopenMembership,attachmentsRole,storeCrashReportsand the data scrubbing options. I reworded "Specifytrueto …" as "Whether …".defaultSeerScannerAutomationanddefaultCodingAgentfollowset_default_project_seer_*andget_org_default_seer_automation_handoff.autoEnableCodeReviewanddefaultCodeReviewTriggersfollowRepository._handle_auto_enable_code_review, which only applies to GitHub.OrganizationStatus.TASK_CHOICESandSTATUS_CHOICES.createdandlastModifiedfollow the update logic inorganization_details.py.Typing
rolechanges fromAnytostr. It's set fromaccess.roleonly when that isn'tNone, so the spec now saystype: string. Serialized output doesn't change.Left in the baseline
The code doesn't make these clear, so I didn't guess:
aggregatedDataConsent: it's set from the create-organization request, but nothing in sentry says what the consent covers.planSampleRateanddesiredSampleRate: they come from the blended rate or the target sample rate, depending on the sampling mode, and the names don't settle what a client should read them as.untypedonboarding taskdata: its shape depends on the task.untypedextraOptions{}: the type is clear (traces.spansExtractionDate: int,traces.checkSpanExtractionDate: bool), but the Sentry UI no longer reads either option, so I couldn't describe the nested fields.Testing
make build-api-docs,--prunereports 66 fixed and 0 new. Apart from descriptions, the derefed spec's only change isrolegainingtype: string.tests/apidocs/test_response_coverage.pyandtests/sentry/apidocspass.Annotatedmetadata and narrows one type hint, so nothing changes at runtime.via @BYK.
--
View Session in Sentry