Skip to content

feat(sqllab,extensions): contribution surfaces for tab/pane extensions#41285

Open
rusackas wants to merge 6 commits into
masterfrom
feat/sqllab-contribution-points-clean
Open

feat(sqllab,extensions): contribution surfaces for tab/pane extensions#41285
rusackas wants to merge 6 commits into
masterfrom
feat/sqllab-contribution-points-clean

Conversation

@rusackas

Copy link
Copy Markdown
Member

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.

  • Adds two view locations in SqlLab/contributions.ts: sqllab.northPane (full-pane replacement) and sqllab.newTab (tab types in the + dropdown).
  • PENDING_NORTH_PANE_VIEW_KEY: an extension sets this localStorage key before calling sqlLab.createTab() to declare which northPane view the new tab opens with. SqlEditor consumes/removes it on init, then persists the choice per-tab so the mode survives reloads.
  • Exposes 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 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:

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A (extension contribution surfaces; visible only with an extension registering sqllab.northPane / sqllab.newTab views).

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

With EnableExtensions on, an extension that registers a sqllab.northPane view (and sets PENDING_NORTH_PANE_VIEW_KEY before createTab()) opens a tab rendering that view in place of the default editor; registering a sqllab.newTab command turns the + button into a dropdown.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: EnableExtensions
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

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>
@dosubot dosubot Bot added change:frontend Requires changing the frontend sqllab Namespace | Anything related to the SQL Lab labels Jun 22, 2026
Comment thread superset-frontend/packages/superset-core/src/sqlLab/index.ts
@bito-code-review

Copy link
Copy Markdown
Contributor

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 Fix

In superset-frontend/packages/superset-core/src/sqlLab/index.ts, update the Tab interface to use a UUID-based identifier instead of the backend integer ID:

  /**
   * 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

/**
   * The stable public identifier for this tab.
   */
  publicId: string;

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #68d738

Actionable Suggestions - 3
  • superset-frontend/src/SqlLab/components/SqlEditor/index.tsx - 2
  • superset-frontend/packages/superset-core/src/sqlLab/index.ts - 1
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

AI Code Review powered by Bito Logo

Comment thread superset-frontend/src/SqlLab/components/SqlEditor/index.tsx Outdated
Comment thread superset-frontend/packages/superset-core/src/sqlLab/index.ts
Comment thread superset-frontend/src/SqlLab/components/SqlEditor/index.tsx Outdated
Comment thread superset-frontend/src/SqlLab/components/SqlEditor/index.tsx Outdated
Comment thread superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx Outdated
Comment thread superset-frontend/src/extensions/ExtensionsStartup.tsx
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.83133% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.33%. Comparing base (7340d06) to head (25595b0).
⚠️ Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
...d/src/SqlLab/components/TabbedSqlEditors/index.tsx 25.64% 29 Missing ⚠️
...frontend/src/SqlLab/components/SqlEditor/index.tsx 80.64% 6 Missing ⚠️
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              
Flag Coverage Δ
javascript 68.54% <57.83%> (-0.03%) ⬇️

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.

rusackas and others added 2 commits June 22, 2026 09:38
…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>
Comment thread superset-frontend/packages/superset-core/src/sqlLab/index.ts
Comment thread superset-frontend/src/SqlLab/contributions.ts
@michael-s-molina michael-s-molina added the hold! On hold label Jun 22, 2026
Comment thread superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
rusackas and others added 2 commits June 22, 2026 10:56
…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>

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #43c3dc

Actionable Suggestions - 1
  • superset-frontend/src/core/sqlLab/models.ts - 1
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

AI Code Review powered by Bito Logo

Comment thread superset-frontend/src/core/sqlLab/models.ts
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 25595b0
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a399eb796b71f000822e3e0
😎 Deploy Preview https://deploy-preview-41285--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.

@bito-code-review

bito-code-review Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #9c9a7d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 190d77a..25595b0
    • superset-frontend/src/core/sqlLab/sqlLab.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • 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 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

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend hold! On hold packages size/L sqllab Namespace | Anything related to the SQL Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants