Skip to content

feat(apidocs): Describe team, role and user response fields - #129993

Merged
BYK merged 1 commit into
masterfrom
feat/apidocs-describe-team-role-user-fields
Nov 4, 2026
Merged

BYK merged 1 commit into
masterfrom
feat/apidocs-describe-team-role-user-fields

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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

via @BYK.

--

View Session in Sentry

Add ApiDescription annotations to the team, role and user serializer
response TypedDicts and prune the 72 entries they fix from the response
coverage baseline. Wording comes from the serializer code, the model
help texts and how the frontend uses each field. Types and runtime
behavior are unchanged.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested a review from a team as a code owner November 4, 2026 23:05
@sentry-junior
sentry-junior Bot requested a review from a team as a code owner November 4, 2026 23:05
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 4, 2026
@BYK
BYK enabled auto-merge (squash) November 4, 2026 23:08
@BYK
BYK merged commit 27b7cb8 into master Nov 4, 2026
83 of 84 checks passed
@BYK
BYK deleted the feat/apidocs-describe-team-role-user-fields branch November 4, 2026 23:14
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant