aminghadersohi commented on code in PR #41698:
URL: https://github.com/apache/superset/pull/41698#discussion_r3546779557


##########
tests/unit_tests/mcp_service/utils/test_token_utils.py:
##########
@@ -677,3 +677,42 @@ def test_progressive_truncation(self) -> None:
         assert isinstance(result, dict)
         assert result["id"] == 1  # Scalar fields preserved
         assert len(notes) > 0
+
+    def test_large_dashboard_respects_default_max_list_items(self) -> None:
+        """Regression test for the Medialab large-dashboard report.
+
+        A dashboard with 463 charts and 48 native_filters should have
+        native_filters (48 items) left untouched under the new default cap
+        of 100, while charts (463 items) is truncated to 100 — a clear
+        improvement over the old flat 30-item cap, which truncated both.
+        """
+        response = {
+            "id": 1,
+            "dashboard_title": "x" * 2000,  # forces Phase 2 to trigger
+            "charts": [{"id": i, "slice_name": f"chart_{i}"} for i in 
range(463)],
+            "native_filters": [{"id": i, "name": f"filter_{i}"} for i in 
range(48)],
+        }
+        result, was_truncated, notes = truncate_oversized_response(response, 
3000)
+        assert was_truncated is True
+        assert isinstance(result, dict)
+        assert len(result["charts"]) == 100
+        assert len(result["native_filters"]) == 48
+        assert any("charts" in n and "463" in n for n in notes)
+        assert not any("native_filters" in n for n in notes)
+
+    def test_large_dashboard_respects_custom_max_list_items(self) -> None:
+        """A custom max_list_items should truncate both fields to that cap."""
+        response = {

Review Comment:
   Fixed in 76b6542 (via commit d0179b246). The test now uses 
max_list_items=30, which is below both charts (463 items) and native_filters 
(48 items), so it asserts both fields are truncated - matching corrected 
docstring wording.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to