codeant-ai-for-open-source[bot] commented on code in PR #43400:
URL: https://github.com/apache/superset/pull/43400#discussion_r3832460234
##########
superset/widgets/builtin.py:
##########
@@ -140,3 +147,75 @@ def enrich_schema(
style["title"] = value
properties[value] = style
series_prop["properties"] = properties
+
+
+@widget(
+ widget_type="filter.select",
+ name="Filter",
+ description="A value/multi-select dashboard filter.",
+)
+class FilterSelect(Widget):
+ """
+ A leaf ``filter.*`` widget: reads ``datasetId``/``column`` and, at
+ render time, either the author's static ``options`` or the column's own
+ distinct values. Its live selection travels over the widget event bus
+ (``dashboard.emit``/``getValue``), not ``props`` — see the frontend
+ ``FilterSelectWidget`` and ``collectActiveFilters`` — so nothing about
+ that selection lives in this schema.
+ """
+
+ controls_class = FilterSelectControls
+
+ @classmethod
+ def enrich_schema(
+ cls,
+ schema: dict[str, Any],
+ parsed: BaseModel | None,
+ series: list[str], # noqa: ARG003
+ ) -> None:
+ # Unlike `column` below, this doesn't depend on any other field, so
+ # it's populated unconditionally with every dataset the caller can
+ # view — `enum` carries the ids the widget actually stores, and
+ # `x-enumNames` the display names the control panel shows instead
+ # (see `EnumNamesControl` on the frontend).
+ if (dataset_prop := schema.get("properties", {}).get("datasetId")) is
not None:
+ datasets = DatasetDAO.find_all()
+ dataset_prop["enum"] = [dataset.id for dataset in datasets]
+ dataset_prop["x-enumNames"] = [dataset.name for dataset in
datasets]
Review Comment:
**Suggestion:** Schema enrichment performs database queries, lazy-loads
dataset columns, and checks access synchronously, but only catches
`SupersetSecurityException` from `raise_for_access`. A database/SQLAlchemy
failure or another metadata access exception therefore propagates out of
`FilterSelect.enrich_schema`; callers such as the MCP schema tool invoke
`get_control_schema` directly and return an unhandled error instead of the
documented degraded schema. Handle metadata failures consistently with the
existing schema-enrichment fallback, while preserving access-denied behavior.
[possible bug]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ MCP widget-schema requests fail during metadata outages.
- ⚠️ Filter control discovery loses its degraded fallback.
- ✅ REST schema requests already return the base form.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/widgets/builtin.py
**Line:** 181:184
**Comment:**
*Possible Bug: Schema enrichment performs database queries, lazy-loads
dataset columns, and checks access synchronously, but only catches
`SupersetSecurityException` from `raise_for_access`. A database/SQLAlchemy
failure or another metadata access exception therefore propagates out of
`FilterSelect.enrich_schema`; callers such as the MCP schema tool invoke
`get_control_schema` directly and return an unhandled error instead of the
documented degraded schema. Handle metadata failures consistently with the
existing schema-enrichment fallback, while preserving access-denied behavior.
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%2F43400&comment_hash=05bad6a373410e6925e07ba6d6e1d262ddb97eaa99a4ad4b4d80bb4411e2e635&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43400&comment_hash=05bad6a373410e6925e07ba6d6e1d262ddb97eaa99a4ad4b4d80bb4411e2e635&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]