-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(search): Add team: filter for issues by project ownership #106501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Adds a new `team:` search filter that allows filtering issues by the team that owns the project. This addresses GitHub issue getsentry#45367. Usage: - `team:data-engineering` - Issues from projects owned by data-engineering - `team:#data-engineering` - Same (# prefix supported for consistency) - `!team:data-engineering` - Issues NOT from data-engineering's projects - `team:[team1,team2]` - Issues from projects owned by either team Changes: - Add team key mapping and convert_team_value() in issue_search.py - Add team_filter() function and condition in backend.py - Add 'team' to NO_CONVERSION_FIELDS to skip Snuba conversion - Add comprehensive tests for team filter functionality Security: - Filter teams through projectteam relationship to prevent IDOR - Users can only filter by teams associated with their searched projects Co-Authored-By: Claude Opus 4.5 <[email protected]>
5aba036 to
81d8ffc
Compare
|
bugbot review |
|
@sentry review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
|
Is there anything else I have to do in the PR process here? (I can't find any docs). Or is this just waiting for a maintainer to take a look? |
you're all good, i'll take a look. |
|
this likely would need to take into account the org open membership settings |
Summary
Adds a new
team:search filter that allows filtering issues by the team that owns the project. This addresses #45367.Usage:
team:data-engineering- Issues from projects owned by data-engineeringteam:#data-engineering- Same (# prefix supported for consistency with other team references)!team:data-engineering- Issues NOT from data-engineering's projectsteam:[team1,team2]- Issues from projects owned by either teamChanges
src/sentry/issues/issue_search.py:teamkey mappingconvert_team_value()converter that validates teams throughprojectteamrelationship (prevents IDOR by ensuring users can only filter by teams associated with their searched projects)src/sentry/search/snuba/backend.py:team_filter()functionteamcondition to queryset buildertests/snuba/search/test_backend.py:test_team_filter- Basic filtering with/without # prefixtest_team_filter_negation-!team:exclusiontest_team_filter_invalid_team- Error handling for non-existent teamstest_team_filter_multiple_teams-team:[t1,t2]syntaxtest_team_filter_team_not_in_searched_projects- Security test for IDOR preventionTest plan
#prefix works for consistency with other team references!team:) excludes issues from team's projectsInvalidSearchQuery🤖 Generated with Claude Code