codeant-ai-for-open-source[bot] commented on code in PR #44096:
URL: https://github.com/apache/superset/pull/44096#discussion_r3975296400
##########
superset/mcp_service/dashboard/permalink.py:
##########
@@ -100,6 +107,31 @@ def get_dashboard_permalink(
return (key, value) if value else None
+def build_dashboard_permalink_url(key: str) -> str:
+ """Return the absolute shared URL for a dashboard permalink key.
+
+ ``/dashboard/p/<key>/`` is the canonical route (``Superset.dashboard_
+ permalink``, mounted at the application root); the ``/superset``-prefixed
+ form is a legacy path that only redirects here.
+ """
+ return f"{get_superset_base_url()}/dashboard/p/{key}/"
Review Comment:
**Suggestion:** `build_dashboard_permalink_url` can return
`http://localhost:9001` and omits `APPLICATION_ROOT`, so MCP clients receive
unusable links in deployments with another host or subdirectory. [api mismatch]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3f43dbc20fca42f9a0ddc7eac10d144c&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=3f43dbc20fca42f9a0ddc7eac10d144c&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/permalink.py
**Line:** 117:117
**Comment:**
*Api Mismatch: `build_dashboard_permalink_url` can return
`http://localhost:9001` and omits `APPLICATION_ROOT`, so MCP clients receive
unusable links in deployments with another host or subdirectory.
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%2F44096&comment_hash=748c6892685fe3cdadf279c4e7967a6ee449c87390b86503c9fa223b1950dcc3&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44096&comment_hash=748c6892685fe3cdadf279c4e7967a6ee449c87390b86503c9fa223b1950dcc3&reaction=dislike'>๐</a>
##########
superset/realtime/publish.py:
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Neutral publisher for the shared realtime envelope protocol."""
+
+from typing import Any
+
+from flask import current_app, Flask
+
+
+def get_realtime_channel(app: Flask | None = None) -> str:
+ """Resolve the deployment channel once per app, including callable
prefixes."""
+ app = app if app is not None else current_app
+ channel = app.extensions.get("realtime_channel")
+ if isinstance(channel, str):
+ return channel
+ prefix = app.config.get("REALTIME_CHANNEL_PREFIX", "")
+ channel = f"{prefix() if callable(prefix) else prefix}realtime"
+ app.extensions["realtime_channel"] = channel
Review Comment:
**Suggestion:** Concurrent first calls can evaluate a callable
`REALTIME_CHANNEL_PREFIX` multiple times and cache different results, so
publishers may use inconsistent channels. [race condition]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9c5a90510b5c4e6fa59d13a7c6d0d784&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=9c5a90510b5c4e6fa59d13a7c6d0d784&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/realtime/publish.py
**Line:** 27:32
**Comment:**
*Race Condition: Concurrent first calls can evaluate a callable
`REALTIME_CHANNEL_PREFIX` multiple times and cache different results, so
publishers may use inconsistent channels.
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%2F44096&comment_hash=bd69ce1106bfa5c3189e3bfef1e7940085e056149434ecf0a80052803c78f077&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44096&comment_hash=bd69ce1106bfa5c3189e3bfef1e7940085e056149434ecf0a80052803c78f077&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]