codeant-ai-for-open-source[bot] commented on code in PR #43482:
URL: https://github.com/apache/superset/pull/43482#discussion_r3846281254
##########
superset/mcp_service/dashboard/schemas.py:
##########
@@ -295,16 +297,45 @@ def _parse_select_columns(cls, value: Any) -> Any:
parsed = parse_json_or_list(value, "select_columns")
return parsed if parsed else list(DEFAULT_GET_DASHBOARD_INFO_COLUMNS)
+ @model_validator(mode="after")
+ def _require_identifier_or_permalink(self) -> "GetDashboardInfoRequest":
+ if self.identifier is None and self.permalink_key is None:
+ raise ValueError("Provide identifier or permalink_key")
Review Comment:
**Suggestion:** These validators only reject `None`, so empty strings such
as `{"identifier": ""}` or `{"permalink_key": ""}` pass validation even though
they represent no usable reference. The downstream resolver treats them as
ordinary identifiers or falsey permalink references, producing misleading
lookup/permalink errors instead of the intended “Provide identifier or
permalink_key” validation error. Reject blank strings after trimming in both
request validators. [incorrect condition logic]
<details>
<summary><b>Severity Level:</b> Minor 🧹</summary>
```mdx
- ⚠️ Blank info requests reach dashboard lookup unnecessarily.
- ⚠️ Blank layout requests return misleading permalink errors.
- ⚠️ Clients receive inconsistent validation guidance.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=de65c58b3f5c449fadc7eb1818865cbe&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=de65c58b3f5c449fadc7eb1818865cbe&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/schemas.py
**Line:** 302:303
**Comment:**
*Incorrect Condition Logic: These validators only reject `None`, so
empty strings such as `{"identifier": ""}` or `{"permalink_key": ""}` pass
validation even though they represent no usable reference. The downstream
resolver treats them as ordinary identifiers or falsey permalink references,
producing misleading lookup/permalink errors instead of the intended “Provide
identifier or permalink_key” validation error. Reject blank strings after
trimming in both request validators.
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%2F43482&comment_hash=bd346c1dabb17777a73b851d729c73065a3f793ca5d920ea0a26db23ad6c3359&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43482&comment_hash=bd346c1dabb17777a73b851d729c73065a3f793ca5d920ea0a26db23ad6c3359&reaction=dislike'>👎</a>
##########
superset/mcp_service/dashboard/tool/get_dashboard_layout.py:
##########
@@ -86,9 +94,40 @@ async def get_dashboard_layout(
supports_slug=True,
logger=logger,
)
- result = core.run_tool(request.identifier)
+ lookup_result = lookup_dashboard_reference(
+ identifier=request.identifier,
+ permalink_key=request.permalink_key,
+ lookup=core.run_tool,
+ is_found=lambda value: isinstance(value, DashboardLayout),
+ )
+ result = lookup_result.result
+ if result is None:
+ # Only reachable when the dashboard had to come from a
permalink,
+ # so an identifier's own "not found" error is preserved below.
+ return DashboardError.create(
+ "Dashboard permalink could not be resolved. It may be
invalid "
+ "or expired; ask for a fresh shared dashboard link.",
+ "permalink_not_found",
+ )
if isinstance(result, DashboardLayout):
+ if lookup_result.permalink_value:
+ permalink_state = get_matching_dashboard_permalink_state(
+ lookup_result, result.id, result.uuid
+ )
Review Comment:
**Suggestion:** Legacy permalinks can store the dashboard slug in
`dashboardId`, but this call verifies the permalink using only `result.id` and
`result.uuid`. Because `DashboardLayout` does not expose the slug, a valid
slug-based permalink is treated as belonging to a different dashboard and its
active-tab/filter state is discarded, unlike `get_dashboard_info`. Include the
dashboard slug in the layout lookup/serialization or otherwise pass it to the
matching check. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Layout permalink state is discarded for legacy slug references.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ac8ab31bb7844250b1cec0b429c20b06&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=ac8ab31bb7844250b1cec0b429c20b06&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/get_dashboard_layout.py
**Line:** 115:117
**Comment:**
*Api Mismatch: Legacy permalinks can store the dashboard slug in
`dashboardId`, but this call verifies the permalink using only `result.id` and
`result.uuid`. Because `DashboardLayout` does not expose the slug, a valid
slug-based permalink is treated as belonging to a different dashboard and its
active-tab/filter state is discarded, unlike `get_dashboard_info`. Include the
dashboard slug in the layout lookup/serialization or otherwise pass it to the
matching check.
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%2F43482&comment_hash=6276a9a18cbb5aae07dde925ccbb2514103fd22d83af1eb059dfce90208aaf61&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43482&comment_hash=6276a9a18cbb5aae07dde925ccbb2514103fd22d83af1eb059dfce90208aaf61&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]