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

   ### 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/`):**
   
   - It accepts an optional `semantic_selection_version` query parameter.
   - On a versioned semantic view, a missing or stale version gets the existing 
`200` response, with `result: []` and `suggestions_status: 
"unavailable_versioned_view"`. That response is returned before any cache read 
or provider call, as it is today.
   - A matching version enables the normal retrieval and search path.
   - The version is part of the values cache key, but only for versioned views, 
so cached values from an older identity version are never served after a 
version bump. The cache key for tables and unversioned views doesn't change.
   
   **How the frontend changes:**
   
   - The value comes from the chart's own 
`form_data.semantic_selection_version`. It is never taken from the datasource 
metadata that was just fetched.
   - Explore stamps that marker only when it resets semantic selections, which 
rebuilds form data and clears filters. A chart that carries the current version 
therefore had its fields picked after reselection.
   - Both the Dnd filter control and the legacy adhoc filter control pass the 
marker through to the simple-tab value picker. The path is `DndFilterSelect` / 
`AdhocFilterControl` → filter option → popover trigger → edit popover → simple 
tab.
   - Matrixify sends it too.
   - Dashboard extra filters don't inherit the chart's marker.
   
   **Compatibility:**
   
   - Tables and unversioned semantic views behave as before.
   - Older selections without a current marker fall back to manual entry, which 
is the current behavior. Users can reset and reselect fields to get suggestions 
back.
   - Rolling deploys are safe in both directions: an old frontend sends no 
version, and an old backend ignores it. Either way the result is manual entry.
   - No migration and no change to persisted shape.
   
   `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:
   
   ```bash
   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.tsx
   ```
   
   The 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:
   
   1. Open an existing chart on a versioned semantic view that was saved before 
its fields were reselected. Add or edit a filter. The value picker offers 
manual entry only.
   2. Click **Start field selection**, reselect the fields, and edit the filter 
again. Suggested values load, and search works.
   3. In Matrixify, **Members** and alphabetically sorted **All** modes load 
values after reselection.
   4. Table-backed charts are unchanged.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] 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
   - [ ] Removes existing feature or API
   
   Follows #44370. The new API surface is an optional query parameter on an 
existing endpoint.
   
   🤖 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