Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/sentry/api/serializers/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,6 @@ def serialize( # type: ignore[override] # return value is a subset
(
"status",
"substatus",
"detector", # TODO - delete this once the UI has been updated
"monitor",
"bookmarked_by",
"assigned_to",
Expand Down
1 change: 0 additions & 1 deletion src/sentry/issues/issue_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ def convert_detector_value(
"device.class": convert_device_class_value,
"substatus": convert_substatus_value,
"issue.seer_actionability": convert_seer_actionability_value,
"detector": convert_detector_value, # TODO - delete this once the UI has been updated
"monitor": convert_detector_value,
}

Expand Down
3 changes: 0 additions & 3 deletions src/sentry/search/snuba/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,6 @@ def _get_queryset_conditions(
"regressed_in_release": QCallbackCondition(
functools.partial(regressed_in_release_filter, projects=projects)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Removing the detector search filter alias breaks UI components and user-saved searches that still rely on it, causing them to return empty results.
Severity: HIGH

Suggested Fix

Reinstate the detector search alias to maintain backward compatibility. Alternatively, update all locations that use the detector: keyword, including UI components like ongoingIssues.tsx, and create a data migration to update existing SavedSearches and AlertRules to use the new query format.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/search/snuba/backend.py#L588

Potential issue: The removal of the `detector` search filter alias will break existing
functionality that relies on it. Specifically, UI components like `ongoingIssues.tsx`
and `openPeriodIssues.tsx` contain hardcoded queries such as `is:unresolved
detector:${detector.id}`. With the alias removed, these queries will be interpreted as a
search for a tag named `detector`, which will not match any issues, causing these
components to display no results. This change also breaks existing user-created
`SavedSearches` and `AlertRules` that use the `detector:` keyword, causing them to fail
silently.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

User-saved searches will fail, but this is before launch so we should reduce issues there. We are safe from the UI failing by breaking this work into many PRs.

),
"detector": QCallbackCondition(
_make_detector_filter
), # TODO - delete this once the UI has been updated
"monitor": QCallbackCondition(_make_detector_filter),
"issue.category": QCallbackCondition(lambda categories: Q(type__in=categories)),
"issue.type": QCallbackCondition(lambda types: Q(type__in=types)),
Expand Down
1 change: 0 additions & 1 deletion src/sentry/seer/assisted_query/issues_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"issue": "issue_short_id",
"device.class": "device_class",
"timesSeen": "integer",
"detector": "dynamic_id", # TODO - delete this once the UI has been updated
"monitor": "dynamic_id",
}

Expand Down
18 changes: 9 additions & 9 deletions static/app/utils/fields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export enum FieldKey {
BOOKMARKS = 'bookmarks',
BROWSER_NAME = 'browser.name',
CULPRIT = 'culprit',
DETECTOR = 'detector',
DEVICE = 'device',
DEVICE_ARCH = 'device.arch',
DEVICE_BATTERY_LEVEL = 'device.battery_level',
Expand Down Expand Up @@ -87,6 +86,7 @@ export enum FieldKey {
LEVEL = 'level',
LOCATION = 'location',
MESSAGE = 'message',
MONITOR = 'monitor',
OS = 'os',
OS_BUILD = 'os.build',
OS_KERNEL_VERSION = 'os.kernel_version',
Expand Down Expand Up @@ -178,7 +178,6 @@ type ErrorFieldKey =
| FieldKey.ASSIGNED_OR_SUGGESTED
| FieldKey.BOOKMARKS
| FieldKey.CULPRIT
| FieldKey.DETECTOR
| FieldKey.ERROR_HANDLED
| FieldKey.ERROR_MECHANISM
| FieldKey.ERROR_TYPE
Expand All @@ -199,6 +198,7 @@ type ErrorFieldKey =
| FieldKey.LAST_SEEN
| FieldKey.LEVEL
| FieldKey.LOCATION
| FieldKey.MONITOR
| FieldKey.STACK_ABS_PATH
| FieldKey.STACK_COLNO
| FieldKey.STACK_FILENAME
Expand Down Expand Up @@ -1959,12 +1959,6 @@ const ERROR_FIELD_DEFINITION: Record<ErrorFieldKey, FieldDefinition> = {
kind: FieldKind.FIELD,
valueType: FieldValueType.STRING,
},
[FieldKey.DETECTOR]: {
desc: t('The detector that triggered the issue'),
kind: FieldKind.FIELD,
valueType: FieldValueType.STRING,
allowWildcard: false,
},
[FieldKey.ERROR_HANDLED]: {
desc: t('Determines handling status of the error'),
kind: FieldKind.FIELD,
Expand Down Expand Up @@ -2074,6 +2068,12 @@ const ERROR_FIELD_DEFINITION: Record<ErrorFieldKey, FieldDefinition> = {
kind: FieldKind.FIELD,
valueType: FieldValueType.STRING,
},
[FieldKey.MONITOR]: {
desc: t('The monitor that triggered the issue'),
kind: FieldKind.FIELD,
valueType: FieldValueType.STRING,
allowWildcard: false,
},
[FieldKey.STACK_ABS_PATH]: {
desc: t('Absolute path to the source file'),
kind: FieldKind.FIELD,
Expand Down Expand Up @@ -2747,7 +2747,6 @@ export const ISSUE_PROPERTY_FIELDS: FieldKey[] = [
FieldKey.ASSIGNED_OR_SUGGESTED,
FieldKey.ASSIGNED,
FieldKey.BOOKMARKS,
FieldKey.DETECTOR,
FieldKey.FIRST_RELEASE,
FieldKey.FIRST_SEEN,
FieldKey.HAS,
Expand All @@ -2759,6 +2758,7 @@ export const ISSUE_PROPERTY_FIELDS: FieldKey[] = [
FieldKey.ISSUE_TYPE,
FieldKey.ISSUE,
FieldKey.LAST_SEEN,
FieldKey.MONITOR,
FieldKey.RELEASE_STAGE,
FieldKey.TIMES_SEEN,
];
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/issueList/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const DISCOVER_EXCLUSION_FIELDS: string[] = [
'issue.type',
'issue.seer_actionability',
'issue.seer_last_run',
'detector',
'monitor',
];

export const FOR_REVIEW_QUERIES: string[] = [Query.FOR_REVIEW];
Expand Down
41 changes: 0 additions & 41 deletions tests/sentry/issues/endpoints/test_organization_group_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2517,47 +2517,6 @@ def test_query_status_and_substatus_nonoverlapping(self) -> None:
== []
)

# TODO - Delete this test once the UI has been updated
def test_query_detector_filter(self) -> None:
event = self.store_event(
data={"timestamp": before_now(seconds=500).isoformat(), "fingerprint": ["group-1"]},
project_id=self.project.id,
)
group = event.group

event2 = self.store_event(
data={"timestamp": before_now(seconds=400).isoformat(), "fingerprint": ["group-2"]},
project_id=self.project.id,
)
assert event2.group.id != group.id

detector_id = 12345 # intentionally multi-digit
detector = self.create_detector(
id=detector_id,
name=f"Test Detector {detector_id}",
project=self.project,
type="error",
)

self.create_detector_group(
detector=detector,
group=group,
)

self.login_as(user=self.user)

# Query for the specific detector ID
response = self.get_response(sort_by="date", query=f"detector:{detector_id}")
assert response.status_code == 200

# Should return only the group associated with the detector
assert len(response.data) == 1
assert int(response.data[0]["id"]) == group.id

response_empty = self.get_response(sort_by="date", query="detector:99999")
assert response_empty.status_code == 200
assert len(response_empty.data) == 0

def test_query_monitor_filter(self) -> None:
event = self.store_event(
data={"timestamp": before_now(seconds=500).isoformat(), "fingerprint": ["group-1"]},
Expand Down
Loading