codeant-ai-for-open-source[bot] commented on code in PR #43130:
URL: https://github.com/apache/superset/pull/43130#discussion_r3777054994
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -952,17 +952,31 @@ class FilterConfig(UnknownFieldCheckMixin):
"NOT LIKE",
"IN",
"NOT IN",
+ "IS NULL",
+ "IS NOT NULL",
] = Field(
...,
- description="LIKE/ILIKE use % wildcards. IN/NOT IN take a list.",
+ description=(
+ "LIKE/ILIKE use % wildcards. IN/NOT IN take a list. "
+ "IS NULL/IS NOT NULL omit value."
+ ),
validation_alias=AliasChoices("op", "operator", "opr"),
)
- value: str | int | float | bool | list[str | int | float | bool] = Field(
- ...,
- description="For IN/NOT IN, provide a list.",
+ value: str | int | float | bool | list[str | int | float | bool] | None =
Field(
+ None,
+ description="For IN/NOT IN, provide a list. Omit for null operators.",
validation_alias=AliasChoices("value", "val"),
)
+ @model_validator(mode="after")
+ def validate_value(self) -> "FilterConfig":
+ """Null checks have no comparator; every other operator requires
one."""
+ if self.op in {"IS NULL", "IS NOT NULL"}:
+ self.value = None
Review Comment:
**Suggestion:** For `IS NULL` and `IS NOT NULL`, this silently discards any
supplied comparator instead of rejecting the invalid payload. As a result,
inputs such as a list value are accepted even though the documented contract
says to omit `value`, and malformed input bypasses
`validate_value_type_matches_operator`. Reject non-`None` values for null
operators before constructing the filter. [api mismatch]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Invalid null-filter payloads are silently accepted.
- โ ๏ธ Caller-supplied comparator values are discarded.
- โ ๏ธ MCP clients receive no contract-validation error.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e635d111ced5493787fceaef1f1beed5&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=e635d111ced5493787fceaef1f1beed5&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/chart/schemas.py
**Line:** 974:975
**Comment:**
*Api Mismatch: For `IS NULL` and `IS NOT NULL`, this silently discards
any supplied comparator instead of rejecting the invalid payload. As a result,
inputs such as a list value are accepted even though the documented contract
says to omit `value`, and malformed input bypasses
`validate_value_type_matches_operator`. Reject non-`None` values for null
operators before constructing the filter.
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%2F43130&comment_hash=076b29492f028fee620e16b19e6622e35c60edc52e265a6bbc21b2643b959664&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43130&comment_hash=076b29492f028fee620e16b19e6622e35c60edc52e265a6bbc21b2643b959664&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]