aminghadersohi opened a new pull request, #45021:
URL: https://github.com/apache/superset/pull/45021

   ### SUMMARY
   `manage_native_filters` can create `filter_select`, `filter_time`, 
`filter_range`, and `filter_timegrain` native filters, but had no way to create 
a filter-bar **divider** (a title/description-only visual separator used to 
group related filters). This adds a `divider` entry to the create union.
   
   A divider's stored shape differs from a regular filter's: it keeps its 
display text under `title` (not `name`), has no 
`filterType`/`targets`/`controlValues`, and is keyed by a 
`NATIVE_FILTER_DIVIDER-` id instead of `NATIVE_FILTER-` — matching exactly what 
the frontend's filter config modal already writes (see `transformDivider` in 
`filterTransformer.ts`). The new `DividerSpec` in `manage_native_filters.py`'s 
`_build_new_filter_config` produces that same shape so a divider created 
through MCP is indistinguishable from one created through the UI.
   
   `reorder` already orders entries purely by filter ID regardless of type, so 
no changes were needed there for dividers to be interleaved with filters — 
added test coverage confirms it.
   
   While wiring this up I found two related read/update-path gaps for dividers 
already on a dashboard (e.g. created through the UI):
   - `get_dashboard_info`'s native filter projection 
(`_extract_native_filters`) and the tool's own filter summary 
(`_filter_summary`) read `name`/`filterType`, which a divider doesn't have — 
both showed up as `null`/`null`. Both now report the divider's `title` as 
`name` and a `"divider"` `filter_type`.
   - `update`'s `name` field was written into `merged["name"]` unconditionally, 
which would silently fail to rename a divider (whose field is `title`). 
Updating a divider's `name` now writes `title` instead, and the update path 
also no longer adds an empty `controlValues` key to a divider's config.
   
   ### TESTING INSTRUCTIONS
   - `PYTHONPATH=superset-core/src pytest 
tests/unit_tests/mcp_service/dashboard/tool/test_manage_native_filters.py 
tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py 
tests/unit_tests/mcp_service/test_tool_inventory.py -q`
   - Manually: call `manage_native_filters` with `add: [{"filter_type": 
"divider", "name": "Geography", "description": "Location filters"}]` on a 
dashboard, then `reorder` to interleave the new divider's id with existing 
filter ids, then `get_dashboard_info` to confirm it shows up with `filter_type: 
"divider"`.
   
   ### 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
   - [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]

Reply via email to