Repository navigation
fix(semantic-layer): classify provider errors in value suggestions - #45147
aminghadersohi merged 29 commits into
Conversation
…nd log unknown codes Document that get_values is outside the rejection contract because value search retries without its filter, and that async chart data shows the generic failure for a typed rejection. Log an unknown rejection code at warning level before it normalizes to INVALID_QUERY. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…stion errors The SDK docstring still described value search as best-effort with an unfiltered retry. Value suggestions now classify typed rejections as client errors and unclassified failures as server errors, and never retry without the search filter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@aminghadersohi this is the follow-up to your review on #45110: value suggestions and the async chart path now use #45110's translator, so rejections are 4xx and faults stay 5xx. Stacked on #45110, so only the top two commits are new until it merges. |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45147 +/- ##
==========================================
+ Coverage 83.33% 83.36% +0.02%
==========================================
Files 3040 3045 +5
Lines 198611 199253 +642
Branches 46346 46356 +10
==========================================
+ Hits 165511 166098 +587
- Misses 29876 29931 +55
Partials 3224 3224
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CodeAnt PR Risk: Low Risk
Assessed commit: |
|
Codex validation of CodeAnt’s completeness concern at
I reran 17 existing regression cases covering core/host incomplete and unverified errors, HTTP 400 and guest sanitization, async failure reasons without success publication, and value-search/endpoint failures without retry or cache writes. All passed on the assessed head. |
gabotorresruiz
left a comment
There was a problem hiding this comment.
Hey @mikebridge, thanks for carrying this through to the values endpoint. I scoped this to your top two commits, with #45110's head as the base.
Not blocking. The classification itself holds up: I could not get provider text into a response body on either status, and the guest differential behaves as you describe it. My one real concern is what the new 400 looks like from the picker, left inline on models.py.
I ran the semantic_layers, datasource, charts, common, tasks and security unit suites against 04b2ab7c and they are green, and CI is green too.
aminghadersohi
left a comment
There was a problem hiding this comment.
Reviewed at 8213a3d. CI is green, and locally the semantic_layers, datasource, charts, common and tasks unit suites pass (2388 tests; the one failure is caused by my environment). Both of the points I deferred from #45110 are now covered. Value suggestions go through execute_semantic_query with no unfiltered retry, and nothing is cached on failure. A worker rejection now stores the host message, so async charts show the same text as sync. @gabotorresruiz's inline points are addressed: the type guard is in, the WARNING names the view, dimension and code without the search text, and both statuses use the {"message": ...} envelope. Two things remain:
- The guard on
models.py:573is narrower than the host's own idea of a string column (see the inline comment). - The picker still hides the new 400.
isSuggestionsOutageinAdhocFilterEditPopoverSimpleTabContent/index.tsx:93-96only flagsstatus >= 500. A string dimension whose provider rejectsLIKEused to get the bounded page from the unfiltered retry on master. It now gets an empty list with the "Type a value here" placeholder, and the host guidance in the 400 body is never shown. Each keystroke also re-queries, so that is one 400 and one WARNING per keystroke. Either show the 400 message as helper text, or say in UPDATING that the frontend half is a follow-up.
Also, for non-string dimensions the hint at index.tsx:557 ("Type to search all of them") and the q description in datasource/api.py:160-162 ("only values containing it are returned") are no longer true. Typing now only filters the loaded page in the browser.
aminghadersohi
left a comment
There was a problem hiding this comment.
Re-checked at 51c283b: only merges since my last review, and the suites pass locally (2405). Both open items still apply: the string/large_string guard in the models.py:576 thread, and the picker hiding the new 400.
|
Codex follow-up to the picker point in Amin’s review: this is now fixed rather than left as a frontend follow-up. Semantic-view 400s show the backend’s sanitized guidance through The request guard runs after the asynchronous body parse, so a delayed old rejection cannot replace a newer successful search. New Jest cases cover guidance/manual entry, the bounded-page hint, and that delayed-body race; all 53 component cases pass. The semantic truncation hint no longer promises whole-column search, and the API q description distinguishes text search from bounded non-text semantic suggestions. String-view and dictionary text narrowing is fixed too. Backend/core/async checks pass all 983 cases; branch-wide hooks and independent Claude review pass. #45110 is unchanged; no restack was needed. Pushed in |
…rejections-values-async
|
@aminghadersohi the conflict with #45109 is resolved in bc4c99a (master merged into #45110 first, then into this branch; both sides of the five conflicting hunks kept, no feature changes). Ready for your re-look. |
gabotorresruiz
left a comment
There was a problem hiding this comment.
Thanks @mikebridge, both of my points are closed. The type guard discriminates rather than just switching narrowing off, the rejection path logs the view, the dimension and the code with no search text, and all four error branches on that route now answer {"message": ...}, so the docstring and the code agree. Teaching the picker about the 400 is more than I asked for.
I ran the semantic_layers, datasource, charts, common, tasks and explore unit suites and the picker jest file at c8af2255, and checked your new cases against the pre-fix code. CI is green here apart from actions-timeline.
The only thing in the way is the conflict, and of the two files one is UPDATING.md and the other is #45110's mapper.py against master's #45109, so neither is new work on this branch. One small question inline.
| : optionsTruncated | ||
| ? props.datasource?.type === 'semantic_view' | ||
| ? t( | ||
| 'Only the first %s values are listed. Enter a value manually if it is not listed.', |
There was a problem hiding this comment.
Just a small NIT: this drops the search promise for every semantic dimension, including the string ones where the LIKE still reaches the provider, so a text column's picker now reads as if typing only filters the loaded page.
Is that deliberate because type_generic cannot tell the frontend whether the backend will narrow (get_column_type reports STRING for binary and list too, and those are not narrowed), or would splitting on the generic type here be worth it? Happy either way, I might be missing something.
There was a problem hiding this comment.
Codex verification at e4e75cff63: yes, this conservative wording is deliberate. The values path sends LIKE for Arrow string, large_string and string_view (including dictionaries with those value types). Binary and list dimensions do not receive LIKE. The metadata sent to this picker reports type_generic=STRING for all of those, including dictionary, which also does not receive LIKE, so splitting on the generic type would promise server-side search for dimensions where the backend only returns the bounded page.
Text dimensions still send q and narrow at the provider; the hint does not change that behavior. I have left the code unchanged. The follow-up is to expose an explicit per-column search capability derived from the same backend predicate, then use it to restore the text-specific hint with text/binary/list/dictionary tests. Raw column.type is an Arrow display string, so I would avoid making the frontend duplicate that parser and type policy. Existing type/narrowing and picker-hint checks passed; no new commit for this reply.
|
Codex update: merged the refreshed #45110 parent and master. In this commit, UPDATING.md now has one titled “Semantic provider error handling” entry covering chart queries and value suggestions, replacing the separate values bullet. It preserves typed rejection 400 guidance, generic provider-fault 500 responses, the former timeout/DB/template statuses, and the host-validation/worker-control exception caveat; it also states that failed narrowed searches do not retry broadly and manual entry remains available. @aminghadersohi, please re-look at the consolidated wording. Focused tests, picker tests and hooks passed, with independent Claude review of the cache merge. |
|
@mikebridge this now conflicts with master after the merges of #45110 and #44452. Once you resolve the conflict and CI is green, I'll merge it. |
SUMMARY
Follow-up to #45110, which returns 4xx for provider validation errors on the synchronous chart-data path. Review of #45110 pointed out two paths it didn't cover. This PR handles both by reusing #45110's single translator (
execute_semantic_query), with no second mapping of codes to strings.Values endpoint (
GET /api/v1/datasource/<type>/<id>/column/<col>/values/):SemanticView.values_for_columncallsget_valuesthrough the shared translator. Its signature is widened with aParamSpecso it accepts the provider's arguments.SemanticQueryRejectedErrorreturns HTTP 400, with the same host-owned guidance as chart data.get_valuescall was logged and retried unfiltered, which hid rejections from users. Failed results are never cached.Async chart path: no production change was needed. With the real
execute_chart_queryworker, the classified rejection or fault already reaches the task failure with the same status and host text. This PR adds regression coverage for every rejection code, plus faults, for guest and non-guest users.Provider contract: the
get_valuesdocstring insuperset-core, the developer docs andUPDATING.mdnow describe this behavior. UseSemanticQueryRejectedErroronly for positively identified input rejection, for example a search filter the dimension can't apply. Leave other failures unclassified.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; this is an API status and error-text change. Before: a provider rejection on value suggestions became a 500, or was silently retried without the search filter. After: rejections return 400 with guidance, and faults return 500 with generic text.
TESTING INSTRUCTIONS
pytest tests/unit_tests/semantic_layers/values_endpoint_test.py \ tests/unit_tests/semantic_layers/query_errors_test.py \ tests/unit_tests/semantic_layers/models_test.pyvalues_endpoint_test.py:ValueError,RuntimeError,TimeoutError) → 500 with generic text.query_errors_test.py:test_async_provider_error_matches_sync_chart_errorruns the real async worker and checks that it raises the same classified exception, with the same public message, as the sync path.models_test.py: a failed search never retries without its filter.ADDITIONAL INFORMATION
Behavior change for semantic-layer providers: value search is no longer best-effort, so a failed filtered
get_valuescall surfaces instead of falling back to the unfiltered page. This is noted inUPDATING.md.🤖 Generated with Claude Code