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


##########
superset/daos/dashboard.py:
##########
@@ -431,7 +431,8 @@ def update_native_filters_config(
             raise DashboardUpdateFailedError("Dashboard not found")
 
         if attributes:
-            metadata = json.loads(dashboard.json_metadata or "{}")
+            _parsed = json.loads(dashboard.json_metadata or "{}")

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag missing type annotations for internal local variables or 
module-level loggers in Python files when their types are clearly inferred and 
the codebase does not annotate them by convention.
   
   **Applied to:**
     - `**/*.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



##########
superset/daos/dashboard.py:
##########
@@ -431,7 +431,8 @@ def update_native_filters_config(
             raise DashboardUpdateFailedError("Dashboard not found")
 
         if attributes:
-            metadata = json.loads(dashboard.json_metadata or "{}")
+            _parsed = json.loads(dashboard.json_metadata or "{}")
+            metadata = _parsed if isinstance(_parsed, dict) else {}

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag missing type annotations for local variables when the type is 
already inferred correctly and the codebase does not annotate locals of this 
shape.
   
   **Applied to:**
     - `**/*.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



##########
superset/mcp_service/dashboard/tool/manage_native_filters.py:
##########
@@ -0,0 +1,508 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+MCP tool: manage_native_filters
+
+Adds, updates, removes, and reorders native filters on a dashboard by
+translating high-level operations into the ``deleted`` / ``modified`` /
+``reordered`` payload consumed by ``UpdateDashboardNativeFiltersCommand``.
+"""
+
+import copy
+import logging
+from typing import Any, cast
+
+from fastmcp import Context
+from superset_core.mcp.decorators import tool, ToolAnnotations
+
+from superset.extensions import event_logger
+from superset.mcp_service.dashboard.constants import generate_id
+from superset.mcp_service.dashboard.schemas import (
+    FilterSelectSpec,
+    FilterTimeSpec,
+    ManageNativeFiltersRequest,
+    ManageNativeFiltersResponse,
+    NativeFilterSummary,
+    NativeFilterUpdateSpec,
+)
+from superset.mcp_service.utils import (
+    escape_llm_context_delimiters,
+    sanitize_for_llm_context,
+)
+from superset.mcp_service.utils.url_utils import get_superset_base_url
+from superset.utils import json
+
+logger = logging.getLogger(__name__)

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag unannotated module-level logger assignments like `logger = 
logging.getLogger(__name__)` in Python files; this is the standard pattern used 
across the codebase.
   
   **Applied to:**
     - `**/*.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



-- 
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