getsentry / getsentry/sentry

OR queries in issue events filter return different results depending on operand order

Open
#105,307 3 comments 0 reactions 0 assignees View on GitHub
Bug Issues > Details Product Area: Issues
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 10m
Merged PRs (30d)
635

Description

### Environment

SaaS ([https://sentry.io/]())

### Steps to Reproduce

1. Navigate to an issue's events page (e.g., `/issues/{issue_id}/events/`)
2. In the "Filter events" search bar, enter a query with OR operator:
* Query A: `company_id:8368346339582562332 OR coid:123432453`
* Query B: `coid:123432453 OR company_id:8368346339582562332`
3. Compare the results

Note: In this case, events in the issue have a `company_id` tag but do NOT have a `coid` tag.

### Expected Result

Both queries should return the same results since they are logically equivalent (OR should be commutative/symmetric).

### Actual Result

Query A returns 2 events (the expected matching events from this issue)
Query B returns 735 events, including events from other issues

It seems like part of the OR expression is not being scoped to the current issue.

We suspect this might be related to how the issue filter is combined with the user query - possibly a precedence issue with AND/OR operators.

Image

Image

### Product Area

Issues

### Link

*No response*

### DSN

*No response*

### Version

*No response*

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior on an issue's events page using the two queries in the report and compare their results. Trace how the current-issue scope is combined with the user query, then verify that both operand orders return the same events and remain scoped to the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.