codeant-ai-for-open-source[bot] commented on code in PR #41923:
URL: https://github.com/apache/superset/pull/41923#discussion_r3618994740


##########
tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py:
##########
@@ -52,3 +55,15 @@ def test_get_dataset_info_select_columns_columns_alias(self) 
-> None:
     def test_list_datasets_select_columns_columns_alias(self) -> None:
         req = ListDatasetsRequest.model_validate({"columns": ["id", 
"table_name"]})
         assert req.select_columns == ["id", "table_name"]
+
+    def test_list_datasets_search_and_filters_conflict_validation(self) -> 
None:
+        """search and filters are mutually exclusive on ListDatasetsRequest,
+        inherited from PaginatedListRequest.validate_search_and_filters."""
+        with pytest.raises(
+            ValueError,
+            match="Cannot use both 'search' and 'filters' parameters 
simultaneously",
+        ):

Review Comment:
   **Suggestion:** This assertion is checking for the wrong exception type: 
Pydantic model validation errors are raised as `ValidationError`, even when an 
internal validator raises `ValueError`. As written, this test will fail despite 
correct validation behavior. Update the expected exception type to 
`ValidationError`. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ Dataset conflict-validation test fails despite correct behavior.
   - ⚠️ MCP dataset schema test suite may block CI runs.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. In `tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py:59-69`, 
run
   
`TestRequestSchemaAliasChoices.test_list_datasets_search_and_filters_conflict_validation`.
   
   2. The test constructs `ListDatasetsRequest(...)` with both `search` and 
`filters`
   arguments (line 66-69), which invokes the Pydantic model defined in
   `superset/mcp_service/dataset/schemas.py` that inherits 
`PaginatedListRequest` from
   `superset/mcp_service/common/pagination_schemas.py`.
   
   3. The `PaginatedListRequest.validate_search_and_filters` validator in
   `common/pagination_schemas.py` raises `ValueError` internally when both 
parameters are
   present; Pydantic wraps this into a `ValidationError` that is raised from
   `ListDatasetsRequest.__init__` / `model_validate`.
   
   4. Because the test’s context manager at
   `tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py:62-65` is
   `pytest.raises(ValueError, ...)`, the actual `ValidationError` does not 
match the expected
   type and the test fails even though the model correctly rejects the 
conflicting inputs.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=aac78d62b00f4925b5ec1e75e94a347b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=aac78d62b00f4925b5ec1e75e94a347b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/dataset/test_dataset_schemas.py
   **Line:** 62:65
   **Comment:**
        *Logic Error: This assertion is checking for the wrong exception type: 
Pydantic model validation errors are raised as `ValidationError`, even when an 
internal validator raises `ValueError`. As written, this test will fail despite 
correct validation behavior. Update the expected exception type to 
`ValidationError`.
   
   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%2F41923&comment_hash=7a3a35eaef4b5beb207822f93c29180575c9949ec846361ab8aa8906f863395e&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41923&comment_hash=7a3a35eaef4b5beb207822f93c29180575c9949ec846361ab8aa8906f863395e&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]

Reply via email to