You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/11 18:13:13 UTC
(superset) branch tdd/issue-28562-drill-to-detail-filters created (now 262c63e5c2f)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch tdd/issue-28562-drill-to-detail-filters
in repository https://gitbox.apache.org/repos/asf/superset.git
at 262c63e5c2f test(charts): assert drill-to-detail carries applied filters (#28562)
This branch includes the following new commits:
new 262c63e5c2f test(charts): assert drill-to-detail carries applied filters (#28562)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: test(charts): assert drill-to-detail carries applied filters (#28562)
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch tdd/issue-28562-drill-to-detail-filters
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 262c63e5c2f4ab5a806c993a6f04ac2af626ce12
Author: Claude Code <no...@anthropic.com>
AuthorDate: Sat Jul 11 11:12:11 2026 -0700
test(charts): assert drill-to-detail carries applied filters (#28562)
Regression coverage for #28562, where 'Drill to Detail by' from a chart on a
dashboard reportedly ignores the dashboard's applied filters. This exercises
the backend drill-detail action (_get_drill_detail) directly and asserts that
the chart's applied filters survive onto the query object that is executed for
the samples query.
Closes #28562
Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
---
.../common/test_query_actions_currency.py | 61 +++++++++++++++++++++-
1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/tests/unit_tests/common/test_query_actions_currency.py b/tests/unit_tests/common/test_query_actions_currency.py
index 50ec9619c81..6ad14e88d03 100644
--- a/tests/unit_tests/common/test_query_actions_currency.py
+++ b/tests/unit_tests/common/test_query_actions_currency.py
@@ -19,7 +19,9 @@ from unittest.mock import MagicMock, patch
import pandas as pd
import pytest
-from superset.common.query_actions import _detect_currency
+from superset.common.chart_data import ChartDataResultType
+from superset.common.query_actions import _detect_currency, _get_drill_detail
+from superset.common.query_object import QueryObject
@pytest.fixture
@@ -288,3 +290,60 @@ def test_detect_currency_column_config_no_currency_column_returns_none(
)
assert result is None
+
+
+# Tests for drill-to-detail filter propagation (issue #28562)
+
+
+@patch("superset.common.query_actions._get_full")
+def test_get_drill_detail_preserves_applied_filters(
+ mock_get_full: MagicMock,
+) -> None:
+ """
+ Regression for #28562: 'Drill to Detail by' must carry a chart's applied
+ filters (e.g. the dashboard's native filters) into the drill-to-detail
+ samples query. The drill-detail action rewrites columns/metrics/orderby but
+ must leave ``QueryObject.filter`` untouched so the underlying rows stay
+ scoped to the dashboard's filter selections.
+
+ This exercises the backend drill-detail transformation directly and asserts
+ the incoming filters survive onto the query object that is ultimately
+ executed. A green run means the backend honors the filters (the reported
+ behavior is not reproduced in this code path); a red run means they are
+ dropped.
+ """
+ applied_filter = {"col": "region", "op": "==", "val": "USA"}
+
+ query_obj = QueryObject(
+ columns=["region", "sales"],
+ metrics=["count"],
+ filters=[applied_filter],
+ )
+
+ col_region = MagicMock()
+ col_region.column_name = "region"
+ col_sales = MagicMock()
+ col_sales.column_name = "sales"
+
+ datasource = MagicMock()
+ datasource.columns = [col_region, col_sales]
+
+ query_context = MagicMock()
+ query_context.datasource = datasource
+ query_context.result_type = ChartDataResultType.DRILL_DETAIL
+
+ captured: dict[str, QueryObject] = {}
+
+ def _capture(_ctx: MagicMock, obj: QueryObject, _force: bool) -> dict:
+ captured["query_obj"] = obj
+ return {}
+
+ mock_get_full.side_effect = _capture
+
+ _get_drill_detail(query_context, query_obj)
+
+ executed = captured["query_obj"]
+ assert applied_filter in executed.filter, (
+ "Drill-to-detail dropped the chart's applied filters; the samples query "
+ "would return unfiltered rows (issue #28562)."
+ )