Skip to content

feat(supergroups): Add status filter to supergroups by-group endpoint#112216

Merged
scttcper merged 1 commit intomasterfrom
scttcper/feat-supergroup-by-group-endpoint
Apr 6, 2026
Merged

feat(supergroups): Add status filter to supergroups by-group endpoint#112216
scttcper merged 1 commit intomasterfrom
scttcper/feat-supergroup-by-group-endpoint

Conversation

@scttcper
Copy link
Copy Markdown
Member

@scttcper scttcper commented Apr 3, 2026

Allow filtering groups by status (unresolved, resolved, etc.) via a query parameter so the frontend can request supergroup assignments for only the relevant subset of issues.

fixes https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists

Allow filtering groups by status (unresolved, resolved, etc.) via a
query parameter so the frontend can request supergroup assignments
for only the relevant subset of issues.
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 3, 2026
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 3, 2026

@scttcper scttcper marked this pull request as ready for review April 3, 2026 21:22
@scttcper scttcper requested a review from a team as a code owner April 3, 2026 21:22
Comment on lines +65 to +70
if status_param not in STATUS_QUERY_CHOICES:
return Response(
{"detail": "Invalid status parameter"},
status=status_codes.HTTP_400_BAD_REQUEST,
)
group_qs = group_qs.filter(status=STATUS_QUERY_CHOICES[status_param])
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.

Bug: The endpoint incorrectly filters for status="archived" by only checking status=IGNORED and not the required substatus=UNTIL_ESCALATING, returning all ignored groups instead of just archived ones.
Severity: MEDIUM

Suggested Fix

When the status parameter is "archived", the query should be modified to filter on both status=GroupStatus.IGNORED and substatus=GroupSubStatus.UNTIL_ESCALATING. This will correctly isolate only the groups that are truly archived.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
src/sentry/seer/supergroups/endpoints/organization_supergroups_by_group.py#L65-L70

Potential issue: The endpoint accepts `status="archived"` as a valid parameter because
it exists in `STATUS_QUERY_CHOICES`. However, the implementation only filters by
`Group.status` (`GroupStatus.IGNORED`), without also filtering by `Group.substatus`
(`GroupSubStatus.UNTIL_ESCALATING`). In Sentry's data model, an "archived" group must
satisfy both conditions. As a result, if a client calls this endpoint with
`status="archived"`, it will incorrectly receive all "ignored" groups (e.g., permanently
ignored) instead of only the "archived" (until escalating) ones, leading to incorrect
data being displayed.

Did we get this right? 👍 / 👎 to inform future reviews.

@scttcper scttcper merged commit da920f8 into master Apr 6, 2026
68 checks passed
@scttcper scttcper deleted the scttcper/feat-supergroup-by-group-endpoint branch April 6, 2026 16:29
scttcper added a commit that referenced this pull request Apr 7, 2026
Pass `status=unresolved` to the supergroups by-group endpoint so the
backend only returns group_ids for unresolved issues. Also skip
supergroups with only 1 issue in the frontend lookup so they don't show
up in the list.

Depends on #112216

fixes
https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists
scttcper added a commit that referenced this pull request Apr 7, 2026
The status filter from #112216 was pre-filtering group IDs sent to Seer,
but Seer returns all group_ids per supergroup regardless of what was
requested - so the response still contained resolved groups. Moved
filtering to the response side instead.

Also fixes the response key from `"supergroups"` to `"data"` to match
the actual Seer response model (`GetSupergroupsByGroupIdsResponse`). The
old code was referencing the wrong key so the filtering was silently a
no-op.

fixes
https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…#112216)

Allow filtering groups by status (unresolved, resolved, etc.) via a
query parameter so the frontend can request supergroup assignments for
only the relevant subset of issues.

fixes
https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
Pass `status=unresolved` to the supergroups by-group endpoint so the
backend only returns group_ids for unresolved issues. Also skip
supergroups with only 1 issue in the frontend lookup so they don't show
up in the list.

Depends on #112216

fixes
https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
The status filter from #112216 was pre-filtering group IDs sent to Seer,
but Seer returns all group_ids per supergroup regardless of what was
requested - so the response still contained resolved groups. Moved
filtering to the response side instead.

Also fixes the response key from `"supergroups"` to `"data"` to match
the actual Seer response model (`GetSupergroupsByGroupIdsResponse`). The
old code was referencing the wrong key so the filtering was silently a
no-op.

fixes
https://linear.app/getsentry/issue/ID-1440/hide-resolved-issues-from-counts-and-lists

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants