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

   ### SUMMARY
   
   Semantic providers can deliberately reject chart query input through a 
shared, code-based SDK exception. The host returns a localized HTTP 400 message 
for those rejections while preserving host validation and completeness errors. 
Unclassified provider failures remain HTTP 500 with generic public text; 
embedded guests retain stricter masking.
   
   The change also preserves failure classification through annotation and 
asynchronous execution, so incomplete results cannot publish a success cache 
key. Provider faults retain an ERROR-level diagnostic log.
   
   Providers must adopt 
`superset_core.semantic_layers.errors.SemanticQueryRejectedError` to receive 
the new validation behavior. This PR does not convert arbitrary `ValueError`s 
into client errors or complete adapter adoption.
   
   **Merge coordination:** keep this PR in draft while coordinating with #44832 
(shared completeness types and translation) and #42760 (cache-aware dispatch). 
Whichever merges second must de-duplicate the completeness definitions and 
translation site. With the cache executor, classify errors around the provider 
dispatcher on cache misses, keeping cache-owned errors outside that boundary. 
Deploy compatible core/host versions before adapters import the new contract.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable: backend error handling and SDK contract.
   
   | Scenario | Before | After |
   | --- | --- | --- |
   | Deliberately rejected provider input | No shared rejection signal; 
commonly surfaced as 500 | Typed rejection returns 400 with host-owned guidance 
|
   | Unexpected provider failure | Could expose provider diagnostics | Remains 
500 with generic public text and an ERROR log |
   | Guest error response | Generic masking required | Masking retained for 
both validation and faults |
   | Required semantic annotation or incomplete async result | Classification 
can be lost in generic failure handling | Failure propagates without publishing 
successful async completion |
   
   ### TESTING INSTRUCTIONS
   
   1. With `SEMANTIC_LAYERS` enabled, use a test provider whose `get_table` 
raises `SemanticQueryRejectedError(SemanticQueryErrorCode.INVALID_FILTER)`. 
Request chart data and verify HTTP 400 with fixed filter guidance.
   2. Repeat with `get_row_count`, a required comparison query, and an 
annotation source. Required failures must not produce partial successful chart 
data.
   3. Raise `ValueError`, `RuntimeError`, or `TimeoutError` from provider 
execution. Verify HTTP 500, generic client text, and an ERROR record retaining 
the private cause.
   4. Repeat as an embedded guest; messages must remain generic. Host/core 
completeness errors must remain 400 for both supported reasons.
   5. Execute an incomplete query through the async task: it must raise and 
must not publish a success cache key.
   
   Local checks: semantic-layer suite **844 passed with 100% coverage**; 
branch-file pre-commit hooks, including MyPy, passed. Removing the ERROR log 
made both new logging assertions fail. Whole-unit result: 22,665 passed, 40 
skipped, 2 xfailed; three documented local baseline failures in unchanged 
numeric-contract and translation-fixture tests.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [x] Required feature flags: `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
   - [x] Introduces new feature or API: additive provider rejection contract
   - [ ] 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