mikebridge commented on code in PR #44267:
URL: https://github.com/apache/superset/pull/44267#discussion_r4039680236


##########
superset/mcp_service/chart/tool/get_chart_sql.py:
##########
@@ -533,16 +544,26 @@ async def _handle_chart_sql_request(
             )
 
         # Fallback: build query context from form_data
-        try:
-            return _sql_from_form_data(
-                effective_form_data, chart, request.extra_form_data
-            )
-        except (SupersetException, CommandException, ValueError) as e:
-            await ctx.warning("Failed to build SQL from form_data: %s" % 
str(e))
-            return ChartError(
-                error="Failed to generate SQL for chart %s: %s" % (chart.id, 
e),
-                error_type="QueryGenerationFailed",
-            )
+        return await _sql_from_chart_form_data(
+            effective_form_data, chart, request.extra_form_data, ctx
+        )
+
+
+async def _sql_from_chart_form_data(
+    form_data: dict[str, Any],
+    chart: "Slice",
+    extra_form_data: dict[str, Any] | None,
+    ctx: Context,
+) -> ChartSql | ChartError:
+    """Build saved-chart fallback SQL with its existing error response 
mapping."""

Review Comment:
   Linking the disposition here so it is attached to the original finding: 
addressed in eca7c185e9d0e96837bfb5f48d66f5f43f968343. The saved-chart fallback 
now checks the resolved cached datasource before SQL construction and returns 
Unsupported for semantic views. Both cached encodings, ordinary-table 
passthrough and guest denial are covered; removing the guard fails the two 
semantic regressions. Verification details: 
https://github.com/apache/superset/pull/44267#issuecomment-5717969863 . Could 
you take another look when convenient?



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