: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): keep PR reads working on an archived inbox report (#93994)
posthog[bot]75babaea4a3d
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.pyindex 378096df5791..84850202dbfe 100644--- a/products/signals/backend/test/test_signal_report_api.py+++ b/products/signals/backend/test/test_signal_report_api.py@@ -2773,10 +2773,10 @@ class TestSignalReportContentUpdateAPI(APIBaseTest):class TestSignalReportPrEndpoints(APIBaseTest):- def _create_report(self) -> SignalReport:+ def _create_report(self, report_status: str = SignalReport.Status.READY) -> SignalReport:return SignalReport.objects.create(team=self.team,- status=SignalReport.Status.READY,+ status=report_status,title="Test report",summary="Test summary",signal_count=1,@@ -2956,6 +2956,27 @@ class TestSignalReportPrEndpoints(APIBaseTest):priority=Priority.NORMAL,)+ @parameterized.expand(+ [+ ("checks", "_checks_url", "get_pull_request_checks", "checks"),+ ("comments", "_comments_url", "get_pull_request_comments", "comments"),+ ]+ )+ def test_pr_reads_serve_a_suppressed_report(self, _name, url_attr, fetch_name, key):+ # The Archive tab renders the PR panel of a dismissed report, so both read-only PR+ # endpoints must reach a suppressed report by ID like `retrieve` does.+ report = self._create_report(report_status=SignalReport.Status.SUPPRESSED)+ github = patch("products.signals.backend.views.GitHubIntegration.first_for_team_repository").start()+ self.addCleanup(patch.stopall)+ getattr(github.return_value, fetch_name).return_value = {"success": True, key: []}+ with patch(+ "products.signals.backend.views.fetch_implementation_pr_urls_for_reports",+ return_value={str(report.id): "https://github.com/PostHog/posthog/pull/7"},+ ):+ response = self.client.get(getattr(self, url_attr)(str(report.id)))+ assert response.status_code == status.HTTP_200_OK+ assert response.json() == {key: []}+def test_pr_checks_maps_upstream_failure_to_502(self):report = self._create_report()github = patch("products.signals.backend.views.GitHubIntegration.first_for_team_repository").start()diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex eb281b197839..46333b6311de 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -948,9 +948,10 @@ class SignalReportViewSet(# deliberately NOT here, so a suppressed report stays unreachable for those and keeps# returning 404 — matching the existing contract.# `viewed` follows `retrieve` for the same reason: the Dismissed tab's detail view records its- # open like any other.+ # open like any other. `pr_checks` and `pr_comments` are there because that same view renders the+ # read-only PR panel whatever the report's status is._SUPPRESSED_VISIBLE_ACTIONS = frozenset(- {"state", "bulk_state", "retrieve", "signals", "refund", "feedback", "viewed"}+ {"state", "bulk_state", "retrieve", "signals", "refund", "feedback", "viewed", "pr_checks", "pr_comments"})# Human-readable explanation per bulk outcome, surfaced in each result's `detail` fielddiff --git a/products/signals/frontend/inbox/InboxScene.tsx b/products/signals/frontend/inbox/InboxScene.tsxindex aba3a66b57ae..fcab9a46d944 100644--- a/products/signals/frontend/inbox/InboxScene.tsx+++ b/products/signals/frontend/inbox/InboxScene.tsx@@ -336,7 +336,8 @@ export function InboxScene(): JSX.Element {<div><h3 className="m-0 text-base font-semibold">Report not found</h3><p className="m-0 mt-1 text-sm text-tertiary">- This report does not exist. It may have been removed.+ We can't find this report in this project. Check that you have the right project+ selected.</p></div><LemonButton