codeant-ai-for-open-source[bot] commented on code in PR #37188:
URL: https://github.com/apache/superset/pull/37188#discussion_r2710751450
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -325,6 +325,10 @@ def map_xy_config(config: XYChartConfig) -> Dict[str, Any]:
if filter_config is not None
]
+ # Add stacking configuration
+ if getattr(config, "stacked", False):
+ form_data["stack"] = True
Review Comment:
**Suggestion:** Value/type bug: Superset expects the stacking identifier to
be a string (e.g., "Stack") for ECharts to group series; setting
form_data["stack"] = True stores a boolean which will not trigger proper
stacking behavior. [logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Stacked XY charts not rendered as stacked.
- ⚠️ MCP generate_chart/update_chart returns incorrect form_data.
- ⚠️ LLM clients setting stacked=true get no stacking.
```
</details>
```suggestion
form_data["stack"] = "Stack"
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Call map_xy_config(...) in superset/mcp_service/chart/chart_utils.py at
the function
defined around lines 305-336. Provide an XYChartConfig with stacked=True
(e.g.,
XYChartConfig.stacked=True) and any valid X/Y config.
2. Execution reaches the stacking branch at lines 328-330 where the code
currently
executes:
328 # Add stacking configuration
329 if getattr(config, "stacked", False):
330 form_data["stack"] = True
and sets form_data["stack"] to the boolean True.
3. map_xy_config returns the form_data dict (returned at line ~336). The
caller (e.g., any
code path that uses map_config_to_form_data -> map_xy_config) receives
form_data with
"stack": True.
4. When that form_data is persisted/sent to Superset (the
MCPCreateFormDataCommand flow in
this module that serializes form_data and creates a explore link),
Superset/ECharts
expects a string stack identifier (e.g., "Stack") to group series. With a
boolean value
present, Superset will not interpret it as a valid stack group, so stacking
will not be
applied at render time.
```
</details>
<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:** 330:330
**Comment:**
*Logic Error: Value/type bug: Superset expects the stacking identifier
to be a string (e.g., "Stack") for ECharts to group series; setting
form_data["stack"] = True stores a boolean which will not trigger proper
stacking behavior.
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.
```
</details>
--
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]