Skip to content

feat(auth): Add mocked service account APIs - #127588

Open
gricha wants to merge 9 commits into
masterfrom
feat/service-account-api-mocks
Open

gricha wants to merge 9 commits into
masterfrom
feat/service-account-api-mocks

Conversation

@gricha

@gricha gricha commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Mocked service account APIs behind organizations:service-accounts. They return canned, fully typed responses and persist nothing, so Seer can build against the contract while the real implementation lands behind it.

  • Management (control silo): GET/POST /organizations/{org}/service-accounts/ and GET/PUT/DELETE .../{id}/. Reads need org:read, writes need org:admin, and you can only grant scopes you hold.
  • Viewer context (cell silo, Seer only): POST .../{id}/viewer-context/. This is the service account counterpart of agent token minting. Seer sends its org-only ViewerContext and gets back {viewerContext, expiresAt, scopes}. It lives in the cell because Seer only reaches its region's Sentry. Until the service account actor exists, it returns Seer's own ViewerContext.

owner is a placeholder until the owning team has a tag.

Design: Service accounts, build order.

Depends on #127716 (control silo URL patterns, frontend), which lands first.

Add the service account management endpoints and the Seer-only viewer context endpoint behind organizations:service-accounts. They validate input and return canned data with the final response shape so Seer can integrate against the contract while the real implementation is built.
@gricha
gricha requested a review from trevor-e October 15, 2026 18:18
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2026
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 15, 2026
Split create and update request serializers so updates are optional in the schema, type the validated request data, and return real datetimes so the spec carries date-time formats.
Management endpoints live in the control silo with the service accounts. The Seer-only viewer context endpoint stays in the cell, since Seer only reaches its region's Sentry, and moves to its own module. Its response now mirrors agent token minting by including scopes, and OIDC scopes are no longer grantable.
@gricha
gricha marked this pull request as ready for review October 15, 2026 21:13
@gricha
gricha requested review from a team as code owners October 15, 2026 21:13
Send the service account management routes to control in the API gateway and list them as control silo URLs. The Seer-only viewer context route stays on the cell.
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

AIML-3687

@github-actions

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 83f1434 in this run:

tests/sentry/management/commands/test_generate_controlsilo_urls.py::TestGenerateControlsiloUrls::test_no_missing_urls — log
[gw0] linux -- Python 3.13.15 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/management/commands/test_generate_controlsilo_urls.py:74: in test_no_missing_urls
    assert line in current_state, msg
E   AssertionError: 
E                 New control silo URL patterns detected!
E     
E                 The pattern:   new RegExp('^api/0/organizations/[^/]+/service-accounts/$'),
E     
E                 Does not exist in the current pattern inventory. You should regenerate
E                 the pattern inventory with:
E     
E                 cd ../getsentry
E                 getsentry django generate_controlsilo_urls --format=js --output=../sentry/static/app/data/controlsiloUrlPatterns.ts
E     
E                 This command needs to be run in a getsentry environment
E                 in order to not lose patterns that are important for sentry.io
E                 
E   assert "  new RegExp('^api/0/organizations/[^/]+/service-accounts/$')," in "// This is generated code.\n// To update it run `getsentry django generate_controlsilo_urls --format=js --output=/pat...gExp('^extensions/discord/link-identity/[^/]+/$'),\n  new RegExp('^extensions/discord/unlink-identity/[^/]+/$'),\n];\n"

This branch was successfully deployed

1 active deployment
Preview — d7e97e01 Deployed Oct 15, 2026 by vercel[bot]
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 Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants