Skip to content

feat(semantic-layer): gate Table pagination on row offset support - #44452

Merged
aminghadersohi merged 41 commits into
apache:masterfrom
mikebridge:sc-121436-row-offset-capability
Oct 14, 2026
Merged

aminghadersohi merged 41 commits into
apache:masterfrom
mikebridge:sc-121436-row-offset-capability

Conversation

@mikebridge

@mikebridge mikebridge commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

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:

  • Python models/mapper/core contract suites: 298 passed.
  • Table control/buildQuery and CheckboxControl Jest suites: 63 passed.
  • Red-first evidence: missing enum/metadata contract tests failed; unsupported-control and saved-state tests failed before implementation.
  • Required staged hooks and explicit MyPy passed except the normal frontend type hook, which reports TS6305 for unbuilt workspace declarations. The approved strict source-resolved TypeScript check of all four changed TS/TSX files passed with zero diagnostics. No type-checking strictness options were relaxed.
  • Existing dependencies were reused locally; clean-install/build evidence remains for CI.

Manual follow-up:

  1. With semantic layers enabled, open a Table backed by a view without ROW_OFFSET; verify the visible disabled checkbox and explanation.
  2. Open a saved chart with server pagination enabled. Confirm its settings/query offsets are not normalized and provider errors remain actionable. Tab to Turn off server pagination, activate it, then save explicitly.
  3. Switch between supported and unsupported datasources; confirm no automatic pagination-state rewrite.
  4. Verify a view declaring ROW_OFFSET and an ordinary SQL dataset retain editable controls.

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags: existing SEMANTIC_LAYERS for semantic views; defaults unchanged
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API: optional ROW_OFFSET enum member
  • Removes existing feature or API

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.

@github-actions github-actions Bot added doc Namespace | Anything related to documentation plugins risk:chart-metadata labels Sep 19, 2026
@codecov

codecov Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.29%. Comparing base (d6c7ac2) to head (a075834).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...ns/plugin-chart-ag-grid-table/src/controlPanel.tsx 86.95% 3 Missing ⚠️
...nd/plugins/plugin-chart-table/src/controlPanel.tsx 95.65% 1 Missing ⚠️
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              
Flag Coverage Δ
hive 35.02% <ø> (+<0.01%) ⬆️
javascript 78.91% <96.00%> (+0.08%) ⬆️
mysql 53.09% <ø> (-0.01%) ⬇️
postgres 53.09% <ø> (-0.01%) ⬇️
presto 36.79% <ø> (-0.01%) ⬇️
python 86.86% <ø> (+<0.01%) ⬆️
sqlite 52.85% <ø> (-0.01%) ⬇️
superset-extensions-cli 91.24% <ø> (?)
unit 80.81% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify

netlify Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b7c67ff
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ace766c4e4ec2c5c70ca8c3
😎 Deploy Preview https://deploy-preview-44452--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@mikebridge
mikebridge marked this pull request as ready for review September 21, 2026 02:47
@bito-code-review

bito-code-review Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #13ef80

