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

   ### SUMMARY
   
   Semantic-view filters should never be silently discarded. This change 
distinguishes dashboard filters from predicates defined by the chart:
   
   - Dashboard native filters and cross-filters on columns that are not 
dimensions of the target semantic view—including metric names—are skipped and 
reported as **Incompatible**, while the chart continues to render.
   - A chart-defined filter on a semantic-view metric returns a clear error 
naming the metric. It is not silently ignored or translated into a HAVING 
predicate.
   - Unknown chart-defined columns are reported as rejected, matching SQL 
datasets. Valid dimension filters continue to apply, including when a metric 
has the same name.
   - Applied/rejected reporting survives result-cache hits, and unsupported 
chart-defined metric predicates are validated before a cached result can be 
returned.
   
   The frontend preserves dashboard-filter provenance and shows incompatible 
filters in the chart's filter badge and detail popover. Chart-owned SQL filter 
payloads and cache keys remain unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: an unsupported semantic-view metric predicate could return 
unfiltered results without reporting the skipped filter, and a chart with only 
incompatible dashboard filters could have no visible filter badge.
   
   After: chart-defined metric predicates return an explicit error; 
incompatible dashboard filters appear in the filter-detail popover, including 
when no filter was applied. The badge includes incompatible filters on SQL 
dashboards as well as semantic-view dashboards.
   
   No browser screenshots were captured. The display behavior is covered by 
React Testing Library tests.
   
   ### TESTING INSTRUCTIONS
   
   1. Enable `SEMANTIC_LAYERS` and use a semantic view with a dimension such as 
`category` and a metric such as `total_amount`. Create a chart using that view.
   2. On a dashboard, apply a native filter or cross-filter whose column is not 
a dimension of that view. Confirm the chart still renders and its filter-detail 
popover lists the filter under **Incompatible filters**, even when it is the 
only filter.
   3. Apply a compatible `category` filter. Confirm it restricts the result and 
is reported as applied; an incompatible filter alongside it remains reported as 
incompatible.
   4. Send a chart-data request with a chart-owned filter such as 
`{"col":"total_amount","op":">=","val":999999}`. Confirm a 400 error names the 
metric, including when the same request also contains a valid dimension filter.
   5. Repeat supported/incompatible dashboard requests with result caching 
enabled. Confirm applied/rejected reporting remains visible on cache hits.
   6. Check an existing SQL chart with saved simple adhoc filters (`isExtra: 
false`). Confirm its query payload has no false provenance field and its 
behavior is unchanged.
   
   Automated verification:
   
   - Backend HTTP and mapper tests cover rejection before cache access, mixed 
filters, metric/dimension name collisions, provider predicate preservation, and 
seeded applied-only/rejected-only cache entries. Provider/cache transport 
boundaries are mocked.
   - The semantic-layer package gate passed **816 tests with 100% coverage**, 
including a restored group-limit test for a filter that conversion rejects. The 
focused mapper and HTTP filter tests passed **205 tests**.
   - The affected query-builder, chart-controls, native-filter and badge Jest 
run passed: **174 suites, 1,592 tests**, with one existing skipped test. This 
includes MixedTimeseries and the regression that compares serialized SQL 
payloads. The regression was observed failing before the fix.
   - An independent comparison against master found identical chart-owned SQL 
payloads through the Table, Timeseries and MixedTimeseries builders, with 
absent and false provenance.
   - The unchanged backend's full local unit run had 22,393 passing tests and 
three machine-specific baseline failures; CI remains the full-suite authority. 
No live-provider or browser acceptance run is claimed.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [x] Required feature flags: `SEMANTIC_LAYERS` for semantic-view 
functionality; shared filter badges also affect SQL dashboards.
   - [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
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Compatibility and rollout:
   
   - Chart-owned semantic metric filters that previously appeared to work by 
silently dropping a predicate will return an error. Use a dimension filter or 
remove the unsupported predicate. Documentation and `UPDATING.md` describe this 
correction.
   - Dashboard-filtered SQL charts receive explicit dashboard provenance in 
their cache keys and can incur a one-time cache warm-up after deployment. 
Chart-owned SQL filters retain their previous payloads and keys.
   - During a mixed-version frontend rollout, an old bundle may omit dashboard 
provenance. A dashboard filter whose name collides with a semantic-view metric 
can then be treated as chart-owned and return an error until the browser 
reloads the updated bundle.
   
   Implementation assisted by Codex; independently reviewed with Claude.
   
   🤖 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