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

   ### SUMMARY
   
   **TL;DR:** Invalid semantic-view selections should tell the caller to 
correct the request, rather than appear as server failures.
   
   **Background:** The host mapper checks selected fields, provider feature 
support, and filter values before executing a semantic query.
   
   **Problem:** Some of those deliberate refusals raise `ValueError`, bypassing 
the chart-data pipeline's validation-error handling and returning HTTP 500.
   
   **What this changes:**
   
   - Convert `ValueError` only around the mapper's validation and translation 
steps into `QueryObjectValidationError` (HTTP 400).
   - Keep provider metadata discovery and query dispatch outside that 
conversion.
   - Preserve provider execution faults as HTTP 500 and leave existing 
selection-version guidance unchanged.
   - Add HTTP regression coverage and document the boundary.
   
   The detailed design follows: `get_results` shares one narrow catch around 
`_validate_query_object` and `_map_query_object`; the public 
`validate_query_object` entrypoint also converts only its internal validation 
call. Exception chaining preserves the original cause. The existing raise 
sites, successful query construction, cache identity, SDK, compatibility 
routing, and MCP mapping are unchanged. Timing includes host validation as well 
as translation and execution, excluding discovery.
   
   Column-value suggestions call the provider's `get_values` directly, not this 
mapper, and are outside this change.
   
   Tracked in [SC-126716](https://app.shortcut.com/preset/story/126716).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   No UI layout change. Unsupported group limits and invalid DATE filter values 
return HTTP 500 before this fix and HTTP 400 afterward.
   
   ### TESTING INSTRUCTIONS
   
   Run `python -m pytest tests/unit_tests/semantic_layers/query_errors_test.py 
tests/unit_tests/semantic_layers/mapper_test.py -q`.
   
   The two HTTP regression cases were run before the production change and both 
failed with `500 == 400`; afterward the focused modules passed (265 tests). 
Provider execution ValueErrors still return HTTP 500; metadata exceptions 
remain unchanged at the mapper boundary. Changed-file hooks include main MyPy.
   
   The full local unit run at commit `74c21ef685` reported 27,270 passed, 50 
skipped,
   2 xfailed, and 11 known baseline failures: eight MCP dateutil/DST cases 
tracked in
   SC-126726 (bullet chart, get_chart_data, query_dataset, get_table), two ARM
   longdouble cases, and the babel fixture's missing `python` on its restricted 
PATH.
   These reproduce on master and do not touch this branch's changed files.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: SC-126716
   - [x] Required feature flags: existing `SEMANTIC_LAYERS`
   - [ ] 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
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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