Repository navigation
ref(auth): Move service account endpoints into sentry.service_accounts - #128257
Closed
sentry-junior[bot] wants to merge 1 commit into
Closed
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
Service accounts are getting their own Django app (#128049), so the mocked management and viewer-context endpoints and their tests move there too. Only module paths change: routes, URL names, silo routing and responses are untouched. Refs ENG-8829 Co-Authored-By: shaun.kaasten <[email protected]>
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 20, 2026
…ounts) Co-Authored-By: shaun.kaasten <[email protected]>
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 20, 2026
…ounts) Co-Authored-By: shaun.kaasten <[email protected]>
skaasten
added a commit
that referenced
this pull request
Oct 21, 2026
) This adds a new `sentry.service_accounts` Django app with the two control-silo tables that will back the mocked service account APIs from #127588. Nothing reads or writes them yet. The cell lookup and real endpoints come in follow-up PRs, and #128257 moves the mocked endpoints into the same app. - `ServiceAccount` holds the org, the name (unique per org, at most 64 characters), `scope_list`, `is_active` and `created_by`. Scopes are validated against `SENTRY_SCOPES` minus the OIDC scopes. - `ServiceAccountProject` holds the `projectIds` the API accepts. `project_id` is a `HybridCloudForeignKey`, so the tombstone cascade removes a link after its project is deleted. The app gets its own migration history (`service_accounts/0001_initial`) and app-prefixed tables (`service_accounts_serviceaccount`, `service_accounts_serviceaccountproject`), so it no longer competes for `sentry` migration numbers. Cells won't keep a replica table. They'll read accounts through a cached RPC to control, the same way they read users, and a `SERVICE_ACCOUNT_UPDATE` outbox (organization scope) will clear that cache. Both models are `ControlOutboxProducingModel`s and write that outbox for the account: `ServiceAccount` on every change, and `ServiceAccountProject` when links are added or removed. That includes the manager's bulk methods and the per-instance tombstone cascade. Nothing consumes the outbox yet; cache clearing lands with the RPC. Review notes: - Both models use `RelocationScope.Organization`. They're in the exhaustive backup fixtures, whose round-trip tests also check that `project_id` is remapped to the imported project instead of being copied. - `User.merge_to` now moves `created_by`. The user-merge coverage test requires this for every org-scoped model that references `User`. - The migration only creates new tables. Refs ENG-8829 <!-- junior-request-attribution:start --> via **shaun.kaasten**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0BAS2BU2TC%3A1792416182.597029 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AD0BAS2BU2TC%3A1792416182.597029) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0BAS2BU2TC%3A1792416182.597029/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: shaun.kaasten <[email protected]>
markstory
approved these changes
Oct 26, 2026
Contributor
|
These were already moved as part of #128239 - sorry for not closing earlier @markstory 🙏 |
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.
Following review on #128049, service accounts are getting their own Django app,
sentry.service_accounts, so models, endpoints and serializers live in one tree. This PR moves the mocked endpoints from #127588 and their tests into it:src/sentry/api/endpoints/organization_service_accounts.py→src/sentry/service_accounts/endpoints/organization_service_accounts.pysrc/sentry/api/endpoints/organization_service_account_viewer_context.py→src/sentry/service_accounts/endpoints/organization_service_account_viewer_context.pytests/sentry/service_accounts/endpoints/.Only module paths change. Routes, URL names, silo routing (
controlsiloUrlPatterns, the apigw proxy rules), the feature flag and responses are all untouched, so the contract Seer builds against doesn't change.api/urls.pyand the viewer-context endpoint's import oforganization_service_accountsare the only edits.This PR only adds a plain package. #128049 registers the app and adds the models and migration. Both PRs add an identical empty
src/sentry/service_accounts/__init__.py, so they merge in either order.Heads up: #128080 and #128111 edit
organization_service_account_viewer_context.pyand its test, so whichever lands second needs a rebase onto the new path.Refs ENG-8829
via shaun.kaasten.
--
View Junior Session [Sentry]