Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): serve suppressed reports on detail read paths (#64019)

Andrew Maguirea3c7c4d10160
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.py
index acd329f6713e..1351a99ae818 100644
--- a/products/signals/backend/test/test_signal_report_api.py
+++ b/products/signals/backend/test/test_signal_report_api.py
@@ -658,6 +658,66 @@ class TestSignalReportListAPI(APIBaseTest):
assert response.status_code == status.HTTP_200_OK
assert response.json()["source_products"] == []
+ # --- suppressed report reachability ---
+ #
+ # Suppressed (dismissed) reports stay out of the list by default, but the inbox's
+ # Dismissed tab needs to read them by ID (detail + evidence) and reopen them. Read
+ # paths (retrieve, signals, state) are reachable; mutating-by-ID paths (delete,
+ # reingest) deliberately are not, so they keep returning 404.
+
+ def test_retrieve_serves_suppressed_report(self):
+ report = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ response = self.client.get(f"/api/projects/{self.team.id}/signals/reports/{report.id}/")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["id"] == str(report.id)
+ assert response.json()["status"] == SignalReport.Status.SUPPRESSED
+
+ def test_signals_action_serves_suppressed_report(self):
+ report = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ with (
+ patch(
+ "products.signals.backend.views.fetch_source_products_for_reports",
+ return_value={str(report.id): ["zendesk"]},
+ ),
+ patch("products.signals.backend.views.fetch_signals_for_report_sync", return_value=[]),
+ ):
+ response = self.client.get(f"/api/projects/{self.team.id}/signals/reports/{report.id}/signals/")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["report"]["id"] == str(report.id)
+
+ def test_list_excludes_suppressed_by_default(self):
+ ready = self._create_report(status=SignalReport.Status.READY)
+ suppressed = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ response = self.client.get(self._list_url())
+
+ assert response.status_code == status.HTTP_200_OK
+ ids = {r["id"] for r in response.json()["results"]}
+ assert str(ready.id) in ids
+ assert str(suppressed.id) not in ids
+
+ def test_list_includes_suppressed_when_filtered(self):
+ suppressed = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ response = self.client.get(self._list_url(status="suppressed"))
+
+ assert response.status_code == status.HTTP_200_OK
+ ids = {r["id"] for r in response.json()["results"]}
+ assert str(suppressed.id) in ids
+
+ def test_reingest_suppressed_report_returns_404(self):
+ # reingest is a mutating-by-ID action, so a suppressed report stays unreachable
+ # and 404s before any workflow is started (mirrors the delete contract).
+ report = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ response = self.client.post(f"/api/projects/{self.team.id}/signals/reports/{report.id}/reingest/")
+
+ assert response.status_code == status.HTTP_404_NOT_FOUND
+
# --- legacy choice removal ---
def test_actionability_null_for_legacy_choice_artefact(self):
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index adcfdea4ce44..d51063476168 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -428,6 +428,14 @@ class SignalReportViewSet(
# so it is never a valid filter target.
_FILTERABLE_STATUSES = frozenset(SignalReport.Status.values) - {SignalReport.Status.DELETED}
+ # Actions allowed to resolve a suppressed report by ID even without an explicit
+ # `status` filter. These are the read/reopen paths the inbox's Dismissed tab needs:
+ # `state` reopens a dismissed report, `retrieve` loads its detail, and `signals`
+ # loads its evidence. Mutating-by-ID actions (delete, reingest) are deliberately
+ # NOT here, so a suppressed report stays unreachable for those and keeps returning
+ # 404 — matching the existing contract.
+ _SUPPRESSED_VISIBLE_ACTIONS = frozenset({"state", "retrieve", "signals"})
+
def _apply_signal_report_status_filter(self, queryset):
status_filter = self.request.query_params.get("status")
if status_filter:
@@ -441,10 +449,12 @@ class SignalReportViewSet(
}
)
return queryset.filter(status__in=statuses)
- # The `state` action reopens dismissed reports, so it must be able to reach a suppressed
- # report by ID — otherwise transitioning one back to "potential" would 404. Everywhere
- # else suppressed reports stay hidden unless an explicit `status` filter asks for them.
- if self.action == "state":
+ # A few read/reopen actions must be able to reach a suppressed report by ID
+ # (e.g. `state` reopens a dismissed report, `retrieve`/`signals` back the
+ # inbox's Dismissed-tab detail view). Everywhere else — including the list and
+ # mutating-by-ID actions like delete/reingest — suppressed reports stay hidden
+ # unless an explicit `status` filter asks for them.
+ if self.action in self._SUPPRESSED_VISIBLE_ACTIONS:
return queryset
return queryset.exclude(status=SignalReport.Status.SUPPRESSED)