You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/03 23:31:59 UTC

(superset) branch tdd/issue-42580-mcp-false-positive-error-logging created (now 1cd975476af)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch tdd/issue-42580-mcp-false-positive-error-logging
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 1cd975476af test(mcp): pin _is_error_response against error_type:null in success payloads (#42580)

This branch includes the following new commits:

     new 1cd975476af test(mcp): pin _is_error_response against error_type:null in success payloads (#42580)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: test(mcp): pin _is_error_response against error_type:null in success payloads (#42580)

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch tdd/issue-42580-mcp-false-positive-error-logging
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1cd975476af5cc87d257d839f5ce1d00107e9e80
Author: Claude Code <no...@anthropic.com>
AuthorDate: Mon Aug 3 16:30:44 2026 -0700

    test(mcp): pin _is_error_response against error_type:null in success payloads (#42580)
    
    LoggingMiddleware._is_error_response substring-matches for the literal
    "error_type" key, but response schemas like ExecuteSqlResponse always
    serialize an "error_type" field (null on success), so every successful
    execute_sql call is misclassified as a failure and logged with
    success=False.
---
 .../unit_tests/mcp_service/test_middleware_logging.py  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/unit_tests/mcp_service/test_middleware_logging.py b/tests/unit_tests/mcp_service/test_middleware_logging.py
index eed0334648e..4d667e310f9 100644
--- a/tests/unit_tests/mcp_service/test_middleware_logging.py
+++ b/tests/unit_tests/mcp_service/test_middleware_logging.py
@@ -559,6 +559,24 @@ class TestIsErrorResponse:
         middleware = LoggingMiddleware()
         assert middleware._is_error_response(ToolResult(content=[])) is False
 
+    def test_success_response_with_null_error_type_not_detected_as_error(
+        self,
+    ) -> None:
+        """Regression for #42580: response schemas like ExecuteSqlResponse
+        declare "error"/"error_type" as always-present nullable fields, so a
+        fully successful response still serializes the literal "error_type"
+        substring (as "error_type":null). The substring check must not treat
+        that the same as an actual error schema payload with a non-null
+        error_type value."""
+        middleware = LoggingMiddleware()
+        success_json = (
+            '{"success": true, "rows": [{"database": "bronze_layer", '
+            '"tables": 161}], "row_count": 1, "error": null, '
+            '"error_type": null}'
+        )
+        result = ToolResult(content=[mt.TextContent(type="text", text=success_json)])
+        assert middleware._is_error_response(result) is False
+
     @patch("superset.mcp_service.middleware.event_logger")
     @patch("superset.mcp_service.middleware.get_user_id", return_value=42)
     @pytest.mark.asyncio