feat(sqllab,extensions): contribution surfaces for tab/pane extensions#41285
feat(sqllab,extensions): contribution surfaces for tab/pane extensions#41285rusackas wants to merge 6 commits into
Conversation
Lets extensions contribute first-class SQL Lab experiences — replacing the default editor split with their own pane, and adding their own tab types to the new-tab dropdown. Changes: - Add two view locations to SqlLab/contributions.ts: - sqllab.northPane — full-pane replacement for the default editor+SouthPane split - sqllab.newTab — tab types listed in the '+' new-tab dropdown - Expose PENDING_NORTH_PANE_VIEW_KEY: extensions set this localStorage key before calling sqlLab.createTab() to declare which northPane view the new tab opens with. SqlEditor consumes/removes the key on init, then persists the choice per-tab so the mode survives reloads. - Expose Tab.backendId on the public superset-core Tab interface so extensions can correlate UI tabs with their tabstateview row. - TabbedSqlEditors: the '+' button becomes a Dropdown when extensions contribute newTab items, listing 'SQL Editor' (built-in) plus contributed tab types. - ExtensionsStartup: surface extension load errors as warning toasts instead of only logging. Rebased onto current apache/master (dropping the unmerged storage-tiers stack this was originally branched on). Adapted to master's evolution: SqlEditor now consumes master's reactive useViews() hook (#40915) instead of a custom onViewsChange() subscription, so the northPane view appears when an extension registers it asynchronously — without blocking initial render. ExtensionsStartup keeps master's non-blocking async load and adds the error-toast surfacing. Co-Authored-By: Amin Ghadersohi <amin.ghadersohi@gmail.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The flagged issue is correct. Exposing internal backend integer IDs in a public API can lead to security risks and tight coupling between the frontend and backend data models. To resolve this, you should use a UUID or a non-exported internal identifier for the tab state. Recommended FixIn /**
* The stable public identifier for this tab.
*/
publicId: string;If you need to map this to the backend ID, keep the backend ID as a private or internal property that is not exposed through the public extension API. Would you like me to fetch all other comments on this PR to validate and implement fixes for them as well? superset-frontend/packages/superset-core/src/sqlLab/index.ts |
There was a problem hiding this comment.
Code Review Agent Run #68d738
Actionable Suggestions - 3
-
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx - 2
- Missing unit tests for northPane feature · Line 124-318
- Storage listener key mismatch · Line 124-318
-
superset-frontend/packages/superset-core/src/sqlLab/index.ts - 1
- Type mismatch with backend API · Line 70-70
Review Details
-
Files reviewed - 5 · Commit Range:
88bc776..88bc776- superset-frontend/packages/superset-core/src/sqlLab/index.ts
- superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
- superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
- superset-frontend/src/SqlLab/contributions.ts
- superset-frontend/src/extensions/ExtensionsStartup.tsx
-
Files skipped - 0
-
Tools
- 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 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 evan@preset.io.
Documentation & Help
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41285 +/- ##
==========================================
- Coverage 64.34% 64.33% -0.01%
==========================================
Files 2653 2653
Lines 144963 145040 +77
Branches 33452 33472 +20
==========================================
+ Hits 93281 93318 +37
- Misses 49997 50037 +40
Partials 1685 1685
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:
|
…b a11y, extension load errors - Resolve the northPane localStorage key consistently as `tabViewId ?? id` for read, write, and the storage listener so backend-persisted tabs restore and cross-tab sync correctly. - Add keyboard activation to the SQL Lab new-tab button so extension-contributed tab types are reachable via Enter/Space. - Make ExtensionsLoader rethrow on failure so ExtensionsStartup surfaces a warning toast instead of swallowing the error; reset the promise to allow retry. - Clarify the public Tab.backendId docstring (opaque string, not an internal numeric id). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Addresses the review note about missing coverage for the northPane contribution surface: registers a view at sqllab.northPane, sets the per-tab localStorage key, and asserts SqlEditor renders the resolved view in place of the default editor pane. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…key type Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…orage Wire the backend-assigned tabViewId through to the public Tab.backendId field so extensions can correlate tabs with tabstateview rows, and wrap the northPane localStorage access in try/catch so a storage-restricted browser can't crash the editor mount. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review Agent Run #43c3dc
Actionable Suggestions - 1
-
superset-frontend/src/core/sqlLab/models.ts - 1
- Missing backendId test coverage · Line 37-68
Review Details
-
Files reviewed - 9 · Commit Range:
88bc776..190d77a- superset-frontend/packages/superset-core/src/sqlLab/index.ts
- superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
- superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
- superset-frontend/src/extensions/ExtensionsLoader.test.ts
- superset-frontend/src/extensions/ExtensionsLoader.ts
- superset-frontend/src/extensions/ExtensionsStartup.test.tsx
- superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx
- superset-frontend/src/core/sqlLab/index.ts
- superset-frontend/src/core/sqlLab/models.ts
-
Files skipped - 0
-
Tools
- 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 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 evan@preset.io.
Documentation & Help
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #9c9a7dActionable Suggestions - 0Review 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 |
SUMMARY
Lets extensions contribute first-class SQL Lab experiences: a full-pane replacement for the default editor/SouthPane split, and their own tab types in the
+new-tab dropdown.SqlLab/contributions.ts:sqllab.northPane(full-pane replacement) andsqllab.newTab(tab types in the+dropdown).PENDING_NORTH_PANE_VIEW_KEY: an extension sets thislocalStoragekey before callingsqlLab.createTab()to declare which northPane view the new tab opens with.SqlEditorconsumes/removes it on init, then persists the choice per-tab so the mode survives reloads.Tab.backendIdon the publicsuperset-coreTabinterface so extensions can correlate UI tabs with theirtabstateviewrow.TabbedSqlEditors: the+button becomes aDropdownwhen extensions contributenewTabitems, listing the built-in SQL Editor plus any contributed tab types.ExtensionsStartup: surfaces extension load errors as warning toasts instead of only logging.This is a clean re-target of #774 onto
apache:master. That PR was opened against a fork branch and stacked on the unmerged Tier 1/2 storage work, which inflated the diff and caused conflicts. The feature itself doesn't depend on the storage code, so this drops the storage stack and rebases just the contribution-surfaces commit (original authorship preserved).Adapted to
master's evolution since the branch forked:SqlEditorconsumesmaster's reactiveuseViews()hook (added in fix(extensions): load extensions async to avoid blocking initial page render #40915) instead of a customonViewsChange()subscription, so a northPane view appears when an extension registers it asynchronously, without blocking initial render.ExtensionsStartupkeepsmaster's non-blocking async extension load (fix(extensions): load extensions async to avoid blocking initial page render #40915) and adds the error-toast surfacing (dropping the originalinitialized-gate, which is no longer needed now that views are reactive).+icon is wrapped inmaster'sAddTabIconWrapperfor styling consistency.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (extension contribution surfaces; visible only with an extension registering
sqllab.northPane/sqllab.newTabviews).TESTING INSTRUCTIONS
cd superset-frontend && npx jest src/extensions/ExtensionsStartup.test.tsx src/SqlLab/components/SqlEditor/SqlEditor.test.tsx src/SqlLab/components/TabbedSqlEditors/TabbedSqlEditors.test.tsxWith
EnableExtensionson, an extension that registers asqllab.northPaneview (and setsPENDING_NORTH_PANE_VIEW_KEYbeforecreateTab()) opens a tab rendering that view in place of the default editor; registering asqllab.newTabcommand turns the+button into a dropdown.ADDITIONAL INFORMATION
EnableExtensions🤖 Generated with Claude Code