Copilot commented on code in PR #41923:
URL: https://github.com/apache/superset/pull/41923#discussion_r3561866763
##########
superset/mcp_service/chart/tool/generate_chart.py:
##########
@@ -886,14 +886,9 @@ async def generate_chart( # noqa: C901
logger.exception("Chart generation failed: %s", str(e))
- # Extract chart_type from different sources for better error context
+ # request.config is always a validated ChartConfig (never a dict), so
+ # chart_type context isn't extractable here.
chart_type = "unknown"
- try:
- if hasattr(request, "config") and isinstance(request.config, dict):
- chart_type = request.config.chart_type
- except (AttributeError, TypeError) as extract_error:
- # Ignore errors when extracting chart type for error context
- logger.debug("Could not extract chart type: %s", extract_error)
Review Comment:
This comment is misleading: `request.config` is a validated `ChartConfig`,
and all `ChartConfig` variants define a `chart_type` discriminator field.
Setting `chart_type = "unknown"` here throws away useful context for the
standardized error payload (and contradicts the comment).
--
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]