Skip to content

fix(workflow_engine): Match no detectors for my_teams when the caller has no teams - #129608

Merged
gricha merged 1 commit into
fix/sentry-app-no-application-scopesfrom
fix/detector-my-teams-no-teams
Nov 4, 2026
Merged

gricha merged 1 commit into
fix/sentry-app-no-application-scopesfrom
fix/detector-my-teams-no-teams

Conversation

@gricha

@gricha gricha commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

assignee:my_teams on the detector list returned every detector when the caller is on no teams.

convert_assignee_values ORs one Q per resolved actor onto an empty Q(). my_teams resolves to no actors for a member with no teams, so the result stays Q(), and filter(Q()) matches every row. #129424 fixed the same thing for issue search; this does it for detectors. Negation is unchanged: exclude(Q(pk__in=[])) still keeps every row. The test checks !assignee:my_teams still returns all three detectors.

test_query_by_assignee_my_teams_without_teams fails without the fix, returning all 3 detectors (one owned by a team the caller isn't on, two unowned):

E   AssertionError: assert [{'id': '1', ...': None, ...}] == []
E     Left contains 3 more items, first extra item: {'id': '1', ..., 'name': 'Error Monitor', ...}
FAILED tests/sentry/workflow_engine/endpoints/test_organization_detector_index.py::OrganizationDetectorIndexGetTest::test_query_by_assignee_my_teams_without_teams

With it, the file passes: 102 passed, 7 subtests passed. An empty values list (not reachable from the endpoint) now matches nothing instead of everything; its unit test is updated.

@gricha
gricha requested a review from a team as a code owner November 2, 2026 23:42
@gricha
gricha added this pull request to stack #129572 November 2, 2026 23:42
@gricha
gricha requested review from azulus, cvxluo and skaasten November 2, 2026 23:42
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 2, 2026
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch from 32f6865 to 9a4a5b8 Compare November 3, 2026 00:27
@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 fix/detector-my-teams-no-teams branch from 9a4a5b8 to cffa64c Compare November 3, 2026 00:34
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch from cffa64c to 4dd60b4 Compare November 3, 2026 04:03
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch from 4dd60b4 to 042bfb6 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 fix/detector-my-teams-no-teams branch from 042bfb6 to ae51908 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:00
@gricha
gricha requested review from a team as code owners November 3, 2026 20:00
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch 2 times, most recently from 6ff27cd to 2da7f25 Compare November 3, 2026 20:09
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch 3 times, most recently from c065a3a to 6fe85ad Compare November 3, 2026 23:19
… has no teams

assignee:my_teams ORed nothing onto Q() for a caller on no teams, and
filter(Q()) matches every detector. Return Q(pk__in=[]) instead, as
#129424 did for issue search.
@gricha
gricha force-pushed the fix/detector-my-teams-no-teams branch from 6fe85ad to dc6e44d Compare November 4, 2026 00:44
@gricha
gricha merged commit a16d3b6 into master Nov 4, 2026
105 of 133 checks passed
@gricha
gricha deleted the fix/detector-my-teams-no-teams branch November 4, 2026 01:15
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