codeant-ai-for-open-source[bot] commented on code in PR #44405:
URL: https://github.com/apache/superset/pull/44405#discussion_r4043253251
##########
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:
**Suggestion:** Layouts without a valid `ROOT_ID` reach this call unchanged,
so their charts keep missing or stale `parents` and filter scopes remain empty.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Incomplete
implementation`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9c6744130b054d388bf36febb5fae5f0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=9c6744130b054d388bf36febb5fae5f0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/dashboard/tool/generate_dashboard.py
**Line:** 280:280
**Comment:**
*Incomplete Implementation: Layouts without a valid `ROOT_ID` reach
this call unchanged, so their charts keep missing or stale `parents` and filter
scopes remain empty.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44405&comment_hash=22f4820d82ce6858a74da98f1680c01aa56929eeb5fc383c301ae08b39410a69&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44405&comment_hash=22f4820d82ce6858a74da98f1680c01aa56929eeb5fc383c301ae08b39410a69&reaction=dislike'>๐</a>
--
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]