bito-code-review[bot] commented on PR #44337:
URL: https://github.com/apache/superset/pull/44337#issuecomment-5693998156
<!-- Bito Reply -->
The flagged issue is correct. In Python, `bool` is a subclass of `int`, so
`cache_timeout=True` is coerced to `1`, which silently sets the cache timeout
to 1 second instead of raising a validation error. To resolve this, you should
add a field validator to `UpdateDatasetRequest` in
`superset/mcp_service/dataset/schemas.py` to explicitly reject boolean values
for `cache_timeout`, similar to how `dataset_id` is handled.
Would you like me to implement this fix and check the rest of the PR
comments for similar issues?
**superset/mcp_service/dataset/schemas.py**
```
@field_validator("cache_timeout", mode="before")
@classmethod
def reject_bool_cache_timeout(cls, value: object) -> object:
"""bool is a subclass of int, so cache_timeout=true would coerce to
1 second; reject it outright."""
if isinstance(value, bool):
raise ValueError("cache_timeout must be an integer or null")
return value
```
--
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]