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


##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -1017,6 +1018,25 @@ def map_pie_config(config: PieChartConfig) -> Dict[str, 
Any]:
     return form_data
 
 
+def map_funnel_config(config: FunnelChartConfig) -> Dict[str, Any]:
+    """Map funnel config to Superset form_data (viz_type ``funnel``).
+
+    Matches the frontend Funnel buildQuery contract: a single ``groupby``
+    dimension (the funnel stages) and one ``metric``; when ``sort_by_metric``
+    is set the query orders by that metric descending.
+    """
+    form_data: Dict[str, Any] = {
+        "viz_type": "funnel",
+        "groupby": [config.dimension.name],
+        "metric": create_metric_object(config.metric),
+        "sort_by_metric": config.sort_by_metric,

Review Comment:
   **Suggestion:** The MCP path builds the query context directly from this 
`form_data` and does not execute the frontend Funnel `buildQuery`, which is the 
code that converts `sort_by_metric` into an `orderby` clause. Consequently, 
setting `sort_by_metric=True` here only stores an unused flag and funnel stages 
are not ordered by the metric as promised. Add the equivalent descending metric 
ordering to the backend query construction or otherwise ensure this flag is 
consumed before execution. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ MCP chart-data retrieval ignores funnel metric sorting.
   - ⚠️ Funnel stages may appear in nondeterministic order.
   - ❌ Top-stage-first funnel presentation is not guaranteed.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=34611e30d45446f69a0858ab1b47c910&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=34611e30d45446f69a0858ab1b47c910&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/chart/chart_utils.py
   **Line:** 1032:1032
   **Comment:**
        *Api Mismatch: The MCP path builds the query context directly from this 
`form_data` and does not execute the frontend Funnel `buildQuery`, which is the 
code that converts `sort_by_metric` into an `orderby` clause. Consequently, 
setting `sort_by_metric=True` here only stores an unused flag and funnel stages 
are not ordered by the metric as promised. Add the equivalent descending metric 
ordering to the backend query construction or otherwise ensure this flag is 
consumed before execution.
   
   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%2F43567&comment_hash=e3df07bf128f9daf626d287eccdfeb37df7ca3d4ab22e2522bda63b761ad74ec&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43567&comment_hash=e3df07bf128f9daf626d287eccdfeb37df7ca3d4ab22e2522bda63b761ad74ec&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