Skip to content

perf(auth): Add RPCs for active organization resource IDs - #124848

Draft
shashjar wants to merge 1 commit into
masterfrom
shashjar/iswf-3361-active-resource-ids
Draft

shashjar wants to merge 1 commit into
masterfrom
shashjar/iswf-3361-active-resource-ids

Conversation

@shashjar

@shashjar shashjar commented Sep 17, 2026

Copy link
Copy Markdown
Member

Add organization-routed RPCs that return only active project or team IDs. These provide the control silo with the resource sets needed for privileged access checks without loading and serializing every Project/Team model. Project IDs include projects without teams; both queries remain scoped to one organization and exclude inactive resources.

Deploy these RPCs to every cell before deploying the access-check consumer in PR 2. This PR has no model or schema changes.

Regression coverage exercises all silo modes, organization isolation, inactive resources, empty organizations, and RPC serialization.

Part 1 of 4 for ISWF-3361. Review/deploy order: 1: ID RPCs2: access checks3: broadcasts4: control defaults.

@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

ISWF-3361

@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1177_organization_resource_status_indexes.py

for 1177_organization_resource_status_indexes in sentry

--
-- Create index project_org_status_idx on field(s) organization, status of model project
--
CREATE INDEX CONCURRENTLY "project_org_status_idx" ON "sentry_project" ("organization_id", "status");
--
-- Create index team_org_status_idx on field(s) organization, status of model team
--
CREATE INDEX CONCURRENTLY "team_org_status_idx" ON "sentry_team" ("organization_id", "status");

Expose organization-scoped active project and team IDs without hydrating full resource models. Include teamless projects and preserve active-status filtering across silo modes.

Refs ISWF-3361
@shashjar
shashjar force-pushed the shashjar/iswf-3361-active-resource-ids branch from 0a3d8bd to ce90fbd Compare September 17, 2026 23:02
@shashjar

Copy link
Copy Markdown
Member Author

We may want a separate follow-up migration adding (organization_id, status) indexes to sentry_project and sentry_team for the active-ID queries introduced here.

Existing organization-leading indexes can support these lookups, and we have not established the incremental benefit of the composite indexes. Check representative query plans and timings first; if the benefit warrants it, add the indexes concurrently in a post-deployment migration.

The index additions and migration have been removed from this PR. They are not a prerequisite for the hydration fix.

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.

1 participant