codeant-ai-for-open-source[bot] commented on code in PR #43843:
URL: https://github.com/apache/superset/pull/43843#discussion_r3930003258
##########
superset-websocket/src/index.ts:
##########
@@ -193,11 +193,13 @@ export const wss = new WebSocketServer({
const SOCKET_ACTIVE_STATES: number[] = [WebSocket.OPEN, WebSocket.CONNECTING];
// The single Pub/Sub channel the server tails. This is a wire-protocol
contract
-// with the Superset producer (superset/tasks/manager.py: REALTIME_CHANNEL),
NOT a
-// deployment knob - an independent override on this side with no matching
producer
-// config would silently subscribe to a channel nothing publishes to, so it is
a
-// fixed constant that must stay in lockstep with the producer.
-const REALTIME_CHANNEL = 'realtime';
+// with the Superset producer (superset/tasks/manager.py). The name is
+// `${prefix}realtime`, where the prefix comes from REALTIME_CHANNEL_PREFIX
(empty
+// by default). Redis Pub/Sub is not scoped by DB number, so deployments
sharing
+// one Redis/Valkey set a per-deployment prefix to isolate their channels โ it
MUST
+// be set identically here and on the producer (Flask REALTIME_CHANNEL_PREFIX),
+// since a mismatch would subscribe to a channel nothing publishes to.
+const REALTIME_CHANNEL = `${opts.realtimeChannelPrefix}realtime`;
Review Comment:
**Suggestion:** Producers may resolve a callable prefix differently for each
publish, but this import-time channel remains fixed, causing the websocket
server to miss messages on later channels. [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=ecf71564e7644387bf205c25ca70da6c&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=ecf71564e7644387bf205c25ca70da6c&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-websocket/src/index.ts
**Line:** 202:202
**Comment:**
*Api Mismatch: Producers may resolve a callable prefix differently for
each publish, but this import-time channel remains fixed, causing the websocket
server to miss messages on later 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%2F43843&comment_hash=ad8c10ddd69c798aee320bd2256533e507e732c5d7c43c0b2c49d1802ea41eaf&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43843&comment_hash=ad8c10ddd69c798aee320bd2256533e507e732c5d7c43c0b2c49d1802ea41eaf&reaction=dislike'>๐</a>
##########
superset-websocket/src/config.ts:
##########
@@ -144,6 +146,7 @@ function applyEnvOverrides(config: ConfigType): ConfigType {
JWT_SECRET: val => (config.jwtSecret = val),
PREVIOUS_JWT_SECRET: val => (config.previousJwtSecret = val),
JWT_COOKIE_NAME: val => (config.jwtCookieName = val),
+ REALTIME_CHANNEL_PREFIX: val => (config.realtimeChannelPrefix = val),
Review Comment:
**Suggestion:** Because empty environment values are skipped by
`applyEnvOverrides`, `REALTIME_CHANNEL_PREFIX=""` cannot clear a nonempty
prefix loaded from the config file. [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=b9e35979e2d34af1bc7ffc75e5abca14&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=b9e35979e2d34af1bc7ffc75e5abca14&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-websocket/src/config.ts
**Line:** 149:149
**Comment:**
*Api Mismatch: Because empty environment values are skipped by
`applyEnvOverrides`, `REALTIME_CHANNEL_PREFIX=""` cannot clear a nonempty
prefix loaded from the config file.
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%2F43843&comment_hash=c8e420039e8e4b1a240467f0b7b5db2627dbb63ae5d4e34f00d6bae1be1ab8e0&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43843&comment_hash=c8e420039e8e4b1a240467f0b7b5db2627dbb63ae5d4e34f00d6bae1be1ab8e0&reaction=dislike'>๐</a>
##########
superset/tasks/manager.py:
##########
@@ -128,6 +133,19 @@ def init_app(cls, app: Flask) -> None:
SCOPE_PRINCIPAL = "principal"
SCOPE_TAB = "tab"
+ @classmethod
+ def get_realtime_channel(cls) -> str:
+ """Resolve the realtime pub/sub channel name (prefix + base).
+
+ The prefix may be a string or a zero-argument callable (resolved here
at
+ call time), so a deployment sharing a Redis/Valkey with others can
+ namespace the channel to avoid cross-tenant delivery.
+ """
+ prefix = cls._realtime_channel_prefix
+ if callable(prefix):
+ prefix = prefix()
+ return f"{prefix}{cls._REALTIME_CHANNEL_BASE}"
Review Comment:
**Suggestion:** The callable prefix may resolve to different values for
different publishes, while the websocket server subscribes to one fixed
channel, causing those realtime messages to be lost. [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=2e6a887d4d6b4c35a752a7f88a5e8d15&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=2e6a887d4d6b4c35a752a7f88a5e8d15&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/tasks/manager.py
**Line:** 144:147
**Comment:**
*Api Mismatch: The callable prefix may resolve to different values for
different publishes, while the websocket server subscribes to one fixed
channel, causing those realtime messages to be lost.
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%2F43843&comment_hash=a8c1114553e56cbf341c87994bb7facc2ce1425147a01fe0b7619ba486e388be&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43843&comment_hash=a8c1114553e56cbf341c87994bb7facc2ce1425147a01fe0b7619ba486e388be&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]