Repository navigation
feat(semantic-layer): gate Table pagination on row offset support - #44452
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #44452 +/- ##
==========================================
+ Coverage 83.23% 83.29% +0.05%
==========================================
Files 3037 3043 +6
Lines 197880 198713 +833
Branches 46114 46220 +106
==========================================
+ Hits 164708 165519 +811
- Misses 29947 29969 +22
Partials 3225 3225
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:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #13ef80Actionable Suggestions - 0Additional Suggestions - 7
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Heya @mikebridge, thanks for this, nice test coverage on the offset contract. Bito's flagged a couple of things that look real though (the mapStateToProps staleness and the dangling aria-describedby), worth addressing before this merges. |
Code Review Agent Run #f6cedbActionable Suggestions - 0Additional Suggestions - 4
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Preserve both updating notes and catalog messages; use supported keyboard API in the pagination regression test.
rebenitez1802
left a comment
There was a problem hiding this comment.
Approve — clean, well-tested UI gate with the security model intact: server-side stays provider-authoritative by design, the core/backend changes are correct, and docs/i18n are accurate. One non-blocking scope question worth confirming before this leaves draft.
🟡 Medium — The same gate is missing on the AG Grid Table plugin
The new gate lives only in plugin-chart-table. The actively-migrated plugin-chart-ag-grid-table — the strategic replacement, VizType.TableAgGrid behind AG_GRID_TABLE_ENABLED (superset/config.py:691) — defines an identical server_pagination checkbox (plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx:384) and server_page_length select (:397), and its buildQuery emits row_offset from server_pagination the same way (buildQuery.ts:249,271), with no isServerPaginationUnsupported wiring.
So with the flag on, a user can enable server pagination on an AG Grid table over a semantic view lacking ROW_OFFSET, save, and hit exactly the provider error this PR sets out to prevent — the affordance is silently bypassable by choosing the AG Grid variant.
This may well be intentional follow-up (the PR bills itself as "PR A"), but it's worth confirming explicitly. If in scope: extract isServerPaginationUnsupported into a shared helper and wire the same mapStateToProps into the AG Grid controls; if not, a note here on why AG Grid is deferred would help.
(A few low-severity a11y/consistency nits in CheckboxControl.tsx — reset-button focus loss on unmount, the disabled branch dropping ControlHeader, and a label-less accessible-name gap — are non-blocking; happy to share them inline if useful.)
| return Boolean( | ||
| datasource && | ||
| 'uid' in datasource && | ||
| datasource.uid === form_data.datasource, |
There was a problem hiding this comment.
On a normal Explore load form_data.datasource is <id>__semantic_view (set in ExploreGetCommand), while datasource.uid for a semantic view is the provider's opaque implementation.uid(), so this equality is false. hasMatchingDatasourceMetadata then returns false, features is dropped to undefined, and isServerPaginationUnsupported returns true even for a view that advertises ROW_OFFSET. A user opening a saved or fresh chart on such a view would see Server pagination disabled and never able to enable it, unless the provider's uid happens to be literally <id>__semantic_view. Should the match compare datasource.id/type against the parsed form value, or is there a path that rewrites form_data.datasource to the provider uid before the control panel runs?
There was a problem hiding this comment.
You're right, and thank you — this was a real regression, not just a theoretical one.
I confirmed your reading end to end: form_data.datasource is built as f"{self._datasource_id}__{self._datasource_type}" in ExploreGetCommand (superset/commands/explore/get.py:137), while SemanticView.uid returns self.implementation.uid() — the provider's opaque id — and the payload carries {"id": self.id, "uid": self.uid, "type": "semantic_view"} (superset/semantic_layers/models.py:524-525, :611-613). So the equality was false for the correct datasource, features dropped to undefined, and a view advertising ROW_OFFSET had Server pagination disabled with no way to enable it. Datasets were unaffected only because BaseDatasource.uid genuinely is f"{self.id}__{self.type}".
To answer your question directly: nothing rewrites form_data.datasource to the provider uid before the control panel runs, so comparing against datasource.id/type is the right fix. 13bf5c46cd parses <id>__<type> from the form value and compares it to the metadata's id and type, keeping uid equality only as the fallback for a selection that isn't of that canonical shape — so opaque provider uids still work for stale detection without being required to match the host's selection key.
Worth flagging why this slipped through review: the existing fixtures used uid: '1__semantic_view', a shape that satisfied the predicate under test, so the suite couldn't contradict it. The fixtures now use the real Explore shape, and with that correction the pre-existing keeps semantic_view pagination editable with ['ROW_OFFSET'] test fails against the old helper — 16 tests fail in total, across both plugins, so the old predicate was wrong in several directions and not only the one you reported. All 69 pass with the fix. The new test also pins the stale case with uid deliberately set to '42__semantic_view', so reinstating uid equality would break it.
Explore selects semantic views by id and type while provider UIDs are opaque. Compare canonical selections to metadata id/type so capable views remain enabled without accepting stale metadata; retain UID matching for opaque selections.
| expect( | ||
| screen.getByRole('button', { name: 'Turn off server pagination' }), | ||
| ).toHaveFocus(); | ||
| await userEvent.type( |
There was a problem hiding this comment.
userEvent.type() clicks its target before typing (unless skipClick is set), so here the click on "Turn off server pagination" already calls onChange(false) and removes the button before {enter} is sent. The unchecked-state and toHaveBeenCalledTimes(1) assertions then pass without any keyboard activation, so a regression that breaks Enter on the reset button while leaving mouse clicks working would still go green, and this is the only test that claims to cover the keyboard reset. Could this use await userEvent.keyboard('{Enter}') after the existing focus assertion so the keyboard path is actually exercised?
There was a problem hiding this comment.
Good catch—fixed in dfe9477 by using userEvent.keyboard("{Enter}") after the existing Tab/focus assertion. I verified the gap with a temporary mutant that prevents Enter activation but leaves mouse clicks working: the old test passed, the corrected test failed, and restoring the component made both focused suites pass (54 tests). The change is test-only.
Use keyboard Enter after tab focus so Joe's review finding cannot be hidden by userEvent.type's initial click. Confirmed the corrected test fails with native Enter activation blocked while the old test passes.
…t-capability # Conflicts: # UPDATING.md # superset-core/tests/semantic_layers/test_view.py # tests/unit_tests/semantic_layers/mapper_test.py
|
@mikebridge I re-reviewed the post-approval delta at 26ce647 and it looks correct: id/type metadata matching, stale-metadata gating (including @geido's other-semantic-view case), and per-instance checkbox ids. The branch now conflicts with master in UPDATING.md. Could you merge master? I'll merge once it's green. |
…t-capability # Conflicts: # UPDATING.md
…t-capability # Conflicts: # UPDATING.md
|
@aminghadersohi Merged master in b7c67ffc58. Per the approved UPDATING audit, I moved the Explore header/accessibility note verbatim into the PR's BEFORE/AFTER section because it describes a UI improvement rather than an upgrade action. The titled pagination/ROW_OFFSET compatibility entry stays unchanged in UPDATING.md; all other prose is preserved. Conflicts were mechanical unions. Verification: 1,210 backend/SDK tests, 293 frontend tests and branch-file hooks pass. Authored and verified by Codex. |
SUMMARY
Semantic Table charts can offer Server pagination even when their provider rejects nonzero offsets. This adds the optional SemanticViewFeature.ROW_OFFSET contract (non-negative offset with a positive finite limit) and disables the Table control with an accessible explanation when a semantic view does not advertise it.
Saved pagination settings remain unchanged until an explicit edit. A saved enabled control offers a keyboard-accessible Turn off server pagination action. SQL datasets keep their existing controls; direct callers retain provider-local validation.
This is PR A: core contract and host controls. The coordinated shell pin/Cube declaration follows separately after merge; MetricFlow pagination remains separate work.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Explore control headers without a click action render as plain text, not disabled buttons; interactive headers retain keyboard activation. Description buttons remain visible and keyboard accessible, including for disabled inputs.
Before: unsupported semantic views expose an enabled Server pagination control.
After: the control remains visible but disabled with an explanation; saved enabled settings offer an explicit turn-off action.
Browser/screenshots are deferred to the campaign stack owner; this PR remains draft.
TESTING INSTRUCTIONS
Local final checks:
Manual follow-up:
ADDITIONAL INFORMATION
No provider implementation, host-wide offset validator, persistence migration or chart rewrite. Missing capability metadata fails closed for the UI. Providers must use a compatible core version before importing the new enum member.