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


##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -395,21 +411,23 @@ async def get_chart_data(  # noqa: C901
         )
         logger.info("Getting data for chart %s: %s", chart.id, 
chart.slice_name)
 
-        # Validate the chart's dataset is accessible before retrieving data
-        validation_result = validate_chart_dataset(chart, check_access=True)
-        if not validation_result.is_valid:
-            await ctx.warning(
-                "Chart found but dataset is not accessible: %s"
-                % (validation_result.error,)
-            )
-            return ChartError(
-                error=validation_result.error
-                or "Chart's dataset is not accessible. Dataset may have been 
deleted.",
-                error_type="DatasetNotAccessible",
-            )
-        # Log any warnings (e.g., virtual dataset warnings)
-        for warning in validation_result.warnings:
-            await ctx.warning("Dataset warning: %s" % (warning,))
+        # Skip the dataset RBAC pre-check for guests (see 
guest_scope.is_guest_read).
+        if not guest_scope.is_guest_read():
+            validation_result = validate_chart_dataset(chart, 
check_access=True)
+            if not validation_result.is_valid:
+                await ctx.warning(
+                    "Chart found but dataset is not accessible: %s"
+                    % (validation_result.error,)
+                )
+                return ChartError(
+                    error=validation_result.error
+                    or "Chart's dataset is not accessible. "
+                    "Dataset may have been deleted.",
+                    error_type="DatasetNotAccessible",
+                )
+            # Log any warnings (e.g., virtual dataset warnings)
+            for warning in validation_result.warnings:
+                await ctx.warning("Dataset warning: %s" % (warning,))

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing guest scope integration test</b></div>
   <div id="fix">
   
   The new guest-scoped bypass of `validate_chart_dataset` (line 414-430) and 
the `authorize_query` call (line 628-629) lack test coverage in 
`tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py`. An async 
integration test that mocks `guest_scope.is_guest_read()` to return True would 
verify the end-to-end guest flow: chart lookup → `guest_dashboard_id` capture → 
RBAC skip → `authorize_query` with dashboard context.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #721a05</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