: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): degrade inbox list when metadata fetch fails (#67859)
posthog[bot]266c5090fb0c
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.pyindex cf97ab9d9529..ab22ded385f2 100644--- a/products/signals/backend/test/test_signal_report_api.py+++ b/products/signals/backend/test/test_signal_report_api.py@@ -915,6 +915,27 @@ class TestSignalReportListAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert response.json()["source_products"] == []+ @parameterized.expand(+ [+ ("source_products", "fetch_source_products_for_reports"),+ ("implementation_pr_urls", "fetch_implementation_pr_urls_for_reports"),+ ]+ )+ def test_list_resilient_to_supplementary_fetch_failure(self, _name, fetch_fn):+ # A transient failure in either decorative metadata fetch must degrade to empty badges+ # rather than 500 the whole inbox load — the list still renders from Postgres data.+ report = self._create_report()++ with patch(+ f"products.signals.backend.views.{fetch_fn}",+ side_effect=Exception("clickhouse timeout"),+ ):+ response = self.client.get(self._list_url())++ assert response.status_code == status.HTTP_200_OK+ row = next(r for r in response.json()["results"] if r["id"] == str(report.id))+ assert row["source_products"] == []+# --- suppressed report reachability ---## Suppressed (dismissed) reports stay out of the list by default, but the inbox'sdiff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 6b8c8abc4bfa..d81dc941ad30 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -1184,11 +1184,22 @@ class SignalReportViewSet(report_ids = [str(r.id) for r in reports]trace.get_current_span().set_attribute("signals.reports.list.count", len(report_ids))+ # Both lookups are best-effort decorative metadata (source-product badges, scout names, PR+ # urls). The serializer degrades to empty values when a map is missing, so a ClickHouse or+ # backend hiccup in either must not 500 the whole inbox load — fall back to empty and log.with tracer.start_as_current_span("signals.reports.list.fetch_source_products"):- signal_meta_map = fetch_source_products_for_reports(self.team, report_ids) if report_ids else {}+ try:+ signal_meta_map = fetch_source_products_for_reports(self.team, report_ids) if report_ids else {}+ except Exception:+ logger.exception("signals.reports.list.source_products_failed", report_count=len(report_ids))+ signal_meta_map = {}with tracer.start_as_current_span("signals.reports.list.fetch_implementation_pr_urls"):- implementation_pr_url_map = fetch_implementation_pr_urls_for_reports(report_ids)+ try:+ implementation_pr_url_map = fetch_implementation_pr_urls_for_reports(report_ids)+ except Exception:+ logger.exception("signals.reports.list.implementation_pr_url_failed", report_count=len(report_ids))+ implementation_pr_url_map = {}context = {**self.get_serializer_context(),