codeant-ai-for-open-source[bot] commented on code in PR #41698:
URL: https://github.com/apache/superset/pull/41698#discussion_r3545790501


##########
tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py:
##########
@@ -885,6 +886,32 @@ def test_client_supplied_warnings_are_discarded(self) -> 
None:
         assert req.sanitization_warnings == []
 
 
+class TestDashboardInfoLargeListGuidance:
+    """DashboardInfo documents how agents can retrieve charts/native_filters
+    beyond the response-size guard's list-item cap.
+
+    Regression test for the Medialab large-dashboard report: with the old
+    hardcoded 30-item cap and no documented escape hatch, agents had no way
+    to retrieve the rest of a dashboard's charts. These field descriptions
+    are the "documented, agent-usable way to access items beyond the cap"
+    called for by the story's acceptance criteria.
+    """
+
+    def test_charts_field_documents_list_charts_escape_hatch(self) -> None:
+        """The charts field description points to list_charts pagination."""
+        description = DashboardInfo.model_fields["charts"].description
+        assert description is not None
+        assert "list_charts" in description
+        assert "dashboards" in description
+        assert "chart_count" in description
+

Review Comment:
   **Suggestion:** Add an explicit type annotation for this local variable to 
comply with required Python typing coverage. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This new local variable is introduced without a type annotation, and it is 
trivially annotatable (for example, as an optional string). That matches the 
Python type-hint coverage rule for newly modified code.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f87fe3b7e92a4dd09ed276928215bec8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f87fe3b7e92a4dd09ed276928215bec8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py
   **Line:** 900:907
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this local variable 
to comply with required Python typing coverage.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=b59aa332040abb6b3f7a56799b3b4dab89319e3e61f9d5c9a409fdcf52c76983&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=b59aa332040abb6b3f7a56799b3b4dab89319e3e61f9d5c9a409fdcf52c76983&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/utils/test_token_utils.py:
##########
@@ -677,3 +677,43 @@ 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 below both list sizes should truncate both 
fields."""
+        response = {

Review Comment:
   **Suggestion:** Add an explicit type annotation to this local test payload 
variable (for example a dictionary shape) instead of leaving it untyped. 
[custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The added local test payload is a dictionary literal but is not annotated, 
so it violates the Python type-hint requirement for newly introduced 
annotatable variables.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=718d4c56413f496998c9548c6dbd988d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=718d4c56413f496998c9548c6dbd988d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/utils/test_token_utils.py
   **Line:** 705:705
   **Comment:**
        *Custom Rule: Add an explicit type annotation to this local test 
payload variable (for example a dictionary shape) instead of leaving it untyped.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=02e03c53ed77330a263f253b3f06159379fd9180fa11bfa7f9dd7ff47610139f&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=02e03c53ed77330a263f253b3f06159379fd9180fa11bfa7f9dd7ff47610139f&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py:
##########
@@ -885,6 +886,32 @@ def test_client_supplied_warnings_are_discarded(self) -> 
None:
         assert req.sanitization_warnings == []
 
 
+class TestDashboardInfoLargeListGuidance:
+    """DashboardInfo documents how agents can retrieve charts/native_filters
+    beyond the response-size guard's list-item cap.
+
+    Regression test for the Medialab large-dashboard report: with the old
+    hardcoded 30-item cap and no documented escape hatch, agents had no way
+    to retrieve the rest of a dashboard's charts. These field descriptions
+    are the "documented, agent-usable way to access items beyond the cap"
+    called for by the story's acceptance criteria.
+    """
+
+    def test_charts_field_documents_list_charts_escape_hatch(self) -> None:
+        """The charts field description points to list_charts pagination."""
+        description = DashboardInfo.model_fields["charts"].description
+        assert description is not None
+        assert "list_charts" in description
+        assert "dashboards" in description
+        assert "chart_count" in description
+
+    def test_native_filters_field_documents_max_list_items_config(self) -> 
None:
+        """The native_filters field description mentions the configurable 
cap."""
+        description = DashboardInfo.model_fields["native_filters"].description
+        assert description is not None
+        assert "max_list_items" in description
+

Review Comment:
   **Suggestion:** Add an explicit type annotation for this local variable to 
satisfy the type-hint requirement. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This newly added local variable also lacks a type hint even though it can be 
annotated, so it violates the required Python typing coverage rule for modified 
code.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8684d1f3afb9440a9fd3ad5abf73a607&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8684d1f3afb9440a9fd3ad5abf73a607&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py
   **Line:** 908:913
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this local variable 
to satisfy the type-hint requirement.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=ce3f06740df0cea3f416a5e4cf6b9be489a22f835c3d0e6c2b3a89a185019902&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=ce3f06740df0cea3f416a5e4cf6b9be489a22f835c3d0e6c2b3a89a185019902&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/utils/test_token_utils.py:
##########
@@ -677,3 +677,43 @@ 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 = {

Review Comment:
   **Suggestion:** Add an explicit type annotation to this local test payload 
variable (for example a dictionary shape) to satisfy the required type-hint 
rule for annotatable variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The new test introduces a local variable assigned a dictionary literal 
without any type annotation, which matches the rule requiring type hints for 
annotatable Python variables.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=fca91d9570b2458ca8d08aeb34e37ce6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=fca91d9570b2458ca8d08aeb34e37ce6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/utils/test_token_utils.py
   **Line:** 689:689
   **Comment:**
        *Custom Rule: Add an explicit type annotation to this local test 
payload variable (for example a dictionary shape) to satisfy the required 
type-hint rule for annotatable variables.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=ed2c15a5a4ff042f0046252981513b3a4a25f3767b3cb70be05a65c4370e6ba7&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41698&comment_hash=ed2c15a5a4ff042f0046252981513b3a4a25f3767b3cb70be05a65c4370e6ba7&reaction=dislike'>👎</a>



-- 
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