codeant-ai-for-open-source[bot] commented on code in PR #41855:
URL: https://github.com/apache/superset/pull/41855#discussion_r3565553581
##########
tests/unit_tests/mcp_service/test_mcp_core.py:
##########
@@ -312,3 +312,19 @@ def test_explicit_title_column_overrides_dao_attribute()
-> None:
)
def test_slugify_handles_edge_cases(identifier: str, expected_slug: str) ->
None:
assert _slugify(identifier) == expected_slug
+
+
+def test_deleted_state_bound_filter_delegates_bound_value() -> None:
+ """The adapter passed to DAO custom_filters must forward the bound
+ deleted_state value — BaseDAO.list invokes custom filters with
+ ``apply(query, None)``, which the FAB filter would treat as 'live only'."""
+ from unittest.mock import Mock
+
+ from superset.mcp_service.mcp_core import DeletedStateBoundFilter
+
+ inner = Mock()
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag local variables with inferable types for missing type
annotations in Python; this is acceptable when mypy passes.
**Applied to:**
- `**/*.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
tests/unit_tests/mcp_service/test_mcp_core.py:
##########
@@ -312,3 +312,19 @@ def test_explicit_title_column_overrides_dao_attribute()
-> None:
)
def test_slugify_handles_edge_cases(identifier: str, expected_slug: str) ->
None:
assert _slugify(identifier) == expected_slug
+
+
+def test_deleted_state_bound_filter_delegates_bound_value() -> None:
+ """The adapter passed to DAO custom_filters must forward the bound
+ deleted_state value — BaseDAO.list invokes custom filters with
+ ``apply(query, None)``, which the FAB filter would treat as 'live only'."""
+ from unittest.mock import Mock
+
+ from superset.mcp_service.mcp_core import DeletedStateBoundFilter
+
+ inner = Mock()
+ inner.apply.return_value = "filtered-query"
+ bound = DeletedStateBoundFilter(inner, "only", model=Mock)
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag unannotated local variables or dictionaries when the type is
easily inferable and the codebase already follows that style; if mypy passes,
this is acceptable.
**Applied to:**
- `**/*.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
superset/mcp_service/mcp_core.py:
##########
@@ -326,17 +381,40 @@ def run_tool(
self._validate_order_column(order_column)
+ deleted_state_bound = self._build_deleted_state_filter(deleted_state)
+ if deleted_state_bound is not None:
+ # Trashed rows must be distinguishable from live ones (matters in
+ # "include" mode), so force deleted_at into the loaded columns
+ # and the serialization allowlist.
+ for column_list in (columns_requested, columns_to_load):
+ if "deleted_at" not in column_list:
+ column_list.append("deleted_at")
+
# Query the DAO
items: List[Any]
- items, total_count = self._call_dao_list(
- filters=filters,
- order_column=order_column or "changed_on",
- order_direction=str(order_direction or "desc"),
- page=page,
- page_size=page_size,
- search=search,
- columns_to_load=columns_to_load,
- )
+ dao_kwargs = {
+ "filters": filters,
+ "order_column": order_column or "changed_on",
+ "order_direction": str(order_direction or "desc"),
+ "page": page,
+ "page_size": page_size,
+ "search": search,
+ "columns_to_load": columns_to_load,
+ }
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag unannotated local dictionaries or other variables with
inferable types in Python files when the codebase intentionally relies on type
inference and mypy passes.
**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]