bito-code-review[bot] commented on PR #42621:
URL: https://github.com/apache/superset/pull/42621#issuecomment-5135793925

   <!-- Bito Reply -->
   The proposed approach of snapshotting the datasource identity (alongside the 
other chart attributes) is a sound strategy to avoid `DetachedInstanceError` 
during concurrent operations. By capturing these values immediately after the 
chart is committed and before any `await` points, you ensure that subsequent 
logic—such as `validate_chart_dataset`—operates on stable, local data rather 
than relying on an instance that might have been detached by a concurrent 
session teardown. Regarding the regression test, exercising this validator 
directly is indeed preferable to mocking it, as it provides higher confidence 
that the fix correctly handles the state transition.
   
   **superset/mcp_service/chart/tool/generate_chart.py**
   ```
   chart_id = chart.id
                       chart_slice_name = chart.slice_name
                       chart_viz_type = chart.viz_type
                       chart_uuid = str(chart.uuid) if chart.uuid else None
                       # Also snapshot datasource_id here if needed for 
validation
                       chart_datasource_id = chart.datasource_id
   ```


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