sadpandajoe opened a new pull request, #45401:
URL: https://github.com/apache/superset/pull/45401
### SUMMARY
`tests/unit_tests/semantic_layers/e2e_stub_extension_test.py::test_unsupported_operator_fails_loudly`
fails on master since #45103 merged (a5d29a9).
Root cause: #45103 added the Playwright semantic stub provider, but its CI
ran on a base (1578b8cb) that predates #45110 (1fced034). #45110 made the host
classify provider execution errors: a typed `SemanticQueryRejectedError`
becomes HTTP 400 with a localized host message, while any other exception —
including a plain `ValueError` — is an unclassified failure that returns HTTP
500 with the generic "An error occurred while fetching the data." (documented
in `docs/developer_docs/semantic-query-errors.md`). The stub still rejected
unsupported filters with `ValueError`, so the chart-data response no longer
carried "does not support" and the test failed. Applying the stub test file on
top of 1fced034^ passes and on top of 1fced034 fails; #45292 and #44454, which
merged just before #45103, are not involved.
This change makes the stub follow the provider error contract:
`_validate_filter` raises
`SemanticQueryRejectedError(SemanticQueryErrorCode.UNSUPPORTED_QUERY)` for
non-WHERE/non-dimension filters and unsupported operators. Chart data then
returns HTTP 400 with "This semantic provider does not support this query…",
which the existing assertion checks unchanged. The direct-call test now asserts
the typed rejection and its code instead of the old `ValueError` text. Host
behaviour is unchanged.
### TESTING INSTRUCTIONS
1. Load the stub as an extension: run Superset with
`tests/integration_tests/superset_test_config_semantic.py` (it sets
`LOCAL_EXTENSIONS` to `tests/e2e_extensions/semantic_stub` and enables
`SEMANTIC_LAYERS`).
2. Create a semantic layer of type
`extensions.superset-e2e.semantic-stub.stub` with configuration `{}` and add
its `orders` view.
3. `POST /api/v1/chart/data` for that view with `columns: ["category"]`,
`metrics: ["total_amount"]` and a filter `{"col": "category", "op": "LIKE",
"val": "B%"}`.
4. Before this change: HTTP 500, "An error occurred while fetching the
data." After: HTTP 400, "This semantic provider does not support this query.
Remove unsupported filters or grouping and try again."
5. Repeat with `{"col": "region", "op": "IN", "val": ["West"]}` and confirm
HTTP 200 with Books 5 and Music 3, so supported filters are unaffected.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #45400
- [ ] 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
- [ ] 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]