bito-code-review[bot] commented on code in PR #37185:
URL: https://github.com/apache/superset/pull/37185#discussion_r2853664201
##########
superset/mcp_service/chart/tool/get_chart_preview.py:
##########
@@ -114,7 +117,7 @@ def generate(self) -> URLPreview | ChartError:
error=f"Could not generate screenshot for chart
{self.chart.id}",
error_type="ScreenshotError",
Review Comment:
<!-- Bito Reply -->
The commit f275420 adds AttributeError and TypeError to exception handlers
in _get_form_data (now catches ValueError, TypeError), _analyze_field_types
(now catches TypeError, ValueError, KeyError, AttributeError), and
generate_ascii_chart (now catches TypeError, ValueError, KeyError, IndexError).
This covers attribute access and JSON parsing edge cases. Since
screenshot/WebDriver operations are removed and URL preview returns unsupported
format error, the narrowed exception handling in URLPreview.generate (now
CommandException, SupersetException, ValueError, KeyError) avoids uncaught
errors from removed code paths.
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -34,6 +37,113 @@
from superset.mcp_service.utils.url_utils import get_superset_base_url
from superset.utils import json
+logger = logging.getLogger(__name__)
+
+
+@dataclass
+class DatasetValidationResult:
+ """Result of dataset accessibility validation."""
+
+ is_valid: bool
+ dataset_id: int | None
Review Comment:
<!-- Bito Reply -->
Yes, the suggestion is valid — it updates the type annotation to `int | str
| None` to support UUID datasets, ensuring consistency with how `dataset_id` is
used in functions like `generate_explore_link` that already accept string IDs.
--
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]