codeant-ai-for-open-source[bot] commented on code in PR #44405:
URL: https://github.com/apache/superset/pull/44405#discussion_r4045976330


##########
superset/mcp_service/dashboard/tool/generate_dashboard.py:
##########
@@ -264,11 +267,17 @@ def generate_dashboard(  # noqa: C901
                     )
 
         # Create dashboard layout with chart objects.
-        # If the caller provided an explicit position_json, use it verbatim;
-        # otherwise auto-generate a packed-grid layout from the chart ids.
+        # If the caller provided an explicit position_json, use its
+        # children/meta as given; otherwise auto-generate a packed-grid
+        # layout from the chart ids (which already carries correct parents).
         with event_logger.log_context(action="mcp.generate_dashboard.layout"):
             if request.position_json:
-                layout = request.position_json
+                # A caller-supplied layout may carry only an immediate
+                # parent (or omit `parents` altogether); rebuild the full
+                # ancestor chains so server-side filter-scope derivation
+                # sees the same tree the frontend would after hydration.
+                # See superset.dashboards.filter_scope.get_chart_ids_in_scope.
+                layout = rebuild_parent_chains(request.position_json)

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag layouts without a ROOT_ID as an incomplete implementation in 
rebuild_parent_chains; preserving the no-op behavior matches the frontend and 
avoids fabricating ancestry.
   
   **Applied to:**
     - `superset/mcp_service/dashboard/tool/generate_dashboard.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



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