Skip to content

ref(integrations): Build create-issue config for service accounts - #129639

Merged
gricha merged 1 commit into
ref/sa-no-member-managementfrom
ref/sa-integration-issue-config
Nov 4, 2026
Merged

gricha merged 1 commit into
ref/sa-no-member-managementfrom
ref/sa-integration-issue-config

Conversation

@gricha

@gricha gricha commented Nov 3, 2026

Copy link
Copy Markdown
Member

Service accounts can load the create-issue form for integrations, so a Seer agent can file a GitHub or Jira issue. Drops group_integration_details.py, the last file on the request.user allowlist (1 → 0).

get_create_issue_config() and its overrides (GitHub, GitLab, Bitbucket, VSTS, Jira, Jira Server) take the caller as a RequestPrincipal; the endpoint keeps passing request.user. Only two places need a user, and both skip their personal part when there isn't one:

  • Jira's saved per-user defaults (get_defaults): a service account gets the project defaults. Before, it failed with user-required because its ServiceAccountId went into the user-options lookup.
  • AI-generated title and description: sent with no user id (run_oneshot already accepts None).

Users see no change. getsentry doesn't override get_create_issue_config.

test_service_account_gets_project_defaults_only fails without this change:

E   sentry.api.exceptions.UserRequired: {'detail': {'code': 'user-required', 'message': 'This action requires a user.', 'extra': {}}}

With it, the integration issue, group-integration-details, GitHub and Jira suites pass: 224 passed.

@gricha
gricha requested a review from a team as a code owner November 3, 2026 01:49
@gricha
gricha added this pull request to stack #129572 November 3, 2026 01:49
@gricha
gricha requested review from a team as code owners November 3, 2026 01:49
@gricha
gricha requested review from cvxluo and skaasten November 3, 2026 01:49
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 3, 2026
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch 3 times, most recently from a03a81f to df0b19f Compare November 3, 2026 04:03
@sentry

sentry Bot commented Nov 3, 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

@gricha
gricha force-pushed the ref/sa-integration-issue-config branch from df0b19f to 1a6d709 Compare November 3, 2026 04:41
@gricha
gricha removed this pull request from stack #129572 November 3, 2026 06:52
@gricha
gricha added this pull request to stack #129650 November 3, 2026 06:52
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch from 1a6d709 to 709e3b5 Compare November 3, 2026 19:53
@gricha
gricha removed this pull request from stack #129650 November 3, 2026 19:53
@gricha
gricha added this pull request to stack #129747 November 3, 2026 19:54
@gricha
gricha requested review from a team as code owners November 3, 2026 20:02
@gricha
gricha requested review from a team as code owners November 3, 2026 20:02
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch from 709e3b5 to b07f15a Compare November 3, 2026 20:03
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch from b07f15a to 2792375 Compare November 3, 2026 20:09
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch 4 times, most recently from 748e833 to cde5a84 Compare November 4, 2026 00:44
get_create_issue_config() takes the caller as a RequestPrincipal. The
two places that need a user skip their personal part when there isn't
one: Jira's saved per-user defaults (a service account gets the project
defaults) and the AI-generated title and description (no user id sent).
A service account calling Jira's create config used to fail with
user-required; users see no change.

group_integration_details.py was the last file on the request.user
allowlist.
@gricha
gricha force-pushed the ref/sa-integration-issue-config branch from cde5a84 to 5ec3366 Compare November 4, 2026 01:15
@gricha
gricha merged commit f32ec80 into master Nov 4, 2026
78 checks passed
@gricha
gricha deleted the ref/sa-integration-issue-config branch November 4, 2026 03:39
gricha added a commit that referenced this pull request Nov 4, 2026
… and client config (#129630)

Four one-off `request.user` reads, which drops their files from the
allowlist (10 → 6). What's left is member management (#129638), data
export (#129637) and `group_integration_details.py` (#129639); #129640
then deletes the allowlist.

- **Agent tokens:** `resolve_minting_principal()` rejects any caller
with no user (`has_user`), not just `AnonymousUser`. A service account
used to resolve to a *user* principal carrying its `ServiceAccountId`
and fail later; it now gets the same "Minting requires a user principal"
403 as an anonymous caller. The new assertion fails without this change:
  ```
E AssertionError: assert AgentPrincipal(type=<AgentPrincipalType.USER:
'user'>, id=ServiceAccountId(service_account_id=1)) is
<MintingPrincipalRejection.UNSUPPORTED: 'unsupported'>
  ```
- **Release serialization** takes a `RequestPrincipal`. It only forwards
the caller to `serialize()` and `serialize_generic_user()`, which
already take one, so this is type-only.
- **Notebooks** read the caller through `acting_user_id()`; same value
for users and token callers.
- **Client config** is built only from Django views, so its request is
typed as `HttpRequest`. Type-only.
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