Actionable Suggestions - 0
Additional Suggestions - 7
  • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx - 3
    • Missing shouldMapStateToProps flag · Line 411-417
      `mapStateToProps` derives `disabled` from live Redux state, but without `shouldMapStateToProps` `ControlPanelsContainer` only applies it when controls are rebuilt (hydrate, `UPDATE_FORM_DATA_BY_DATASOURCE`); `SYNC_DATASOURCE_METADATA` updates `state.datasource` without rebuilding, leaving the checkbox's disabled state stale. Siblings `column_config`/`conditional_formatting` and sharedControls' `sort_by` set `shouldMapStateToProps: () => true` for the same need.
    • Missing shouldMapStateToProps flag · Line 430-432
      Same gap as `server_pagination`: `server_page_length` maps `disabled` from live state via `isServerPaginationUnsupported`, but without `shouldMapStateToProps` the container (`ControlPanelsContainer.tsx:503-507`) will not re-run it outside control rebuilds, so the select's disabled state can lag `SYNC_DATASOURCE_METADATA` updates. Siblings `column_config`/`conditional_formatting` set the flag.
    • Magic capability string inline · Line 74-74
      `'ROW_OFFSET'` is a backend capability string (mirrors a Python enum member) gating user-facing behavior. Repo precedent `ADHOC_COLUMN_EXPRESSIONS` is an exported named constant in `pickerCapabilities.ts`; do the same here so the capability contract has one named symbol instead of an inline literal buried in a helper.
  • superset-frontend/src/explore/components/controls/CheckboxControl.tsx - 1
    • Dangling aria-describedby reference · Line 74-74
      `aria-describedby={explanationId}` is set whenever `disabled && disabledReason`, but the `

      ` (lines 93-95) only renders inside the `if (label)` branch. With no `label`, the component returns the bare `checkbox` (line 104), so `aria-describedby` points at a non-existent id and `disabledReason` is never shown. Gate the attribute on the same condition or render the explanation on the no-label path. ([CWE-454](https://cwe.mitre.org/data/definitions/454.html))

  • superset-frontend/plugins/plugin-chart-table/test/controlPanel.test.tsx - 3
    • Duplicated control lookup · Line 423-435
      `getControl` (423-435) repeats the same `controlPanelSections` → `controlSetRows` traversal as the existing `findConditionalFormattingControl` (36-51), differing only in parameterization and throw-vs-null handling. Two copies of the lookup risk diverging when the config shape changes. Consider delegating `findConditionalFormattingControl` to `getControl('conditional_formatting')` so the traversal lives in one place.
    • Import order deviation · Line 32-32
      Line 32 places the `react` import after the relative `../src/controlPanel` import. Sibling tests in this plugin (`DataTable/hooks/useSticky.test.tsx:19`, `DataTable/DataTable.test.tsx:20`) put the `react` import at the top with the external group. Matching that grouping keeps the import block consistent and scannable.
    • Wrong controlState arg · Line 511-511
      `pageLength.mapStateToProps` is the `server_page_length` control's mapper, but line 511 passes `state.controls.server_pagination` as its `controlState` argument. Harmless today because the mapper (controlPanel.tsx:430) only reads `state`, but it encodes a wrong call shape; passing the control's own state keeps the test faithful to the `mapStateToProps` contract.
Review Details
  • Files reviewed - 8 · Commit Range: 924b94f..924b94f
    • superset-core/src/superset_core/semantic_layers/view.py
    • superset-core/tests/semantic_layers/test_view.py
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
    • superset-frontend/plugins/plugin-chart-table/test/controlPanel.test.tsx
    • superset-frontend/src/explore/components/controls/CheckboxControl.tsx
    • tests/unit_tests/semantic_layers/mapper_test.py
    • tests/unit_tests/semantic_layers/models_test.py
  • Files skipped - 2
    • UPDATING.md - Reason: Filter setting
    • docs/developer_docs/extensions/contribution-types.md - Reason: Filter setting
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 21, 2026
@rusackas

Copy link
Copy Markdown
Member

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.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 25, 2026
@bito-code-review

bito-code-review Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f6cedb

Actionable Suggestions - 0
Additional Suggestions - 4
  • superset-frontend/plugins/plugin-chart-table/test/controlPanel.test.tsx - 1
    • Test controlState mismatch · Line 446-446
      The parameterized test always passes `after.controls.server_pagination` as `controlState`, so the `server_page_length` iteration receives the pagination control's state rather than its own. It passes today only because both `mapStateToProps` ignore `controlState`; if `server_page_length`'s mapper later reads it, the test would silently validate the wrong state. Derive `controlState` from the parameterized name.
  • superset-frontend/src/explore/components/controls/CheckboxControl.test.tsx - 2
    • Disabled behavior untested · Line 53-59
      The test name promises a disabled checkbox, but it only asserts the explanation text renders (`toHaveAccessibleDescription`, `getByText`). The disabled behavior itself — `handleChange` in `CheckboxControl` suppressing `onChange` when `disabled` — is never exercised. A regression that re-enables clicks would pass this test. Add a click on the checkbox and assert `onChange` is not called.
    • Hardcoded user-facing string · Line 54-54
      `disabledReason: 'Unavailable'` hardcodes a user-facing string that `CheckboxControl` renders into the DOM (`

      {disabledReason}

      `). Per the repo rule that user-facing labels go through `t()`, wrap it with the translation function so the fixture matches production usage and stays localization-safe.
  • superset-frontend/src/explore/components/controls/CheckboxControl.tsx - 1
    • Duplicated disabled guard · Line 79-81
      The `disabled && disabledReason` guard is now computed in two places: the unchanged `aria-describedby` on line 74 and this `explanation` element. They must stay in sync or the checkbox references an `explanationId` with no matching element (a11y break). Extract one shared `showExplanation` boolean for both sites. No runtime issue today.
Review Details
  • Files reviewed - 4 · Commit Range: 924b94f..08778d8
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/test/controlPanel.test.tsx
    • superset-frontend/src/explore/components/controls/CheckboxControl.test.tsx
    • superset-frontend/src/explore/components/controls/CheckboxControl.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added i18n Namespace | Anything related to localization requires:rebase Requires rebasing on top of current master labels Sep 28, 2026
Preserve both updating notes and catalog messages; use supported keyboard API in the pagination regression test.
@aminghadersohi
aminghadersohi self-requested a review September 30, 2026 19:51

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Mike Bridge added 2 commits October 9, 2026 11:50
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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 11, 2026
…t-capability

# Conflicts:
#	UPDATING.md
#	superset-core/tests/semantic_layers/test_view.py
#	tests/unit_tests/semantic_layers/mapper_test.py
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 12, 2026
@aminghadersohi

Copy link
Copy Markdown
Contributor

@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.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 12, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 13, 2026
@mikebridge

Copy link
Copy Markdown
Member Author

@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.

@aminghadersohi
aminghadersohi merged commit 114d32b into apache:master Oct 14, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation i18n Namespace | Anything related to localization packages plugins risk:chart-metadata size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants