Skip to content

ref: Replace SENTRY_DEFAULT_ORGANIZATION_ID with SUPERUSER_ORG_ID - #107774

Merged
michelletran-sentry merged 1 commit into
masterfrom
ref/consolidate-superuser-org-id
Feb 10, 2026
Merged

michelletran-sentry merged 1 commit into
masterfrom
ref/consolidate-superuser-org-id

Conversation

@michelletran-sentry

Copy link
Copy Markdown
Contributor

@markstory informed me that there is already a way to specify the org used for superuser/staff. So I'm going to remove the custom setting that I added and use that other setting instead.

Consolidate two duplicate constants that reference the same organization ID. SENTRY_DEFAULT_ORGANIZATION_ID was hardcoded to 1 in server.py, while SUPERUSER_ORG_ID already exists in superuser.py for the same purpose.

This change:

  • Removes SENTRY_DEFAULT_ORGANIZATION_ID from conf/server.py
  • Updates SCIM member deletion to use settings.SUPERUSER_ORG_ID
  • Updates user elevation check to use settings.SUPERUSER_ORG_ID
  • Updates test fixtures to override SUPERUSER_ORG_ID setting

No behavior change - both constants referenced organization 1 for privilege management in SaaS mode.

@michelletran-sentry
michelletran-sentry requested review from a team and markstory February 6, 2026 16:00
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 6, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Consolidate two duplicate constants that reference the same organization
ID. SENTRY_DEFAULT_ORGANIZATION_ID was hardcoded to 1 in server.py,
while SUPERUSER_ORG_ID already exists in superuser.py for the same
purpose.

Changes:
- Remove SENTRY_DEFAULT_ORGANIZATION_ID from conf/server.py
- Add type annotation SUPERUSER_ORG_ID: int | None = None in server.py
- Update SCIM member deletion to use settings.SUPERUSER_ORG_ID
- Update user_can_elevate() to use settings.SUPERUSER_ORG_ID with null check
- Update test fixtures to override SUPERUSER_ORG_ID setting
- Add test for user_can_elevate() returning False when SUPERUSER_ORG_ID is None
- Add test for SCIM deletion preserving privileges when SUPERUSER_ORG_ID is None

The default value is now None instead of 1, which means privilege
management is disabled unless explicitly configured. Tests that rely
on the setting now explicitly set SUPERUSER_ORG_ID=1.

Co-Authored-By: Claude <noreply@anthropic.com>
@michelletran-sentry
michelletran-sentry merged commit 193a15f into master Feb 10, 2026
98 of 100 checks passed
@michelletran-sentry
michelletran-sentry deleted the ref/consolidate-superuser-org-id branch February 10, 2026 16:50
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 26, 2026

This branch was successfully deployed

1 active deployment
Preview — 8bf6c429 Deployed Feb 6, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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