richardfogaca opened a new pull request, #39891: URL: https://github.com/apache/superset/pull/39891
### SUMMARY - Warn when `update_chart_preview` receives a previous `form_data_key` that cannot be loaded from cached form data. - Keep preview generation successful for that case, preserving `success: true`, `error: null`, and the returned replacement preview `form_data_key`. - Reuse the loaded previous form data for existing `adhoc_filters` preservation when the new chart config does not supply filters. - Add unit coverage for both the invalid-key warning path and the valid-cache filter preservation path. ### BEFORE AND AFTER SCREENSHOTS OR ANIMATED GIF Not applicable - backend MCP tool response change. Before this change, a preview update with a fabricated previous `form_data_key` succeeded and returned a new preview key without indicating that previous cached chart state was unavailable. After this change, the same successful response includes a top-level `warnings` entry explaining that the previous cached chart state could not be loaded and that the preview was generated from the supplied config only. ### TESTING INSTRUCTIONS - [x] `pytest tests/unit_tests/mcp_service/chart/tool/test_update_chart_preview.py -q` - [x] Manual MCP check: call `update_chart_preview` with a fabricated previous `form_data_key`, dataset id `3`, a table config, `generate_preview: true`, and `preview_formats: ["table"]`; confirm the response keeps `success: true`, keeps `error: null`, returns a new preview `form_data_key`, and includes the missing previous cached state warning. ### ADDITIONAL INFORMATION - [ ] Has associated issue: Not applicable - no public Apache Superset 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]
