Skip to content

feat(aci): Update API to allow filter monitors by assignee #95501

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

Merged
merged 5 commits into from
Jul 23, 2025

Conversation

leedongwei
Copy link
Member

@leedongwei leedongwei commented Jul 14, 2025

Allows filtering with assignee: /api/0/organizations/sentry/detectors/?query=assignee%3A{me|my_teams|none|team_slug|user_email}&...

@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Jul 14, 2025
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Copy link

codecov bot commented Jul 14, 2025

Codecov Report

Attention: Patch coverage is 99.23077% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ow_engine/endpoints/organization_detector_index.py 96.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #95501       +/-   ##
===========================================
+ Coverage   36.17%   76.38%   +40.21%     
===========================================
  Files        9960    10604      +644     
  Lines      557832   612180    +54348     
  Branches    23990    23990               
===========================================
+ Hits       201783   467601   +265818     
+ Misses     355640   142647   -212993     
- Partials      409     1932     +1523     

@leedongwei leedongwei marked this pull request as ready for review July 15, 2025 20:57
@leedongwei leedongwei requested a review from a team as a code owner July 15, 2025 20:57
cursor[bot]

This comment was marked as outdated.

const query = typeof location.query.query === 'string' ? location.query.query : '';

const filterKeys: TagCollection = Object.fromEntries(
Object.keys(DETECTOR_FILTER_KEYS).map(key => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO we should convert the constant DETECTOR_FILTER_KEYS into a hook useDetectorFilterKeys() so that we can use the useAssignedSearchValues() hook inside of it. That way all the logic stays together

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in #95930

cursor[bot]

This comment was marked as outdated.

elif actor is None:
assignee_query |= Q(owner_team_id__isnull=True, owner_user_id__isnull=True)
else:
# Unknown actor type, return a query that matches nothing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to raise here or otherwise report an error if there are types coming back from convert_actor_or_none_value that we don't support.
I think officially the right thing is assert_never.

status_code=400,
)
assert "owner" in response.data
def setUp(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for us to have a test that actually filters by assignee?

@leedongwei leedongwei changed the title feat(aci): Allow user to filter monitors by assignee feat(aci): Update API to allow filter monitors by assignee Jul 18, 2025
cursor[bot]

This comment was marked as outdated.

)
assignee_q = convert_assignee_values(values, projects, request.user)

if filter.operator == "!=":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: is '!=' defined as a literal anywhere? just a little nervous about 'magic' strings.

Copy link
Member Author

@leedongwei leedongwei Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not. It's a repeated pattern in the codebase seen in other parts of the product too.

cursor[bot]

This comment was marked as outdated.

@leedongwei leedongwei removed the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 22, 2025
cursor[bot]

This comment was marked as outdated.

@leedongwei leedongwei merged commit 84a1b56 into master Jul 23, 2025
65 checks passed
@leedongwei leedongwei deleted the dlee/aci-426 branch July 23, 2025 22:24
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.

4 participants