aminghadersohi opened a new pull request, #42824: URL: https://github.com/apache/superset/pull/42824
### SUMMARY `get_chart_data` previously selected only the first entry returned by `ChartDataCommand`, which dropped secondary results from charts whose query context contains multiple queries. This change preserves the existing top-level `columns`, `data`, and row metadata as the first-query view for backward compatibility, and adds an optional `query_results` field containing every query result for multi-query charts. Single-query charts retain their existing behavior. Response-size enforcement applies one shared row cap across the complete multi-query response so additional results cannot bypass the configured token limit. Mixed Timeseries is the chart type that explicitly builds two queries in the MCP chart query helper. The response handling also covers any saved query context containing multiple queries rather than coupling serialization to that visualization type. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable; this changes an MCP tool response without UI changes. ### TESTING INSTRUCTIONS - `pytest -q tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py tests/unit_tests/mcp_service/test_middleware.py` (182 passed) - `pytest -q tests/unit_tests/mcp_service` (3319 passed, 1 unrelated health-check failure because the local test configuration returned a null application version) - `uvx pre-commit run --files superset/mcp_service/chart/schemas.py superset/mcp_service/chart/tool/get_chart_data.py superset/mcp_service/utils/token_utils.py tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py tests/unit_tests/mcp_service/test_middleware.py` - `pre-commit run --all-files` was also run. Python checks passed; the repository-wide frontend hooks could not complete because frontend dependencies such as `glob` and `postcss-styled-syntax` are not installed, and repository-wide Ruff reported pre-existing violations outside this change. The regression coverage executes the unsaved Mixed Timeseries response path with two command results and asserts that both are returned. Additional coverage verifies the additive single-query behavior and shared response-size limiting. ### 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 ### BACKWARD COMPATIBILITY This is additive. Existing top-level fields continue to represent the first query, while multi-query responses additionally expose `query_results`. Clients that ignore unknown fields are unaffected. ### EVAL EVIDENCE Not applicable to this deterministic serialization change; no prompt, model routing, or model-generated output changed. The MCP regression suite results are listed above. ### COST & LATENCY DELTA No model or parameter changes. Multi-query responses include more data by design, bounded by the existing response token limit using response-wide truncation. No external model-cost or latency benchmark is available in the OSS worktree. ### PROMPT / NON-DETERMINISM No prompt changes and no non-deterministic behavior. ### REVIEW GUIDANCE Review the additive schema and response construction first, then the shared-budget truncation logic. Concurrent work touching `get_chart_data` may need to rebase carefully around the response construction paths. -- 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]
