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


##########
superset/mcp_service/chart/schemas.py:
##########
@@ -2198,6 +2198,19 @@ class ListChartsRequest(
 ):
     """Request schema for list_charts with clear, unambiguous types."""
 
+    certified: Annotated[
+        bool | None,
+        Field(
+            default=None,
+            description=(
+                "Filter by governance certification status. Use true to return 
"
+                "only certified charts (preferred when selecting governed "
+                "assets), false to return only uncertified charts, or omit to "
+                "return both (default)."
+            ),
+        ),
+    ]

Review Comment:
   **Suggestion:** Because this uses Pydantic's non-strict `bool` coercion, 
invalid MCP values such as the string `"false"` or numeric `0` are silently 
converted to `False`. The tool then applies the uncertified-only filter instead 
of rejecting the malformed request, which can produce an unintended result; use 
strict boolean validation for this tri-state field. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Minor ๐Ÿงน</summary>
   
   ```mdx
   - โš ๏ธ Malformed MCP requests silently select uncertified charts.
   - โš ๏ธ Agents may receive incomplete governed-asset results.
   - โš ๏ธ Invalid client serialization is hidden instead of reported.
   ```
   </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=75fe7f4b019c485c85e285941c70597a&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=75fe7f4b019c485c85e285941c70597a&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:** superset/mcp_service/chart/schemas.py
   **Line:** 2201:2212
   **Comment:**
        *Type Error: Because this uses Pydantic's non-strict `bool` coercion, 
invalid MCP values such as the string `"false"` or numeric `0` are silently 
converted to `False`. The tool then applies the uncertified-only filter instead 
of rejecting the malformed request, which can produce an unintended result; use 
strict boolean validation for this tri-state field.
   
   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%2F42656&comment_hash=98676a495cd50cb9dabe55df845530c75a5c6f4e98a051ce95fab8fc2269435e&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42656&comment_hash=98676a495cd50cb9dabe55df845530c75a5c6f4e98a051ce95fab8fc2269435e&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/mcp_service/chart/tool/list_charts.py:
##########
@@ -80,7 +80,9 @@ async def list_charts(
     """List charts with filtering and search.
 
     Returns chart metadata including id, name, viz_type, URL, and last
-    modified time.
+    modified time. Set ``request.certified`` to true to prioritize governed
+    charts; false returns only uncertified charts, while omitting it preserves
+    the unfiltered behavior.

Review Comment:
   **Suggestion:** The documentation says `certified=true` will prioritize 
governed charts, but the implementation applies `ChartCertifiedFilter`, which 
excludes every uncertified chart rather than ordering certified charts first. 
This can cause MCP clients to expect a mixed result set with certified charts 
preferred while receiving only certified charts; describe this as an exclusive 
filter or change the implementation to provide prioritization. [docstring 
mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Minor ๐Ÿงน</summary>
   
   ```mdx
   - โš ๏ธ MCP clients can misinterpret certified chart results.
   - โš ๏ธ Uncertified charts are excluded when `certified=true`.
   - โš ๏ธ Agent prompts may incorrectly expect prioritized mixed results.
   ```
   </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=548067d56e6d40dc8e981215fe3db67b&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=548067d56e6d40dc8e981215fe3db67b&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:** superset/mcp_service/chart/tool/list_charts.py
   **Line:** 83:85
   **Comment:**
        *Docstring Mismatch: The documentation says `certified=true` will 
prioritize governed charts, but the implementation applies 
`ChartCertifiedFilter`, which excludes every uncertified chart rather than 
ordering certified charts first. This can cause MCP clients to expect a mixed 
result set with certified charts preferred while receiving only certified 
charts; describe this as an exclusive filter or change the implementation to 
provide prioritization.
   
   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%2F42656&comment_hash=5a60e1448be3de2ed3d55e519293172b26cc9194e0db5facdc584803272ae4ae&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42656&comment_hash=5a60e1448be3de2ed3d55e519293172b26cc9194e0db5facdc584803272ae4ae&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