Skip to content

ref(seer): use get_group_list helper in supergroups-by-group endpoint#116474

Merged
cvxluo merged 2 commits into
masterfrom
gio/refactor-group-access
May 29, 2026
Merged

ref(seer): use get_group_list helper in supergroups-by-group endpoint#116474
cvxluo merged 2 commits into
masterfrom
gio/refactor-group-access

Conversation

@giovanni-guidini
Copy link
Copy Markdown
Contributor

The OrganizationSupergroupsByGroupEndpoint was using inline Group.objects.filter calls to validate and filter group IDs. This refactors it to use the existing get_group_list helper from sentry.api.helpers.group_index, which is the canonical pattern for this kind of scoped group lookup (see api/helpers/group_index/update.py line 275 for the existing usage).

get_group_list previously lived in group_index/update.py — a large mutation-focused module with heavy dependencies. Since the function is a pure read with minimal dependencies (Group, Project, Sequence), it has been extracted into a new group_index/lookup.py. This avoids a circular-import risk (update.pyindex.py__init__.pyupdate.py) and gives the function a proper home as a first-class export of the package via __init__.__all__.

update.py now imports get_group_list from .lookup; no behaviour change for existing callers.

Test coverage for the endpoint has been expanded and @cell_silo_test has been added to the test class to match the endpoint's @cell_silo_endpoint decorator.

Refs AIML-2879

…point

Replace direct Group.objects.filter calls with the existing get_group_list
helper from sentry.api.helpers.group_index.update, which takes an
already-access-checked project list from self.get_projects(). This aligns
the endpoint with the canonical pattern used elsewhere in the codebase.

Also adds @cell_silo_test to the test class (matching the endpoint's
@cell_silo_endpoint) and expands coverage with a closed-membership org
scenario.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

AIML-2879

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 29, 2026
…port from __init__

get_group_list is a read-only lookup helper with no mutations — it doesn't
belong in the heavy update.py module. Moving it to a minimal lookup.py
avoids a circular-import risk (update.py ← index.py ← __init__.py ←
update.py) and gives the function a permanent, officially-exported home via
group_index.__init__.__all__.

Callers should now import from sentry.api.helpers.group_index directly.
@giovanni-guidini giovanni-guidini force-pushed the gio/refactor-group-access branch from 8e88076 to c8119c2 Compare May 29, 2026 13:53
@giovanni-guidini giovanni-guidini requested a review from cvxluo May 29, 2026 13:55
@giovanni-guidini giovanni-guidini marked this pull request as ready for review May 29, 2026 13:56
@giovanni-guidini giovanni-guidini requested review from a team as code owners May 29, 2026 13:56
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c8119c2. Configure here.

@cvxluo cvxluo merged commit 1791e4f into master May 29, 2026
64 checks passed
@cvxluo cvxluo deleted the gio/refactor-group-access branch May 29, 2026 16:54
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