: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(dashboards): skip breakdown override for non-breakdown query tiles (#63628)
posthog[bot]c9eea079cb06
diff --git a/posthog/hogql_queries/insights/lifecycle/test/test_lifecycle_query_runner.py b/posthog/hogql_queries/insights/lifecycle/test/test_lifecycle_query_runner.pyindex 743958a32313..ad0eb1bb483c 100644--- a/posthog/hogql_queries/insights/lifecycle/test/test_lifecycle_query_runner.py+++ b/posthog/hogql_queries/insights/lifecycle/test/test_lifecycle_query_runner.py@@ -9,6 +9,7 @@ from posthog.test.base import (flush_persons_and_events,snapshot_clickhouse_queries,)+from unittest.mock import patchfrom parameterized import parameterizedfrom rest_framework.exceptions import ValidationError@@ -2173,15 +2174,19 @@ class TestLifecycleQueryRunner(ClickhouseTestMixin, APIBaseTest):assert not hasattr(query_runner.query, "breakdownFilter")- query_runner.apply_dashboard_filters(- DashboardFilter(- breakdown_filter=BreakdownFilter(- breakdown="$feature/my-fabulous-feature", breakdown_type="event", breakdown_limit=10+ # LifecycleQuery has no breakdownFilter field, so a dashboard breakdown override is+ # silently ignored — and it must not pollute error tracking with a captured exception.+ with patch("posthog.hogql_queries.query_runner.capture_exception") as mock_capture_exception:+ query_runner.apply_dashboard_filters(+ DashboardFilter(+ breakdown_filter=BreakdownFilter(+ breakdown="$feature/my-fabulous-feature", breakdown_type="event", breakdown_limit=10+ )))- )assert not hasattr(query_runner.query, "breakdownFilter")+ mock_capture_exception.assert_not_called()def test_dashboard_property_filters_are_ignored_for_data_warehouse_series(self):query_runner = LifecycleQueryRunner(diff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex 5caaf8220d44..7fd43b4f977e 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -2110,7 +2110,7 @@ class QueryRunner(ABC, Generic[Q, R, CR]):dashboard_breakdown_filter = dashboard_filter.breakdown_filter- should_ignore_dashboard_breakdown = (+ should_ignore_dashboard_breakdown = not hasattr(self.query, "breakdownFilter") or (isinstance(self.query, TrendsQuery)and has_data_warehouse_seriesand (@@ -2161,14 +2161,8 @@ class QueryRunner(ABC, Generic[Q, R, CR]):date_range.explicitDate = dashboard_filter.explicitDateif dashboard_filter.breakdown_filter and not should_ignore_dashboard_breakdown:- if hasattr(self.query, "breakdownFilter"):+ if hasattr(self.query, "breakdownFilter"): # redundant, but required for mypyself.query.breakdownFilter = dashboard_filter.breakdown_filter- else:- capture_exception(- NotImplementedError(- f"{self.query.__class__.__name__} does not support breakdown filters out of the box"- )- )self.__post_init__()