getsentry / getsentry/sentry

release.version multi-select filter returns 400 due to unsupported IN operator in semver pipeline

Open
#113,135 2 comments 0 reactions 0 assignees View on GitHub
Waiting for: Product Owner
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 10m
Merged PRs (30d)
635

Description

Selecting multiple values for `release.version` in a dashboard widget filter produces a 400 "Invalid Query" response. A single `release.version` value works fine.

## Root cause

`release.version` uses the semver filter pipeline, which only supports operators that map to Django/semver semantics (`=`, `!=`, `>=`, etc.). When multiple values are selected, the query builder emits an `IN` operator, which is not handled by the semver converter:

```python
# src/sentry/search/events/filter.py (~line 467)
try:
operator = OPERATOR_TO_DJANGO[operator]
except KeyError:
raise InvalidSearchQuery("Invalid operation 'IN' for semantic version filter.")
```

By contrast, the plain `release` filter field supports multi-value selection via `release_filter_converter` in `src/sentry/search/events/datasets/filter_aliases.py`, which explicitly maps `=` → `IN` and resolves release strings before passing to the default filter converter.

## Reproduction

1. Open a dashboard widget with a `release.version` filter.
2. Select two or more release versions from the dropdown (operator: "is").
3. The widget query returns HTTP 400 "Invalid Query".

## Workaround

- Use the `release` filter field (full release string) instead of `release.version` when multiple versions need to be selected simultaneously.
- If `release.version` is required, restrict to one value at a time.

## Fix direction

Extend the `release.version` filter handler so that multi-value inputs are resolved to their corresponding release strings and forwarded as an `IN` clause (similar to how `release_filter_converter` works), rather than passing `IN` directly through the semver operator converter.

Action taken on behalf of Chris Stavitsky.

Contributor guide

Open the contributing guide

Research direction

Start in src/sentry/search/events/filter.py around line 467 and compare the semver filter handler with release_filter_converter in src/sentry/search/events/datasets/filter_aliases.py. Trace how multi-value release.version inputs are resolved and confirm that selecting multiple versions no longer returns HTTP 400 while single-value filtering continues to work.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.