mikebridge opened a new pull request, #44265: URL: https://github.com/apache/superset/pull/44265
### SUMMARY Fixes SC-120964: `get_table` on a semantic view surfaced MetricFlow join-path failures — incompatible metric/dimension combinations (e.g. metric `orders` × dimension `product__product_name`) — as a generic `InternalError` *after* the query ran, giving the LLM nothing actionable. The view already exposes compatibility data (`SemanticView.get_compatible_dimensions`), so this validates before executing. On the external-view path, after name validation and before building/running the query, any requested dimension not in `view.get_compatible_dimensions(request.metrics, [])` is rejected with a structured `ValidationError` naming the incompatible dimension(s), the selected metric(s), and the view, and pointing at `get_compatible_dimensions` for valid combinations. Scope guards: - Built-in datasets have no metric/dimension compatibility constraint (all groupby columns are always compatible), so the gate is skipped for them. - Empty metric or dimension selections carry no join-path risk, so they skip the gate. - The execute path is unchanged: genuine backend/MetricFlow failures still surface as `InternalError`. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — MCP tool behavior. Before: incompatible pair → `InternalError` after execution. After: `ValidationError` naming the pair, before execution. ### TESTING INSTRUCTIONS Unit (MCP tests require `fastmcp`; run where it is installed, e.g. the dev container): ```bash pytest tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py -q # 45 passed ``` New cases: incompatible dimensions → structured `ValidationError` (exact message), `get_compatible_dimensions` consulted with `(metrics, [])`, and neither `_build_query_dict` nor `execute_tabular_query` is called; compatible selection → executes; a genuine backend failure (execute raises) → still `InternalError`; built-in datasets and empty metric/dimension selections → gate skipped, view compatibility never consulted. **Live call against a MetricFlow view is pending the demo core re-pin** (the harness runs core `89964b2a`, which is before this fix; superset-2's own stack lacks the `cube-local` provider extension so it can't resolve a semantic view). The end-to-end live verification is QA case **A12** in `superset-spec/semantic_layers/mcp-semantic-view-matrix-results.md` and will be exercised on the harness once this lands in the demo re-pin. ### ADDITIONAL INFORMATION - [x] Has associated issue: SC-120964 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01C7U5oFfrqUyM6hJTZiW2uf -- 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]
