Skip to content

Commit

Permalink
feat(feedback): hide feedback issues by default if not filtered on (#…
Browse files Browse the repository at this point in the history
…59505)

Previously: #57528

Instead of trying to control the display of feedbacks, lets just hide
them by default unless they are filtered on.

Aspirationally, we'd like to eventually have our own feedbacks endpoint
that only displays feedbacks, and have feedbacks hidden from issues
search entirely, but I do not see a good way of doing this without it
being either extremely hacky, or a lot of work.
  • Loading branch information
JoshFerge authored Nov 7, 2023
1 parent 27fc5ab commit 678abe8
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/sentry/search/snuba/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def snuba_search(
if gc != GroupCategory.PROFILE.value
or features.has("organizations:issue-platform", organization, actor=actor)
}
# if we're not searching for feedbacks, then hide them by default
group_categories.discard(GroupCategory.FEEDBACK.value)

if not features.has("organizations:performance-issues-search", organization):
group_categories.discard(GroupCategory.PERFORMANCE.value)
Expand Down Expand Up @@ -1228,7 +1230,6 @@ def query(
actor: Optional[Any] = None,
aggregate_kwargs: Optional[PrioritySortWeights] = None,
) -> CursorResult[Group]:

if not validate_cdc_search_filters(search_filters):
raise InvalidQueryForExecutor("Search filters invalid for this query executor")

Expand Down
92 changes: 91 additions & 1 deletion tests/snuba/search/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sentry.exceptions import InvalidSearchQuery
from sentry.issues.grouptype import (
ErrorGroupType,
FeedbackGroup,
NoiseConfig,
PerformanceNPlusOneGroupType,
PerformanceRenderBlockingAssetSpanGroupType,
Expand Down Expand Up @@ -1965,7 +1966,6 @@ def test_regressed_in_release(self):
assert set(results) == {group_2}

def test_first_release(self):

# expect no groups within the results since there are no releases

results = self.make_query(search_filter_query="first_release:%s" % "fake")
Expand Down Expand Up @@ -3684,6 +3684,96 @@ def test_rejected_filters(self):
== []
)

def test_feedback_category_hidden_default(self):
with self.feature(
["organizations:issue-platform", FeedbackGroup.build_visible_feature_name()]
):
event_id_1 = uuid.uuid4().hex
_, group_info = process_event_and_issue_occurrence(
self.build_occurrence_data(
**{
"id": uuid.uuid4().hex,
"project_id": 1,
"event_id": event_id_1,
"fingerprint": ["c" * 32],
"issue_title": "User Feedback",
"subtitle": "it was bad",
"culprit": "api/123",
"resource_id": "1234",
"evidence_data": {"Test": 123},
"evidence_display": [
{"name": "hi", "value": "bye", "important": True},
{"name": "what", "value": "where", "important": False},
],
"type": FeedbackGroup.type_id,
"detection_time": datetime.now().timestamp(),
"level": "info",
}
),
{
"event_id": event_id_1,
"project_id": self.project.id,
"title": "some problem",
"platform": "python",
"tags": {"my_tag": "1"},
"timestamp": before_now(minutes=1).isoformat(),
"received": before_now(minutes=1).isoformat(),
},
)
results = self.make_query(
date_from=self.base_datetime,
date_to=self.base_datetime + timedelta(days=10),
)
assert set(results) == set()

def test_feedback_category_show_when_filtered_on(self):
with self.feature(
[
"organizations:issue-platform",
FeedbackGroup.build_visible_feature_name(),
FeedbackGroup.build_ingest_feature_name(),
]
):
event_id_1 = uuid.uuid4().hex
_, group_info = process_event_and_issue_occurrence(
self.build_occurrence_data(
**{
"id": uuid.uuid4().hex,
"project_id": 1,
"event_id": event_id_1,
"fingerprint": ["c" * 32],
"issue_title": "User Feedback",
"subtitle": "it was bad",
"culprit": "api/123",
"resource_id": "1234",
"evidence_data": {"Test": 123},
"evidence_display": [
{"name": "hi", "value": "bye", "important": True},
{"name": "what", "value": "where", "important": False},
],
"type": FeedbackGroup.type_id,
"detection_time": datetime.now().timestamp(),
"level": "info",
}
),
{
"event_id": event_id_1,
"project_id": self.project.id,
"title": "some problem",
"platform": "python",
"tags": {"my_tag": "1"},
"timestamp": before_now(minutes=1).isoformat(),
"received": before_now(minutes=1).isoformat(),
},
)
results = self.make_query(
search_filter_query="issue.category:feedback",
date_from=self.base_datetime,
date_to=self.base_datetime + timedelta(days=10),
)
assert group_info is not None
assert list(results) == [group_info.group]


class CdcEventsSnubaSearchTest(TestCase, SharedSnubaMixin):
@property
Expand Down

0 comments on commit 678abe8

Please sign in to comment.