Repository navigation
fix(semantic-layer): restore value suggestions for semantic view filters - #45109
aminghadersohi merged 5 commits into
Conversation
|
@aminghadersohi @rebenitez1802 could you take a look when you have a chance? This restores filter-value suggestions on versioned semantic views, gated on the chart's own selection version. It's the follow-up to #44370. |
✅ 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 #45109 +/- ##
==========================================
+ Coverage 82.94% 82.97% +0.03%
==========================================
Files 3023 3026 +3
Lines 195600 195810 +210
Branches 45600 45708 +108
==========================================
+ Hits 162241 162477 +236
+ Misses 30148 30122 -26
Partials 3211 3211
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:
|
aminghadersohi
left a comment
There was a problem hiding this comment.
Read through the backend gate, cache keying, and the frontend plumbing. Looks sound overall; a few notes, none blocking.
-
superset/datasource/api.py: the gate is a plain equality check of a client-supplied value against the view's currentselection_identity_version. That is fine for stopping the stale-title collision described in the summary, but it means the marker is an assertion by the caller, not proof. A hand-built request, or any caller that copies the version from datasource metadata, passes the gate. If that is accepted (suggestions are not a security boundary, and authorization is checked before this), the docstring and UPDATING note could say so explicitly so nobody later treats it as a trust check. -
Chart-level marker vs per-filter provenance:
form_data.semantic_selection_versionapplies to the whole chart. A chart that is reselected, saved, and later has its semantic view's version bumped just falls back to manual entry, which is the intended direction. But a filter column added by hand-editing the saved form data would still pass. Probably out of scope, but worth a line in the docs. -
AdhocFilterEditPopoverSimpleTabContent/index.tsx: addingselectionVersion/datasourceType/datasourceIdto thekeyofSelectWithLabelremounts the select when they change. That is right for clearing stale options, but it also drops any in-progress typed text if the version changes while the popover is open. Rare, so just confirming it is intended. -
MatrixifyDimensionControl.tsx: thesignal.abortedguards incatch/finallyare a good fix but go beyond the PR's stated scope; the test covering the late-failure race is the right companion. Please confirm the "loading" state cannot stick when an aborted request is the last one issued (the next effect run sets it again, so it looks fine). -
Tests: backend coverage is good (missing/stale/current version, cached and uncached, and cache-key separation). I could not find a case asserting that the cache key for tables and unversioned views is byte-identical to before; since the summary promises that, a small assertion on the key (or a pinned expected hash) would guard against accidental invalidation of existing caches. On the frontend, a test for the
isExtrabranch (dashboard extra filters send no marker) would back the claim in the summary. -
Minor: the
controls.tsxmapper readsstate.form_data?.semantic_selection_version; other consumers of this mapper that pass noform_datagetundefined, which degrades to manual entry. Fine, just noting it is silent.
CodeAnt PR Risk: Low Risk
Assessed commit: |
…ersioned cache keys Reset the Matrixify values spinner at the start of each effect run, so an aborted load followed by an early return no longer leaves it loading. Pin that unversioned views keep their pre-marker column-values cache material, and document that the selection marker is a per-chart caller assertion, not an authorization or per-filter provenance check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks @aminghadersohi, this was a careful read. Changes are in 77d82cd.
|
aminghadersohi
left a comment
There was a problem hiding this comment.
Approving at f0a2312. I checked that raise_for_access runs before the selection-version gate, and that the gate runs before the cache key, the cache read and values_for_column. Missing, stale and empty markers return the unavailable status. The unversioned and table key material is pinned by test_unversioned_suggestion_cache_material_is_unchanged. All six points from my earlier review are addressed: the gate comment and docs state that the marker is not a credential, the chart-level marker caveat is documented, the Matrixify loading reset is in (its test fails when the reset line is removed), and the isExtra case is covered. Locally the semantic_layers and datasource unit suites pass, apart from one failure caused by my environment, as do the three changed jest suites (101 tests). CI is green.
SUMMARY
#44370 disabled column-value suggestions on every versioned semantic view. A saved selection's display title can exactly match a different member's current stable ID, so the server can't tell from the column name alone whether a saved filter refers to a current member. This PR restores suggestions for selections whose provenance can be checked.
How the column-values endpoint changes (
GET /api/v1/datasource/<type>/<id>/column/<col>/values/):semantic_selection_versionquery parameter.200response, withresult: []andsuggestions_status: "unavailable_versioned_view". That response is returned before any cache read or provider call, as it is today.How the frontend changes:
form_data.semantic_selection_version. It is never taken from the datasource metadata that was just fetched.DndFilterSelect/AdhocFilterControl→ filter option → popover trigger → edit popover → simple tab.Compatibility:
UPDATING.md, the semantic member selections docs and the OpenAPI spec are updated.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not captured. Before: the filter value picker and Matrixify value list on a versioned semantic view always showed "enter values manually". After: they load suggestions once fields have been explicitly reselected; selections that haven't been reselected still show the manual-entry guidance.
TESTING INSTRUCTIONS
Automated:
pytest tests/unit_tests/semantic_layers/values_endpoint_test.py \ tests/unit_tests/semantic_layers/selection_identity_test.py cd superset-frontend && npm run test -- \ src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx \ src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/AdhocFilterEditPopoverSimpleTabContent.test.tsx \ src/explore/components/controls/MatrixifyDimensionControl.test.tsxThe backend tests include a collision fixture: a legacy title that equals another member's current ID never reaches the cache or provider without a matching version. They also cover cache partitioning by version. The frontend tests check that each control sends the chart's marker, and only that marker, for missing, stale and current versions, using the real control mapper. They also cover a late failing response racing a newer success.
Manual, with a semantic layer whose views report a selection identity version:
ADDITIONAL INFORMATION
Follows #44370. The new API surface is an optional query parameter on an existing endpoint.
🤖 Generated with Claude Code