aminghadersohi opened a new pull request, #44985: URL: https://github.com/apache/superset/pull/44985
### SUMMARY `manage_native_filters` can create and update `filter_select` (dropdown) native filters, but had no way to give one a default value: create always hardcoded an empty `defaultDataMask`, and update could only set a default for `filter_time` filters via `default_time_range`. This adds a `default_value` field to both the create spec (`FilterSelectSpec`) and the update spec (`NativeFilterUpdateSpec`) for `filter_select` filters. The `defaultDataMask` is built with the same logic `apply_dashboard_filters` already uses for applied filter values (moved into a shared helper in `manage_native_filters.py` so both paths stay in sync), including its existing guards (single-select filters reject more than one value, inverse-selection / non-exact operators are rejected). `default_to_first_item` and an explicit `default_value` are mutually exclusive, matching the dashboard UI's own constraint — setting both on create raises a validation error, and an update that would leave both effectively enabled (either by setting both in the same call, or setting `default_value` while a prior `default_to_first_item=True` survives the merge) is rejected with a message telling the caller to also pass `default_to_first_item=False`. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — MCP tool schema/behavior change, no UI. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/mcp_service/dashboard/tool/test_manage_native_filters.py` — new coverage for create/update with `default_value`, the single-select overflow guard, the `default_to_first_item` mutual-exclusion checks (both at the schema level and at update-merge time), and clearing a default with an empty list. - `pytest tests/unit_tests/mcp_service/dashboard/tool/test_apply_dashboard_filters.py` — unchanged behavior after the shared builder was relocated. - `pytest tests/unit_tests/mcp_service/dashboard/` and `tests/unit_tests/mcp_service/test_rbac_tool_enforcement.py` — full regression pass (730 tests). ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [x] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
