Skip to content

ref(typing): Let serialize() take a service account - #129412

Merged
gricha merged 1 commit into
ref/principal-helper-examplesfrom
ref/typing-serialize-principal
Nov 2, 2026
Merged

gricha merged 1 commit into
ref/principal-helper-examplesfrom
ref/typing-serialize-principal

Conversation

@gricha

@gricha gricha commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Endpoints pass request.user to serialize(), and it can be a service account. Serializers already handle that at runtime, but the signature said User | RpcUser | AnonymousUser | None. It now takes a RequestPrincipal | None.

Type-only. Without it, #129402's mypy check would flag 160 files that only pass request.user to serialize().

Serializer methods (get_attrs/serialize) still declare the old user type; serialize() hands them an untyped serializer, so nothing here hides an error. Widening the serializer tree itself is a later step.

@gricha
gricha added this pull request to stack #129364 October 31, 2026 01:30
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 31, 2026
@gricha
gricha removed this pull request from stack #129364 November 1, 2026 04:24
@gricha
gricha changed the base branch from ref/mypy-request-user-principal to ref/principal-helper-examples November 1, 2026 04:24
@gricha
gricha force-pushed the ref/typing-serialize-principal branch from f00e055 to 6f0e130 Compare November 1, 2026 04:24
@gricha
gricha added this pull request to stack #129440 November 1, 2026 04:24
@gricha
gricha force-pushed the ref/typing-serialize-principal branch from 6f0e130 to ebde3ee Compare November 2, 2026 19:55
@gricha
gricha marked this pull request as ready for review November 2, 2026 20:04
@gricha
gricha requested a review from a team as a code owner November 2, 2026 20:04
@gricha
gricha requested review from azulus, cvxluo and skaasten November 2, 2026 20:25
@gricha
gricha removed this pull request from stack #129440 November 2, 2026 21:45
@gricha
gricha added this pull request to stack #129572 November 2, 2026 21:45
@gricha
gricha force-pushed the ref/typing-serialize-principal branch from ebde3ee to 587525d Compare November 2, 2026 22:08
@gricha
gricha force-pushed the ref/typing-serialize-principal branch 2 times, most recently from ce18955 to 416a8a7 Compare November 2, 2026 23:08
@sentry

sentry Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 780 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

request.user can be a ServiceAccountPrincipal, and endpoints already pass it to serialize(), whose serializers handle it. The signature now says so. Type-only.
@gricha
gricha force-pushed the ref/typing-serialize-principal branch from 416a8a7 to 3290059 Compare November 2, 2026 23:18
@gricha
gricha merged commit d485291 into master Nov 2, 2026
125 of 175 checks passed
@gricha
gricha deleted the ref/typing-serialize-principal branch November 2, 2026 23:31
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.

2 participants