codeant-ai-for-open-source[bot] commented on code in PR #43688:
URL: https://github.com/apache/superset/pull/43688#discussion_r3887494252
##########
superset/mcp_service/dashboard/tool/get_dashboard_info.py:
##########
@@ -214,6 +219,15 @@ async def get_dashboard_info(
"permalink_key provided but no permalink found. "
"The permalink may have expired or is invalid."
)
+ elif request.filter_state:
+ # Filter context supplied directly (no permalink), e.g.
embedded.
+ await ctx.info("Applying caller-supplied filter_state")
+ filter_state = request.filter_state
Review Comment:
**Suggestion:** Using truthiness skips valid empty filter-state objects.
Since the schema accepts `{}` as a non-null `filter_state`, callers
representing an empty or cleared filter context receive no `filter_state` in
the result and the direct-state path is silently ignored. Check
`request.filter_state is not None` instead. [falsy zero check]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Cleared filter contexts are not represented in responses.
- ⚠️ Embedded callers cannot distinguish empty state from absent state.
- ⚠️ Direct `filter_state` behavior differs for empty versus nonempty
dictionaries.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d674f29e4af54c4aa8330bb45937e34b&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=d674f29e4af54c4aa8330bb45937e34b&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_info.py
**Line:** 222:225
**Comment:**
*Falsy Zero Check: Using truthiness skips valid empty filter-state
objects. Since the schema accepts `{}` as a non-null `filter_state`, callers
representing an empty or cleared filter context receive no `filter_state` in
the result and the direct-state path is silently ignored. Check
`request.filter_state is not None` instead.
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%2F43688&comment_hash=8e2e7ab425c44734064db256d1f690a55c8de6e1ba1cab14f26e3c9937d33864&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43688&comment_hash=8e2e7ab425c44734064db256d1f690a55c8de6e1ba1cab14f26e3c9937d33864&reaction=dislike'>👎</a>
##########
superset/mcp_service/dashboard/tool/get_dashboard_info.py:
##########
@@ -226,11 +240,11 @@ async def get_dashboard_info(
result.is_permalink_state,
)
)
- # When permalink_key is supplied and the caller did not explicitly
- # override select_columns, ensure filter_state is present so the
- # caller gets the data they came for.
+ # When filter state is present (from a permalink or supplied
+ # directly) and the caller did not override select_columns, ensure
+ # filter_state is in the response so they get the data they came
for.
effective_select_columns = list(request.select_columns)
- if result.is_permalink_state and effective_select_columns == list(
+ if result.filter_state is not None and effective_select_columns ==
list(
DEFAULT_GET_DASHBOARD_INFO_COLUMNS
):
effective_select_columns.append("filter_state")
Review Comment:
**Suggestion:** The equality check cannot distinguish an omitted
`select_columns` value from an explicitly supplied list that happens to equal
the defaults. As a result, callers who explicitly request the default columns
unexpectedly receive `filter_state`, violating the select-column response
contract. Track whether the field was explicitly provided, or only auto-append
it when the request omitted `select_columns`. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Explicit column projections return unexpected filter state.
- ⚠️ Responses may contain unnecessary sensitive or large state data.
- ⚠️ MCP clients cannot rely on exact `select_columns` filtering.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=289f3412183e418498af61458246ca45&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=289f3412183e418498af61458246ca45&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_info.py
**Line:** 246:250
**Comment:**
*Api Mismatch: The equality check cannot distinguish an omitted
`select_columns` value from an explicitly supplied list that happens to equal
the defaults. As a result, callers who explicitly request the default columns
unexpectedly receive `filter_state`, violating the select-column response
contract. Track whether the field was explicitly provided, or only auto-append
it when the request omitted `select_columns`.
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%2F43688&comment_hash=2244b8c561c3b4b84197bb945141ad9485a28850c2078131169db482af41b7f3&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43688&comment_hash=2244b8c561c3b4b84197bb945141ad9485a28850c2078131169db482af41b7f3&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]