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

   ### SUMMARY
   
   Recreates and supersedes closed PR #43268 after its head repository was 
removed. This PR is explicitly based on `apache/superset:master`.
   
   Adds a distinct, feature-gated MCP adapter for Preset's 
`ag-grid-pivot-table` visualization. This deliberately does **not** alias 
Interactive Pivot to the OSS `pivot_table_v2` adapter.
   
   The new `interactive_pivot` schema and plugin cover:
   
   - AG Grid row groups, pivot columns, metrics, metric aggregation, 
totals/subtotals, formats, filters, sorting, and cell/series limits
   - persisted `pivot_table_state` for the Rows, Column Labels, and Values 
side-panel buckets
   - unsupported time-comparison fields are intentionally omitted until the 
Preset visualization consumes them, preventing false-success chart generation
   - schema discovery and examples, generated names, capabilities/semantics, 
and tabular chart-data handling
   - update/preview preservation of UI-managed AG Grid state while replacing 
declarative grouping and aggregation state
   - fail-closed availability through Preset's `AG_GRID_PIVOT_TABLE_ENABLED` 
feature flag plus the existing MCP plugin filter, so OSS-only deployments do 
not advertise an unavailable visualization
   
   This implements the supported Interactive Pivot portion of 
[SC-113786](https://app.shortcut.com/preset/story/113786) and records the true 
AG Grid pivot as distinct from the OSS Pivot Table V2 delivered under 
SC-100129. Time comparison remains a visualization-side prerequisite: the 
Preset plugin does not consume `time_compare` or `comparison_type`, so the MCP 
does not advertise those controls.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable. This changes MCP schemas and form-data generation; it does 
not add or modify UI components.
   
   ### TESTING INSTRUCTIONS
   
   1. Enable `AG_GRID_PIVOT_TABLE_ENABLED` on a host that registers Preset's 
Interactive Pivot plugin.
   2. Call `get_chart_type_schema("interactive_pivot")` and verify the schema 
and examples are returned.
   3. Generate an Interactive Pivot with rows, columns, metrics, and totals; 
verify the Explore URL uses `viz_type=ag-grid-pivot-table` and its persisted 
grid state populates the AG Grid side-panel buckets.
   4. Update an existing Interactive Pivot and verify its concrete viz type 
remains `ag-grid-pivot-table` and UI-managed grid state such as 
sizing/filter/sort state is retained.
   5. Disable the feature flag and verify schema discovery and generation 
return `DISABLED_CHART_TYPE` rather than offering a broken chart.
   
   Automated validation run:
   
   ```bash
   PYTHONPATH="$PWD/superset-core/src:$PWD" pytest -q 
tests/unit_tests/mcp_service/chart
   # 1307 passed on the original reviewed PR
   
   PYTHONPATH="$PWD/superset-core/src:$PWD" pytest -q \
     tests/unit_tests/mcp_service/chart/test_interactive_pivot_chart.py \
     tests/unit_tests/mcp_service/chart/test_chart_utils.py \
     tests/unit_tests/mcp_service/chart/tool/test_get_chart_type_schema.py \
     tests/unit_tests/mcp_service/chart/tool/test_update_chart_preview.py
   # 227 passed after rebasing onto the latest apache/superset master
   
   pre-commit run --from-ref origin/master --to-ref HEAD
   # Passed
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: 
[SC-113786](https://app.shortcut.com/preset/story/113786)
   - [x] Required feature flags: `AG_GRID_PIVOT_TABLE_ENABLED`
   - [ ] 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
   
   #### AI behavior / evaluation evidence
   
   This is a deterministic schema, validation, and form-data mapping change. 
Unit tests cover schema examples, exact native viz resolution, feature-gated 
availability, validation, omission of unsupported comparison fields, side-panel 
state, update/preview preservation, capabilities, and generated naming. No 
model prompt, routing, retrieval, or sampling behavior changes.
   
   #### Cost and latency
   
   No additional model calls or network requests are introduced. Availability 
checks are in-process feature-flag lookups; chart mapping remains deterministic 
and local.
   


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