codeant-ai-for-open-source[bot] commented on code in PR #37183:
URL: https://github.com/apache/superset/pull/37183#discussion_r2706616221
##########
superset/mcp_service/dashboard/tool/get_dashboard_info.py:
##########
@@ -28,6 +28,8 @@
from fastmcp import Context
from superset_core.mcp import tool
+from superset.dashboards.permalink.exceptions import
DashboardPermalinkGetFailedError
+from superset.dashboards.permalink.types import DashboardPermalinkValue
Review Comment:
**Suggestion:** Incorrect import module paths: the code imports
`DashboardPermalinkGetFailedError` and `DashboardPermalinkValue` from
`superset.dashboards.permalink.*` but the permalink command lives under
`superset.commands.dashboard.permalink`; import from
`superset.commands.dashboard.permalink.exceptions` and
`superset.commands.dashboard.permalink.types` to match the actual package
locations and avoid ImportError at module import time. [possible bug]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ MCP service fails to import get_dashboard_info tool.
- ❌ get_dashboard_info FastMCP endpoint unavailable.
- ❌ MCP startup can fail due to ImportError.
```
</details>
```suggestion
from superset.commands.dashboard.permalink.exceptions import (
DashboardPermalinkGetFailedError,
)
from superset.commands.dashboard.permalink.types import
DashboardPermalinkValue
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Start the MCP service (via `superset/cli/mcp.py:32-44`) which imports MCP
tool modules.
2. Python imports
`superset/mcp_service/dashboard/tool/get_dashboard_info.py` and executes
top-level imports at lines 31-32.
3. The current imports attempt `from superset.dashboards.permalink...`
(lines 31-32). The
actual permalink command and types live under
`superset.commands.dashboard.permalink` (see
`superset/commands/dashboard/permalink/get.py:38-63`), so the import path is
incorrect and
raises ImportError at module import time.
4. Result: MCP module load fails, the `get_dashboard_info` tool is
unavailable and the MCP
service startup can fail.
```
</details>
<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_info.py
**Line:** 31:32
**Comment:**
*Possible Bug: Incorrect import module paths: the code imports
`DashboardPermalinkGetFailedError` and `DashboardPermalinkValue` from
`superset.dashboards.permalink.*` but the permalink command lives under
`superset.commands.dashboard.permalink`; import from
`superset.commands.dashboard.permalink.exceptions` and
`superset.commands.dashboard.permalink.types` to match the actual package
locations and avoid ImportError at module import time.
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.
```
</details>
--
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]