kgabryje commented on PR #38934:
URL: https://github.com/apache/superset/pull/38934#issuecomment-4154570792

   ### Code review
   
   Found 2 issues:
   
   1. **GRID_ID unconditionally injected into ROOT_ID on tabbed dashboards** -- 
PR #38890 (merged the same day) added a `has_tabs_under_root` guard to 
`_ensure_layout_structure` specifically to prevent GRID_ID from being inserted 
as a sibling of TABS under ROOT_ID, which makes charts invisible on tabbed 
dashboards. This PR removes that guard and unconditionally appends GRID_ID. It 
also deletes the 5 regression tests that were added to protect the fix 
(`test_add_chart_to_tabbed_dashboard_tabs_under_root`, 
`test_ensure_layout_structure_tabs_under_root_no_grid_added`, 
`test_find_tab_insert_target_tabs_under_root`, etc.).
   
   
https://github.com/apache/superset/blob/add213321bf8ccf50767e50a966552439c2a37fd/superset/mcp_service/dashboard/tool/add_chart_to_existing_dashboard.py#L293-L296
   
   2. **`_ensure_session_cleanup()` in `finally` block re-introduces pattern 
removed in PR #37548** -- PR #37548 ("fix(mcp): Instance not bound to session 
error") deliberately removed a nearly identical `finally` block that called 
`db.session.remove()` after every tool call, because it detaches the User 
object from the session and causes "Parent instance is not bound to a Session" 
errors on subsequent permission checks. This PR re-introduces that pattern. 
Additionally, on the error path both `_cleanup_session_on_error()` (in 
`except`) and `_ensure_session_cleanup()` (in `finally`) call `rollback()` + 
`remove()`, resulting in double cleanup.
   
   
https://github.com/apache/superset/blob/add213321bf8ccf50767e50a966552439c2a37fd/superset/mcp_service/auth.py#L407-L421
   
   
https://github.com/apache/superset/blob/add213321bf8ccf50767e50a966552439c2a37fd/superset/mcp_service/auth.py#L513-L515
   
   🤖 Generated with [Claude Code](https://claude.ai/code)
   
   <sub>- If this code review was useful, please react with 👍. Otherwise, react 
with 👎.</sub>


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