bito-code-review[bot] commented on code in PR #39900:
URL: https://github.com/apache/superset/pull/39900#discussion_r3343989835


##########
superset/mcp_service/explore/tool/generate_explore_link.py:
##########
@@ -132,16 +134,26 @@ async def generate_explore_link(
                 await ctx.warning(
                     "Dataset not found: dataset_id=%s" % (request.dataset_id,)
                 )
-                return {
-                    "url": "",
-                    "form_data": {},
-                    "form_data_key": None,
-                    "chart_type_label": None,
-                    "error": (
-                        f"Dataset not found: {request.dataset_id}. "
-                        "Use list_datasets to find valid dataset IDs."
+                return GenerateExploreLinkResponse(
+                    url="",
+                    form_data={},
+                    form_data_key=None,
+                    chart_type_label=None,
+                    error=ChartGenerationError(
+                        error_type="dataset_not_found",
+                        message=f"Dataset not found: {request.dataset_id}.",
+                        details=(
+                            f"No dataset found with identifier "
+                            f"'{request.dataset_id}'. Use list_datasets to "
+                            "find valid dataset IDs."
+                        ),
+                        suggestions=[
+                            "Verify the dataset ID or UUID is correct",
+                            "Use the list_datasets tool to find available 
datasets",
+                        ],
                     ),
-                }
+                    success=False,
+                )

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing error_code in error responses</b></div>
   <div id="fix">
   
   The new error responses at lines 142-156 and 173-187 omit the `error_code` 
field, while the same codebase's `generate_chart.py` (line 331) uses 
`error_code='DATASET_NOT_FOUND'`. Adding error codes enables consistent 
programmatic error handling.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- a/superset/mcp_service/explore/tool/generate_explore_link.py
    +++ b/superset/mcp_service/explore/tool/generate_explore_link.py
    @@ -142,6 +142,7 @@ async def generate_explore_link(
                             details=(
                                 f"No dataset found with identifier "
                                 f"'{request.dataset_id}'. Use list_datasets to 
"
                                 "find valid dataset IDs."
                             ),
    +                        error_code="DATASET_NOT_FOUND",
                             suggestions=[
                                 "Verify the dataset ID or UUID is correct",
                                 "Use the list_datasets tool to find available 
datasets",
    @@ -173,6 +174,7 @@ async def generate_explore_link(
                             details=(
                                 f"No dataset found with identifier "
                                 f"'{request.dataset_id}'. Use list_datasets to 
"
                                 "find valid dataset IDs."
                             ),
    +                        error_code="PERMISSION_DENIED",
                             suggestions=[
                                 "Check that you have access to this dataset",
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #70f990</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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