You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/06/22 16:10:53 UTC

[PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

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

   ### 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:
   - `SqlEditor` consumes `master`'s reactive `useViews()` hook (added in #40915) instead of a custom `onViewsChange()` subscription, so a northPane view appears when an extension registers it asynchronously, without blocking initial render.
   - `ExtensionsStartup` keeps `master`'s non-blocking async extension load (#40915) and adds the error-toast surfacing (dropping the original `initialized`-gate, which is no longer needed now that views are reactive).
   - The `+` icon is wrapped in `master`'s `AddTabIconWrapper` for styling consistency.
   
   ### 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
   
   <!-- Supersedes michael-s-molina/superset#774 -->
   - [ ] Has associated issue:
   - [x] Required feature flags: `EnableExtensions`
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   πŸ€– 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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3474594866


##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   **Suggestion:** `backendId` is assigned only from the optional constructor argument, so it stays `undefined` whenever callers do not pass it explicitly. In current SQL Lab state bootstrapping, persisted tabs commonly have only `id` populated (with no `tabViewId`), so extensions reading `Tab.backendId` will not be able to correlate tabs with backend `tabstateview` rows even though the tab is backend-backed. Ensure `backendId` is derived for persisted tabs (or update all constructors/callers to always pass it) so the new public API is consistently populated. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ SQL Lab extensions cannot correlate preloaded tabs to backend rows.
   - ⚠️ Extension features using backendId misbehave for bootstrapped tabs.
   - ⚠️ Inconsistent Tab.backendId semantics across different tab creation paths.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Enable SQL Lab backend persistence so the backend sends `tab_state_ids` in bootstrap,
   then inspect how initial SQL Lab state is built in
   `superset-frontend/src/SqlLab/reducers/getInitialState.ts:40-78`. For each backend tab
   (`tab_state_ids.forEach`), `QueryEditor` instances are created with `id: id.toString()`
   but **no `tabViewId` property**, even though `id` is the backend `tabstateview` row
   identifier.
   
   2. Start SQL Lab and obtain the current `sqlLab` Redux slice via `getSqlLabState()` as
   implemented in `superset-frontend/src/core/sqlLab/index.ts:62-65`. The `queryEditors`
   array contains these backend-backed editors with `id` set to the backend row ID and
   `tabViewId === undefined` (confirmed by the test comment "The preloaded editor has no
   tabViewId" in `src/core/sqlLab/sqlLab.test.ts:51-55`).
   
   3. From an extension (or in tests), call `sqlLab.getTabs()`, which is implemented at
   `superset-frontend/src/core/sqlLab/index.ts:104-108`. This iterates over `queryEditors`
   and calls `getTab(qe.id)` for each editor; `getTab` (line 182 onward) reads `tabViewId`
   from the `QueryEditor` and passes it as the `backendId` argument to `makeTab`:
   
      - `const { name, dbId, catalog, schema, tabViewId } = queryEditor;`
   
      - `return makeTab(id, name, dbId, catalog, schema, false, tabViewId);`
   
      Since these bootstrapped editors have `tabViewId === undefined`, `makeTab` is called
      with `backendId` undefined.
   
   4. `makeTab` constructs a `Tab` instance by calling the `Tab` constructor in
   `superset-frontend/src/core/sqlLab/models.ts:22-40` and forwards the `backendId` argument.
   Inside the constructor, the new field is assigned directly at `models.ts:68` as
   `this.backendId = backendId;` with no fallback logic. As a result, for backend-backed tabs
   whose state originated from `tab_state_ids` (where `id` is the backend `tabstateview`
   row), `Tab.backendId` remains `undefined` even though the tab is persisted and has a
   backend row ID. Any extension that relies on `Tab.backendId` to correlate UI tabs with
   `/tabstateview/<id>` rows (instead of re-implementing the `tabViewId ?? id` fallback used
   in `SqlLab/actions/sqlLab.ts`) will be unable to correlate these common bootstrapped tabs,
   breaking the intended correlation contract.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=69df7236ba9b4988bdc7d9b61c790f19&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=69df7236ba9b4988bdc7d9b61c790f19&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/core/sqlLab/models.ts
   **Line:** 68:68
   **Comment:**
   	*Api Mismatch: `backendId` is assigned only from the optional constructor argument, so it stays `undefined` whenever callers do not pass it explicitly. In current SQL Lab state bootstrapping, persisted tabs commonly have only `id` populated (with no `tabViewId`), so extensions reading `Tab.backendId` will not be able to correlate tabs with backend `tabstateview` rows even though the tab is backend-backed. Ensure `backendId` is derived for persisted tabs (or update all constructors/callers to always pass it) so the new public API is consistently populated.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=70e7ac47b75e4e4bf286b31a8c92e6207c4e7b2d7a6b5d88632b2717714e5088&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=70e7ac47b75e4e4bf286b31a8c92e6207c4e7b2d7a6b5d88632b2717714e5088&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3585095689


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +98,119 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();

Review Comment:
   Both `userOS` and `newTabTooltip` are still used further down in this file (the bottom tooltip and the mobile add-tab button), so this isn't dead 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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4836676295

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3709935121


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -274,6 +306,48 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      writeNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY, null);
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });

Review Comment:
   Good catch, only the active tab consumes the pending key now, so a stale one left by a failed `createTab()` cant get picked up by an unrelated tab mounting later.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5933756080

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4640321597


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +74,41 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),
+              ),
+            );
+          }
+        })
+        .catch(async (error: unknown) => {

Review Comment:
   Fixed in 0dee0008. A 403 or 404 from the extension list now skips the startup toast. Other failures still show the response detail. Added tests for both expected statuses and a 503.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3475077098


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {
+          supersetCore.utils.logging.error(
+            'Error setting up extensions:',
+            error,
+          );
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),
+          );
+        });

Review Comment:
   βœ… **Customized review instruction saved!**
   
   **Instruction:**
   > Do not require per-extension extension load failures to reject or block initialization; log individual failures and continue loading the remaining extensions. Reserve the warning toast for top-level API fetch failures.
   
   **Applied to:**
     - `superset-frontend/src/extensions/**`
   
   ---
   πŸ’‘ *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*



##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   βœ… **Customized review instruction saved!**
   
   **Instruction:**
   > Do not derive `backendId` from `id` in `Tab`; it should only mirror `tabViewId`. If bootstrapped tabs need a backend identifier, populate `tabViewId` during bootstrap instead of overloading `backendId` here.
   
   **Applied to:**
     - `superset-frontend/src/core/sqlLab/**`
   
   ---
   πŸ’‘ *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3585098043


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +98,119 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();

Review Comment:
   <!-- Bito Reply -->
   The suggestion to remove `userOS` and `newTabTooltip` is not appropriate because these constants are actively used in other parts of the file, such as the bottom tooltip and the mobile add-tab button. Removing them would break existing functionality.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3584101836


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +98,119 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Dead code from refactor</b></div>
   <div id="fix">
   
   Module-level `userOS` constant is now unused after replacing the inline `addIcon` JSX with `NewTabButton`. Remove both `userOS` and `newTabTooltip` to eliminate dead code and reduce maintenance confusion.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a31f8e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "autoweave-bot (via GitHub)" <gi...@apache.org>.
autoweave-bot commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5015057887

   <!-- subweave:map -->
   Ooh, love how this makes SQL Lab extensions way easier to manage! 🀩
   [Explore here β†’](https://subweave.com/view/github.com/apache/superset/pull/41285?utm_source=github&utm_medium=pr-comment&utm_campaign=autoweave&utm_content=quip&utm_term=apache%2Fsuperset)
   
   [![Subweave map of apache/superset#41285](https://subweave.com/view/github.com/apache/superset/pull/41285.preview.svg)](https://subweave.com/view/github.com/apache/superset/pull/41285?utm_source=github&utm_medium=pr-comment&utm_campaign=autoweave&utm_content=map&utm_term=apache%2Fsuperset)
   
   <sub>Maintainer? [Turn off weaves from non-maintainers β†’](https://subweave.com/account?repo=apache%2Fsuperset&utm_source=github&utm_medium=pr-comment&utm_campaign=autoweave&utm_content=optout&utm_term=apache%2Fsuperset#github)</sub>
   <sub>Carefully crafted by [Subweave](https://subweave.com/?utm_source=github&utm_medium=pr-comment&utm_campaign=autoweave&utm_content=footer&utm_term=apache%2Fsuperset) · 🧢 used ~438k LLM tokens</sub>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4770418142

   <!-- Bito Reply -->
   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:
   
   ```typescript
     /**
      * 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;
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4640325568


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,14 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned identifier for this tab. Exposed as an opaque
+   * string so the public extension API does not leak the backend's internal
+   * numeric tab id. Set once the tab has been persisted to the backend;

Review Comment:
   Good distinction. 0dee0008 documents this as the backend tab_state row ID serialized to a string, undefined until the first save.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3518588131


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +97,114 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command);

Review Comment:
   **Suggestion:** The command execution is asynchronous but its returned Promise is ignored, so command failures become unhandled promise rejections and can leave the add-tab flow in a silent broken state. Handle the Promise explicitly (await or catch) and surface failures to the user/logs. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   ⚠️ New-tab dropdown uses commands.executeCommand for extension actions.
   ❌ Failing command callbacks produce unhandled promise rejections, no feedback.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Register a SQL Lab extension command contributing a new-tab type under the
   `sqllab.newTab` menu so it appears in the dropdown built from
   `menus.getMenu(ViewLocations.sqllab.newTab)?.primary` in
   `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:116-120`.
   
   2. Open SQL Lab and click the `+` new-tab button; the capture-phase handler in
   `NewTabButton` at `TabbedSqlEditors/index.tsx:170-192` toggles `open`, causing the AntD
   `Dropdown` to render items whose `onClick` handlers are defined in
   `TabbedSqlEditors/index.tsx:145-151`.
   
   3. Click the extension-provided tab type; its click handler executes
   `commands.executeCommand(item.command)` at
   `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:150` without awaiting
   or attaching a `.catch` to the returned Promise from `executeCommand`.
   
   4. If the extension’s registered callback (via `commands.registerCommand` in
   `superset-frontend/src/core/commands/index.ts:29-50`) returns a Promise that rejects (for
   example, due to an API failure while creating the tab), the rejection surfaces as an
   unhandled Promise rejection from `executeCommand` (defined async in
   `src/core/commands/index.ts:52-61`), producing console-level errors with no user-visible
   feedback while the add-tab interaction silently fails.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1ee67b64b8554fe186571c4ec4d721b8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1ee67b64b8554fe186571c4ec4d721b8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 150:150
   **Comment:**
   	*Possible Bug: The command execution is asynchronous but its returned Promise is ignored, so command failures become unhandled promise rejections and can leave the add-tab flow in a silent broken state. Handle the Promise explicitly (await or catch) and surface failures to the user/logs.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=f1ba956a15388bb130b3a496a744d181c16435985b728c94fdfa6d7acded2c92&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=f1ba956a15388bb130b3a496a744d181c16435985b728c94fdfa6d7acded2c92&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3498042192


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -93,6 +96,114 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command);
+            },
+          } as MenuItemType,
+        ];
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = useCallback(() => {
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);

Review Comment:
   **Suggestion:** The new add-tab interception path creates tabs without calling the existing timing marker used by other add-tab entry points, so add-tab performance telemetry will be missing/inconsistent for β€œ+” button creations. Call the same timing marker before invoking the add-tab action in this branch (and the SQL Editor dropdown branch) to keep instrumentation behavior consistent. [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   ❌ SQL Lab tab creation telemetry missing for plus-button tabs.
   ⚠️ Performance metrics inconsistent between keyboard and mouse new tabs.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Render the SQL Lab tab strip via the `TabbedSqlEditors` component in
   `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:209-380`. This
   component is used as the main SQL Lab tab UI in tests (see
   `TabbedSqlEditors.test.tsx:43-47`, which calls `render(<TabbedSqlEditors />, { useRedux:
   true, initialState })`).
   
   
   
   2. Ensure the Redux `sqlLab.queryEditors` array is non-empty so the tabs render, and note
   that the `StyledEditableTabs` instance at `index.tsx:367-377` receives `addIcon` as
   `<NewTabButton onAddSqlEditor={() => newQueryEditor()} />` and `onEdit={handleEdit}` where
   `handleEdit` calls `Logger.markTimeOrigin()` before creating a tab when `action === 'add'`
   (`index.tsx:277-288`).
   
   
   
   3. Click the "+" add-tab button in the UI. The native button wrapping `addIcon` receives
   the click, and the `useEffect` hook in `NewTabButton` at `index.tsx:169-191` adds a
   capture-phase `click` listener (`handleActivate`) on that button. This listener calls
   `activate()` and invokes `e.preventDefault()` and `e.stopPropagation()`, so the underlying
   AntD Tabs `onEdit('add')` handler (which calls `Logger.markTimeOrigin()` in `handleEdit`)
   is never reached for this interaction.
   
   
   
   4. In `activate()` at `index.tsx:157-165`, when no extensions contribute `sqllab.newTab`
   items (`menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? []` yields an empty array),
   the code executes the existing snippet:
   
   160 if (primaryItems.length === 0) {
   
   161 onAddSqlEditor();
   
   162 } else {
   
   163 setOpen(prev => !prev);
   
   164 }
   
   `onAddSqlEditor` is the `newQueryEditor` callback defined at `index.tsx:252-254`, which
   simply calls `actions.addNewQueryEditor()` without `Logger.markTimeOrigin()`. Similarly,
   the built-in dropdown item "SQL Editor" in `dropdownItems` (`index.tsx:120-128`) calls
   `onAddSqlEditor()` directly. In contrast, the keyboard shortcut path in `SqlEditor`
   (`superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:12-25`) and the original
   tab-add path in `handleEdit` (`index.tsx:285-288`) both call `Logger.markTimeOrigin()`
   before `addNewQueryEditor()`. As a result, clicking the "+" button or choosing "SQL
   Editor" from its dropdown creates new tabs without updating `Logger.timeOriginOffset`, so
   any performance telemetry relying on `Logger.getTimestamp()` for SQL Lab tab creation will
   be missing or inconsistent compared to keyboard-initiated tab creations.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4d3700a3e41d412ab058c5a846311342&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4d3700a3e41d412ab058c5a846311342&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 160:163
   **Comment:**
   	*Incomplete Implementation: The new add-tab interception path creates tabs without calling the existing timing marker used by other add-tab entry points, so add-tab performance telemetry will be missing/inconsistent for β€œ+” button creations. Call the same timing marker before invoking the add-tab action in this branch (and the SQL Editor dropdown branch) to keep instrumentation behavior consistent.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=c952f6b4bd3502aa056970a562006935734037ddb410e357cc444fc0451e78e9&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=c952f6b4bd3502aa056970a562006935734037ddb410e357cc444fc0451e78e9&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3474577514


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {
+          supersetCore.utils.logging.error(
+            'Error setting up extensions:',
+            error,
+          );
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),
+          );
+        });

Review Comment:
   **Suggestion:** This code assumes `initializeExtensions()` rejects whenever an extension fails to load, but `ExtensionsLoader.initializeExtension()` currently catches and swallows per-extension load errors, so the promise can still resolve with partial failures. That means this success branch can run even when some extensions are broken, and the warning toast path never executes. Make the loader propagate extension init failures (or return a failure summary and handle it here) so users are actually notified when any extension fails. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Extensions with failing remote entries silently fail to load.
   - ⚠️ Users see success log despite missing extension features.
   - ⚠️ Warning toast never fires for partial extension failures.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Start the Superset frontend so that `App` renders `ExtensionsStartup` (see
   `superset-frontend/src/views/App.tsx:17-19`, where `<ExtensionsStartup>` wraps
   `<AppContent />`).
   
   2. Ensure the extensions feature flag is enabled so `EnableExtensions` is true; when a
   user session is present (`userId` not null), the `useEffect` in
   `superset-frontend/src/extensions/ExtensionsStartup.tsx:53-95` executes and, at lines
   75-77, calls `ExtensionsLoader.getInstance().initializeExtensions()` if
   `isFeatureEnabled(FeatureFlag.EnableExtensions)` is true.
   
   3. Configure the backend `/api/v1/extensions/` endpoint to return at least one extension
   whose `remoteEntry` URL will fail to load (for example, a 404 or invalid host) β€” this
   value is consumed by `SupersetClient.get` in
   `superset-frontend/src/extensions/ExtensionsLoader.ts:59-68`, which then calls
   `initializeExtension` for each `Extension` in the `result` array.
   
   4. When the browser tries to load that broken `remoteEntry`, `loadModule` in
   `ExtensionsLoader.loadModule`
   (`superset-frontend/src/extensions/ExtensionsLoader.ts:112-144`) rejects; this rejection
   is caught inside `initializeExtension` at
   `superset-frontend/src/extensions/ExtensionsLoader.ts:93-105`, which logs `Failed to
   initialize extension ...` but does not rethrow, so `Promise.all` in `initializeExtensions`
   still resolves and logs `logging.info('Extensions initialized successfully.')` at line 74.
   As a result, the `initializeExtensions()` promise returned to `ExtensionsStartup`
   resolves, the `.then` branch at `ExtensionsStartup.tsx:78-81` runs, and the `.catch` at
   `ExtensionsStartup.tsx:83-90` (which would dispatch `addWarningToast(...)`) never
   executes, even though at least one extension failed to load and its contributions are
   missing.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=88a4bef2a2c74b828416a4f3c3335b88&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=88a4bef2a2c74b828416a4f3c3335b88&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/extensions/ExtensionsStartup.tsx
   **Line:** 76:91
   **Comment:**
   	*Api Mismatch: This code assumes `initializeExtensions()` rejects whenever an extension fails to load, but `ExtensionsLoader.initializeExtension()` currently catches and swallows per-extension load errors, so the promise can still resolve with partial failures. That means this success branch can run even when some extensions are broken, and the warning toast path never executes. Make the loader propagate extension init failures (or return a failure summary and handle it here) so users are actually notified when any extension fails.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=fa9dd72aab9e4cc8c96ab3ba44e272f0899946cdcc333a6f8ad48febb5ce9607&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=fa9dd72aab9e4cc8c96ab3ba44e272f0899946cdcc333a6f8ad48febb5ce9607&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4770402205

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4141901842


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +191,37 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,

Review Comment:
   <!-- Bito Reply -->
   The suggestion to use an options object for `makeTab` is appropriate. It improves code readability and maintainability by making the arguments self-describing, which avoids the ambiguity of positional boolean placeholders.



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +261,56 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  const originalInitialize = ExtensionsLoader.prototype.initializeExtensions;
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    const { messageToasts } = store.getState() as unknown as {
+      messageToasts: { text: string }[];
+    };
+    expect(
+      messageToasts.some(toast =>
+        /Some extensions failed to load: Broken Extension/.test(toast.text),
+      ),
+    ).toBe(true);
+  });
+
+  ExtensionsLoader.prototype.initializeExtensions = originalInitialize;

Review Comment:
   <!-- Bito Reply -->
   The changes correctly address the identified issues. Moving the prototype restoration to `afterEach` ensures it runs regardless of test success or failure, preventing mock leakage, and extracting the toast-text assertion into a helper function improves maintainability and consistency across the test suite.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -265,25 +424,7 @@ function TabbedSqlEditors({
       onEdit={handleEdit}
       popupClassName={SQLLAB_TAB_OVERFLOW_POPUP_CLASS}
       type={queryEditors?.length === 0 ? 'card' : 'editable-card'}
-      addIcon={
-        <Tooltip
-          id="add-tab"
-          placement="left"
-          title={
-            userOS === 'Windows'
-              ? t('New tab (Ctrl + q)')
-              : t('New tab (Ctrl + t)')
-          }
-        >
-          <Icons.PlusOutlined
-            iconSize="l"
-            css={css`
-              vertical-align: middle;
-            `}
-            data-test="add-tab-icon"
-          />
-        </Tooltip>
-      }
+      addIcon={<NewTabButton onAddSqlEditor={() => newQueryEditor()} />}

Review Comment:
   <!-- Bito Reply -->
   The suggestion is correct. Passing the stable `newQueryEditor` callback directly instead of creating a new anonymous function on every render prevents unnecessary re-renders of the `NewTabButton` component and ensures that memoized dependencies remain stable.
   
   **superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx**
   ```
   addIcon={<NewTabButton onAddSqlEditor={newQueryEditor} />}
   ```



##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,94 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );

Review Comment:
   <!-- Bito Reply -->
   The suggestion to extract the `northPane` registration and storage-key derivation into shared helpers is a valid and recommended improvement. It addresses the code duplication identified in the review, ensuring that the fixture remains consistent if the view ID or key format changes in the future. Applying this refactoring will improve maintainability and reduce the risk of synchronization errors across the test suite.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4141906139


##########
superset/translations/en/LC_MESSAGES/messages.po:
##########
@@ -14254,6 +14284,12 @@ msgid ""
 "exporting them:"
 msgstr ""
 
+msgid ""
+"The following charts were omitted because their size cannot be determined"
+" before they run. Ask an administrator to enable background exports to "
+"include them."
+msgstr ""
+

Review Comment:
   <!-- Bito Reply -->
   The suggestion is correct. The translation entry `msgid` is indeed used in the codebase, and the grep command failed because the source string is split across multiple lines in `superset/dashboards/excel_export/email.py`. Since the entry is not orphaned, it should be kept.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5536078767

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4078342368


##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',
+    // Extensions register tab-type commands here. When any are present the
+    // "+" new-tab button becomes a dropdown listing all registered tab types
+    // plus the built-in SQL Editor option.
+    newTab: 'sqllab.newTab',
   },
 } as const;
+
+/**
+ * localStorage key an extension sets before calling createTab() to declare
+ * which northPane view the new tab should open with.  The value must be the
+ * view ID passed to views.registerView() (e.g. "my-ext.northPane").  SqlEditor
+ * consumes and removes this key during initialization, then persists the chosen
+ * view ID under a per-tab key so the mode survives page reloads.
+ *
+ * @example
+ * // In an extension's newTab command handler:
+ * localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'my-ext.northPane');
+ * sqlLab.createTab({ title: 'My View' });
+ */
+export const PENDING_NORTH_PANE_VIEW_KEY = 'sqllab.pendingNorthPaneView';

Review Comment:
   Good call, that shared mailbox was a footgun. I dropped `PENDING_NORTH_PANE_VIEW_KEY` entirely and moved it onto tab-creation state: `createTab({ northPaneViewId })` stamps the view onto the new query editor itself, and SqlEditor reads it from there (still persisting the per-tab localStorage entry so it survives a reload that rehydrates from the backend without the field).



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -80,6 +80,19 @@ const findQueryEditor = (editorId: string) => {
   return editor;
 };
 
+/**
+ * Resolves the backend-assigned id for a query editor, if it has one. A tab
+ * created locally and later synced carries it in `tabViewId`; a tab hydrated
+ * from the backend on page load uses that id directly as its `queryEditor.id`
+ * (with `inLocalStorage` unset). Only a tab that still lives solely in local
+ * storage has no backend id yet.
+ */
+const resolveBackendId = (

Review Comment:
   Good catch. `extractBaseData()` resolves the editor by `id` or `tabViewId` (since a synced tab's query carries the backend id as `sqlEditorId`) and runs it through the same `resolveBackendId()` as the other paths, with tests for both shapes.



##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',

Review Comment:
   Yep, missed the public union. Added `northPane` and `newTab` to `SqlLabLocation` in `superset-core`.



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,30 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),
+              ),
+            );
+          }
+        })
+        .catch((error: unknown) => {
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),

Review Comment:
   Agreed, `[object Response]` is useless in a toast. Swapped in `getClientErrorObject()` so the message/status from the failed fetch is what gets shown, with a test covering a 403 Response rejection.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "geido (via GitHub) via notifications" <no...@superset.apache.org>.
geido commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-6742528790

   Recordings for my inline comments, from a local build of 0592c2e with `ENABLE_EXTENSIONS` on and a small test extension:
   
   https://github.com/user-attachments/assets/26256ffb-1668-4a42-aa51-a29466fff79c
   
   https://github.com/user-attachments/assets/90eddd42-e23a-4551-9943-c51c23f6660e
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5177061344

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453925845


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));

Review Comment:
   Good catch β€” fixed. The read and the storage listener now resolve the key the same way as the write (`tabViewId ?? id`), so persisted tabs restore correctly.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(
+      queryEditor.tabViewId ?? queryEditor.id,
+    );
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [queryEditor.tabViewId, queryEditor.id, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(queryEditor.id)) {
+        setNorthPaneViewId(e.newValue || null);

Review Comment:
   Yep β€” the listener now keys off the same resolved `tabViewId ?? id` as the write, so cross-window sync holds for persisted tabs.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -98,6 +101,82 @@ const AddTabIconWrapper = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <AddTabIconWrapper>
+    <Icons.PlusOutlined iconSize="l" data-test="add-tab-icon" />
+  </AddTabIconWrapper>
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
+        <span role="button" tabIndex={0} onClick={handleClick}>
+          {PlusIcon}

Review Comment:
   Fixed β€” added an `onKeyDown` so Enter/Space hit the same path as the click and open the extension dropdown instead of antd's default add-tab.



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -72,9 +75,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {
+          supersetCore.utils.logging.error(
+            'Error setting up extensions:',
+            error,
+          );
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),
+          );
+        });

Review Comment:
   Right β€” the loader was swallowing its own failure. Made `initializeExtensions` rethrow (and reset the promise so a retry can happen), so the `.catch` here actually fires the warning toast now.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3474543523


##########
superset-frontend/src/core/sqlLab/sqlLab.test.ts:
##########
@@ -561,10 +561,28 @@ test('createTab dispatches ADD_QUERY_EDITOR and returns the new tab', async () =
 
   expect(tab).toBeDefined();
   expect(tab.title).toBe('Custom Tab');
+  // A freshly created tab has no backend identifier until it syncs.
+  expect(tab.backendId).toBeUndefined();
   const tabs = sqlLab.getTabs();
   expect(tabs.length).toBeGreaterThanOrEqual(2);
 });
 
+test('getTabs leaves backendId undefined when the editor has no tabViewId', () => {
+  // The preloaded editor has no tabViewId, so its backendId stays undefined.
+  const [tab] = sqlLab.getTabs();
+  expect(tab.id).toBe(EDITOR_ID);
+  expect(tab.backendId).toBeUndefined();
+});
+
+test('getTabs surfaces the editor tabViewId as the tab backendId', () => {
+  // Stamp a backend id onto the editor and confirm it flows through to the tab.
+  (mockStore.getState().sqlLab.queryEditors[0] as any).tabViewId = 'backend-42';

Review Comment:
   **Suggestion:** Replace the `any` cast with a concrete typed shape (for example, a `QueryEditor` extension that includes optional `tabViewId`) or a narrower type assertion so this test remains type-safe. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? πŸ€” </b></summary>
   
   This is new TypeScript test code and it directly uses `any`, which is explicitly disallowed by the custom rule. The suggestion correctly identifies a real rule violation and recommends replacing it with a concrete type or narrower assertion.
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=853b55900dd242eca7fca8901b8dc532&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=853b55900dd242eca7fca8901b8dc532&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/core/sqlLab/sqlLab.test.ts
   **Line:** 579:579
   **Comment:**
   	*Custom Rule: Replace the `any` cast with a concrete typed shape (for example, a `QueryEditor` extension that includes optional `tabViewId`) or a narrower type assertion so this test remains type-safe.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=bd0eb918bc04722d26ecdbc5f19fc8fdd40bf53fb35c09dff68b8b513f8ab3ef&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=bd0eb918bc04722d26ecdbc5f19fc8fdd40bf53fb35c09dff68b8b513f8ab3ef&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3475072136


##########
superset-frontend/src/core/sqlLab/sqlLab.test.ts:
##########
@@ -561,10 +561,28 @@ test('createTab dispatches ADD_QUERY_EDITOR and returns the new tab', async () =
 
   expect(tab).toBeDefined();
   expect(tab.title).toBe('Custom Tab');
+  // A freshly created tab has no backend identifier until it syncs.
+  expect(tab.backendId).toBeUndefined();
   const tabs = sqlLab.getTabs();
   expect(tabs.length).toBeGreaterThanOrEqual(2);
 });
 
+test('getTabs leaves backendId undefined when the editor has no tabViewId', () => {
+  // The preloaded editor has no tabViewId, so its backendId stays undefined.
+  const [tab] = sqlLab.getTabs();
+  expect(tab.id).toBe(EDITOR_ID);
+  expect(tab.backendId).toBeUndefined();
+});
+
+test('getTabs surfaces the editor tabViewId as the tab backendId', () => {
+  // Stamp a backend id onto the editor and confirm it flows through to the tab.
+  (mockStore.getState().sqlLab.queryEditors[0] as any).tabViewId = 'backend-42';

Review Comment:
   Fixed β€” cast to `QueryEditor` (it already carries optional `tabViewId`) instead of `any`.



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {

Review Comment:
   Fixed β€” typed the rejection param as `unknown`.



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -291,6 +289,17 @@ test('continues rendering children even when ExtensionsLoader initialization fai
     ).toBeInTheDocument();
   });
 
+  // The failure must reach the user as a warning toast rather than being
+  // swallowed silently.
+  await waitFor(() => {
+    const toasts = (store.getState() as any).messageToasts;

Review Comment:
   Fixed β€” narrowed the `getState()` result to the `messageToasts` shape instead of `any`.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5700522639

   Agreed on the `localStorage` race, @sadpandajoe. Two extensions calling `createTab()` back to back could stomp on each other before the first tab mounts. Worth sorting out before this comes off hold.
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "geido (via GitHub) via notifications" <no...@superset.apache.org>.
geido commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4513826143


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +74,41 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),
+              ),
+            );
+          }
+        })
+        .catch(async (error: unknown) => {

Review Comment:
   I think this also toasts on each full page load when `/api/v1/extensions/` returns 403 or 404: a role without `can_get_list` on `ExtensionsRestApi`, or the flag on per request but off at server start (where the Extensions page shows its own "not enabled" alert). Would it make sense to skip the toast on 403/404?
   
   https://github.com/user-attachments/assets/26256ffb-1668-4a42-aa51-a29466fff79c



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1048,6 +1057,34 @@ const SqlEditor: FC<Props> = ({
         >
           <Skeleton active />
         </div>
+      ) : northPaneViewId &&
+        northPaneViews.some(v => v.id === northPaneViewId) ? (
+        <Flex
+          vertical
+          css={css`
+            height: 100%;
+          `}
+        >
+          <SqlEditorTopBar

Review Comment:
   IIUC the Mousetrap hotkeys are still bound here, so Ctrl+Enter outside an input runs the tab's hidden `SELECT ...`. Would it make sense to bind the run/format keys to a no-op in this mode? Similar story for `sqllab.editor` toolbar actions, whose `await getEditor()` stays pending without an editor.
   
   https://github.com/user-attachments/assets/90eddd42-e23a-4551-9943-c51c23f6660e



##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,14 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned identifier for this tab. Exposed as an opaque
+   * string so the public extension API does not leak the backend's internal
+   * numeric tab id. Set once the tab has been persisted to the backend;

Review Comment:
   nit: IIUC this is still the tabstateview integer id, just as a string (`json.id.toString()`), so the "does not leak" part might read a bit off. Maybe something like "the id of the tab's backend tab_state row, as a string, undefined until first saved"?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-6142650161

   Thanks @EnxDev, the last push (the awaited `userEvent.type` in the add-tab test) got CI green, so the red you saw on the earlier head should be gone. 
   
   The localStorage cleanup on tab close is a fair nit, but I'd rather not hold this up for it. Happy to do it as a follow-up if you feel strongly. 
   
   The `hold!` label is what's blocking merge now, so if you think this isn't particularly controversial and can advocate for it in the Extensions working group, maybe it's OK to remove that and merge it? Or do you think we need a SIP for this (cc @michael-s-molina / @villebro)


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5789387349

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-7034800679

   Thanks @geido for the recordings. I pushed the startup warning, keyboard shortcut, toolbar and tab ID changes in 0dee0008. All 48 tests across the three affected suites passed. The existing hold is still in place.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453928259


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   <!-- Bito Reply -->
   The suggestion to change the type from `string` to `number` is appropriate because it aligns the frontend type definition with the backend API's actual return type, as noted in the review. This change helps prevent potential type mismatches and runtime errors when handling the backend-assigned ID.
   
   **superset-frontend/packages/superset-core/src/sqlLab/index.ts**
   ```
   70: -  backendId?: string;
    70: +  backendId?: number;
   ```



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(
+      queryEditor.tabViewId ?? queryEditor.id,
+    );
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [queryEditor.tabViewId, queryEditor.id, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(queryEditor.id)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [queryEditor.id]);

Review Comment:
   <!-- Bito Reply -->
   The suggestion to align the storage listener key with the persistence key is correct and necessary for consistent cross-tab state synchronization. By ensuring the listener watches `NORTH_PANE_VIEW_KEY(queryEditor.tabViewId ?? queryEditor.id)`, you prevent the synchronization issues that occur when `tabViewId` and `id` differ.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3475073463


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {
+          supersetCore.utils.logging.error(
+            'Error setting up extensions:',
+            error,
+          );
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),
+          );
+        });

Review Comment:
   This is intentional β€” one broken extension shouldn't blank out the others, so `initializeExtension` logs each failure individually and keeps going. The toast is reserved for a top-level failure (the API fetch), which does reject and surface. A per-extension failure summary is a fair future enhancement but out of scope here.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -98,6 +101,101 @@ const AddTabIconWrapper = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <AddTabIconWrapper>
+    <Icons.PlusOutlined iconSize="l" data-test="add-tab-icon" />
+  </AddTabIconWrapper>
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = () => {
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    activate();
+  };
+
+  const handleKeyDown = (e: React.KeyboardEvent) => {
+    // The same wrapper button activates on Enter/Space; intercept those keys so
+    // keyboard users reach the extension new-tab dropdown rather than antd's
+    // default add-tab path.
+    if (e.key === 'Enter' || e.key === ' ') {
+      e.preventDefault();
+      e.stopPropagation();
+      activate();
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        <span
+          role="button"
+          tabIndex={0}
+          onClick={handleClick}
+          onKeyDown={handleKeyDown}
+        >

Review Comment:
   Both paths are already wired on the focusable inner element: `tabIndex={0}` + `onKeyDown` handles Enter/Space for keyboard users, and `onClick` calls `stopPropagation()` before antd's `onEdit("add")` can fire. This is the conventional antd `addIcon` pattern, so the dropdown owns activation.



##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   Intentional β€” `backendId` mirrors `tabViewId` only, and the `getTabs leaves backendId undefined when the editor has no tabViewId` test documents that. Deriving it from `id` for bootstrapped tabs conflates two different identifiers; I'd rather populate `tabViewId` at bootstrap than overload `backendId` here.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3494000805


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -93,6 +96,113 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command);
+            },
+          } as MenuItemType,
+        ];
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = () => {
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    activate();
+  };
+
+  const handleKeyDown = (e: React.KeyboardEvent) => {
+    // The same wrapper button activates on Enter/Space; intercept those keys so
+    // keyboard users reach the extension new-tab dropdown rather than antd's
+    // default add-tab path.
+    if (e.key === 'Enter' || e.key === ' ') {
+      e.preventDefault();
+      e.stopPropagation();
+      activate();
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        <span
+          role="button"
+          tabIndex={0}
+          onClick={handleClick}
+          onKeyDown={handleKeyDown}
+        >
+          {PlusIcon}
+        </span>

Review Comment:
   Good catch β€” moved the interception to a capture-phase `click` listener on antd's add `<button>` itself, so Enter/Space go through the dropdown now too. Dropped the redundant span tab stop while I was at it.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5534730372

   @EnxDev thanks for the thorough pass. The dropdown now closes on an outside mousedown or Escape (kept `trigger={[]}`, added the window listeners you described), with tests for both plus Enter on the focused `+` button.
   
   Also moved the tooltip back into render, dropped the duplicate `markTimeOrigin()` and the double error log, cleaned up the orphaned id-keyed localStorage entry once `tabViewId` lands, and added the non-active tab test for the pending key gate.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4153056527


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -211,12 +252,18 @@ function extractBaseData(action: QueryAction): {
     queryLimit,
   } = query;
 
+  // Resolve backendId through the same path as every other Tab construction
+  // so query-event listeners can correlate the tab with its tabstateview row.
+  const queryEditor = findQueryEditorByAnyId(sqlEditorId ?? undefined);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>O(n) editor lookup per event</b></div>
   <div id="fix">
   
   `findQueryEditorByAnyId(sqlEditorId ?? undefined)` runs a linear scan of all `queryEditors` on every START_QUERY/STOP_QUERY/QUERY_SUCCESS/QUERY_FAILED event via `extractBaseData`, and the `predicate` wrapper already does a second `findQueryEditor` scan for the same action. On sessions with many tabs and high query volume this is repeated O(n) work per event; consider a memoized id→editor map.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #45b62b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +274,49 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    expect(
+      getToastTexts(store).some(text =>
+        /Some extensions failed to load: Broken Extension/.test(text),
+      ),
+    ).toBe(true);
+  });

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Warning type never asserted</b></div>
   <div id="fix">
   
   The test names claim a *warning* toast, but assertions at 295-301 and 333-337 check only `text`. `addWarningToast` sets `toastType` in the ADD_TOAST payload, so asserting `toastType === ToastType.Warning` would pin the severity; today downgrading `addWarningToast` to `addInfoToast` in `ExtensionsStartup` ships these tests green.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #45b62b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -440,7 +487,7 @@ const onDidCloseTab: typeof sqlLabApi.onDidCloseTab = (
         action.queryEditor.dbId ?? 0,
         action.queryEditor.catalog,
         action.queryEditor.schema,
-        true, // closed
+        { closed: true, backendId: resolveBackendId(action.queryEditor) },

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Closed tab loses backendId</b></div>
   <div id="fix">
   
   The removed `true, // closed` argument passed the editor id as the 7th positional arg, which `makeTab` mapped to `backendId`. The replacement resolves `backendId` via `resolveBackendId`, which returns `undefined` for a tab still in local storage (`inLocalStorage` set, no `tabViewId`), so `onDidCloseTab` listeners now receive a Tab with no backend id where they previously got the editor id. Please fall back to `action.queryEditor.id`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #45b62b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -557,6 +605,9 @@ const createTab: typeof sqlLabApi.createTab = async (
       inheritedValues.queryLimit ?? common?.conf?.DEFAULT_SQLLAB_LIMIT,
     autorun: false,
     name,
+    ...(options?.northPaneViewId && {
+      northPaneViewId: options.northPaneViewId,
+    }),

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>northPaneViewId silently dropped</b></div>
   <div id="fix">
   
   `createTab` accepts `options.northPaneViewId` and spreads it into `newQueryEditor`, but the returned `makeTab(...)` call at lines 624-631 passes only `backendId` β€” the `Tab` model has no `northPaneViewId` field, so the option is accepted and silently discarded. `CreateTabOptions.northPaneViewId` documents that the tab opens with a registered north-pane view. Please plumb the value through or surface an error.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #45b62b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -275,6 +304,56 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout. A tab created through the extension API carries the
+  // requested view on its own query editor state, so it can never be picked
+  // up by another tab. Editors hydrated from the backend on reload don't
+  // carry the field, so fall back to the per-tab localStorage entry that the
+  // effect below keeps in sync.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(
+    () =>
+      queryEditor.northPaneViewId ??
+      readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId)),
+  );
+
+  // Tracks the storage id last written so that, when a tab syncs to the
+  // backend and `tabViewId` arrives, the entry under the old id-keyed key is
+  // removed rather than left orphaned in localStorage.
+  const northPaneStorageIdRef = useRef(northPaneStorageId);
+
+  useEffect(() => {
+    if (northPaneStorageIdRef.current !== northPaneStorageId) {
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageIdRef.current),
+        null,
+      );
+      northPaneStorageIdRef.current = northPaneStorageId;
+    }
+    writeNorthPaneStorage(
+      NORTH_PANE_VIEW_KEY(northPaneStorageId),
+      northPaneViewId,
+    );
+  }, [northPaneStorageId, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(northPaneStorageId)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [northPaneStorageId]);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Storage logic inline in component</b></div>
   <div id="fix">
   
   This block adds localStorage persistence, per-tab key migration, and cross-tab `storage`-event sync inline in an already ~1100-line component whose primary responsibility is rendering the editor. Extracting it into a `useNorthPaneView(queryEditor)` hook isolates the storage concern, makes it independently testable, and keeps this file focused on layout. Behavior is unchanged.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #45b62b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4154935420


##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +274,49 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    expect(
+      getToastTexts(store).some(text =>
+        /Some extensions failed to load: Broken Extension/.test(text),
+      ),
+    ).toBe(true);
+  });

Review Comment:
   <!-- Bito Reply -->
   The suggestion to assert `toastType === ToastType.Warning` is appropriate. It improves the test by ensuring that the severity of the toast is explicitly verified, preventing potential regressions where a warning might be downgraded to an info toast without failing the test.
   
   **superset-frontend/src/extensions/ExtensionsStartup.test.tsx**
   ```
   await waitFor(() => {
       expect(
         getToastTexts(store).some(text =>
           /Some extensions failed to load: Broken Extension/.test(text),
         ),
       ).toBe(true);
     });
   ```



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -275,6 +304,56 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout. A tab created through the extension API carries the
+  // requested view on its own query editor state, so it can never be picked
+  // up by another tab. Editors hydrated from the backend on reload don't
+  // carry the field, so fall back to the per-tab localStorage entry that the
+  // effect below keeps in sync.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(
+    () =>
+      queryEditor.northPaneViewId ??
+      readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId)),
+  );
+
+  // Tracks the storage id last written so that, when a tab syncs to the
+  // backend and `tabViewId` arrives, the entry under the old id-keyed key is
+  // removed rather than left orphaned in localStorage.
+  const northPaneStorageIdRef = useRef(northPaneStorageId);
+
+  useEffect(() => {
+    if (northPaneStorageIdRef.current !== northPaneStorageId) {
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageIdRef.current),
+        null,
+      );
+      northPaneStorageIdRef.current = northPaneStorageId;
+    }
+    writeNorthPaneStorage(
+      NORTH_PANE_VIEW_KEY(northPaneStorageId),
+      northPaneViewId,
+    );
+  }, [northPaneStorageId, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(northPaneStorageId)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [northPaneStorageId]);

Review Comment:
   <!-- Bito Reply -->
   The implementation of the `useNorthPaneView` hook correctly encapsulates the storage logic, including persistence, key migration, and cross-tab synchronization. This change effectively reduces the complexity of the main component and improves maintainability by isolating the storage concern.



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -211,12 +252,18 @@ function extractBaseData(action: QueryAction): {
     queryLimit,
   } = query;
 
+  // Resolve backendId through the same path as every other Tab construction
+  // so query-event listeners can correlate the tab with its tabstateview row.
+  const queryEditor = findQueryEditorByAnyId(sqlEditorId ?? undefined);

Review Comment:
   <!-- Bito Reply -->
   The suggestion to use a memoized map is a valid optimization for reducing redundant linear scans during high-frequency events. However, given that query events occur per lifecycle transition rather than per keystroke, the current implementation's performance impact is minimal in practice. You may choose to proceed with the current approach if the number of open tabs remains small, as it avoids the added complexity of cache invalidation.
   
   **superset-frontend/src/core/sqlLab/index.ts**
   ```
   // Resolve backendId through the same path as every other Tab construction
     // so query-event listeners can correlate the tab with its tabstateview row.
     const queryEditor = findQueryEditorByAnyId(sqlEditorId ?? undefined);
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4154937270


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -440,7 +487,7 @@ const onDidCloseTab: typeof sqlLabApi.onDidCloseTab = (
         action.queryEditor.dbId ?? 0,
         action.queryEditor.catalog,
         action.queryEditor.schema,
-        true, // closed
+        { closed: true, backendId: resolveBackendId(action.queryEditor) },

Review Comment:
   <!-- Bito Reply -->
   The suggestion to fall back to the editor ID is intended to prevent the loss of the backend ID when a tab is closed. Since the current implementation of `resolveBackendId` returns `undefined` for local-only tabs, the reviewer's concern is that listeners will receive a tab without a backend ID, potentially reintroducing a previously identified bug. If the current behavior is intentional to avoid that specific regression, you may choose to ignore this suggestion.
   
   **superset-frontend/src/core/sqlLab/index.ts**
   ```
   -        true, // closed
   +        { closed: true, backendId: resolveBackendId(action.queryEditor) },
   ```



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -557,6 +605,9 @@ const createTab: typeof sqlLabApi.createTab = async (
       inheritedValues.queryLimit ?? common?.conf?.DEFAULT_SQLLAB_LIMIT,
     autorun: false,
     name,
+    ...(options?.northPaneViewId && {
+      northPaneViewId: options.northPaneViewId,
+    }),

Review Comment:
   <!-- Bito Reply -->
   The reviewer's suggestion to plumb `northPaneViewId` through the `Tab` model is based on the observation that the current implementation accepts the option but does not persist it in the returned `Tab` object. If the application architecture intentionally manages `northPaneViewId` via the `queryEditor`'s Redux state rather than the `Tab` model, the suggestion may be unnecessary for the intended data flow. You may choose to ignore this suggestion if the current state management pattern is the established standard for this component.
   
   **superset-frontend/src/core/sqlLab/index.ts**
   ```
   +    ...(options?.northPaneViewId && {
   +      northPaneViewId: options.northPaneViewId,
   +    }),
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5946652611

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-6114040138

   ## CodeAnt PR Risk: Medium Risk
   
   - The PR needs attention before merging.
   - `resolveBackendId` exposes a backend-hydrated editor's `id` as `backendId` when `tabViewId` is absent; confirm this does not reveal an internal tabstateview ID.
   
   **Assessed commit:** `4b739fcc7a32`


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3474592407


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -98,6 +101,101 @@ const AddTabIconWrapper = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <AddTabIconWrapper>
+    <Icons.PlusOutlined iconSize="l" data-test="add-tab-icon" />
+  </AddTabIconWrapper>
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = () => {
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    activate();
+  };
+
+  const handleKeyDown = (e: React.KeyboardEvent) => {
+    // The same wrapper button activates on Enter/Space; intercept those keys so
+    // keyboard users reach the extension new-tab dropdown rather than antd's
+    // default add-tab path.
+    if (e.key === 'Enter' || e.key === ' ') {
+      e.preventDefault();
+      e.stopPropagation();
+      activate();
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        <span
+          role="button"
+          tabIndex={0}
+          onClick={handleClick}
+          onKeyDown={handleKeyDown}
+        >

Review Comment:
   **Suggestion:** The dropdown is controlled entirely by handlers on an inner `<span>` while the AntD tabs add button still owns the outer clickable button. Because `trigger` is disabled and propagation is only stopped from the inner element, clicks on button padding (or keyboard activation on the outer button) can still go through AntD's default `onEdit('add')` path and create a plain SQL tab instead of opening the extension new-tab menu. Wire the behavior at the actual add-button level (or guard the add path when extension tab types exist) so every add-button activation consistently uses the new-tab menu flow. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Extension tab types bypassed when clicking add-button padding.
   - ⚠️ Keyboard users cannot access extension new-tab dropdown.
   - ⚠️ SQL Lab + button behavior inconsistent once extensions register.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Load SQL Lab, which renders `TabbedSqlEditors` inside the main app layout
   (`superset-frontend/src/SqlLab/components/App/index.tsx:219-228` renders
   `<TabbedSqlEditors />`).
   
   2. Enable an extension that contributes new-tab commands so that
   `menus.getMenu(ViewLocations.sqllab.newTab)?.primary` returns one or more items when
   `NewTabButton` builds `dropdownItems`
   (`superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:116-123,119-120`), as
   described by the `ViewLocations.sqllab.newTab` comment in `contributions.ts:53-56`.
   
   3. In this state, the tabs add button is rendered by AntD as an outer `<button
   class="ant-tabs-nav-add" onClick={() => onEdit('add')}>` which wraps the `addIcon`
   content; `TabbedSqlEditors` passes `<NewTabButton ...>` as `addIcon` at `index.tsx:76-78`,
   and `NewTabButton` renders the `<Dropdown>` and inner `<span role="button" ...>` with
   handlers at `index.tsx:178-191`. Because the `onClick`/`onKeyDown` handlers and
   `e.stopPropagation()` are attached only to this inner `<span>`
   (`index.tsx:186-191,160-165`), a pointer click on the outer button's padding area (where
   the event target is the `<button>`, not the inner `<span>`) bypasses `handleClick`, so the
   click is not stopped and AntD's `onEdit('add')` fires, calling
   `TabbedSqlEditors.handleEdit('add')` and `this.newQueryEditor()` at `index.tsx:248-258` to
   create a plain SQL tab instead of opening the extension dropdown.
   
   4. For keyboard users, focus lands on the outer `ant-tabs-nav-add` `<button>` provided by
   AntD, whose Enter/Space activation synthesizes a click on the button; the inner `<span
   tabIndex={0} onKeyDown={handleKeyDown}>` at `index.tsx:186-191` never receives the keydown
   event, so the dropdown is not toggled and `handleEdit('add')` is invoked instead, again
   creating a default SQL tab and bypassing any contributed tab-type commands even though
   extension `newTab` items are present.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1015b93cf9474bd4a78d65bc189b3823&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1015b93cf9474bd4a78d65bc189b3823&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 180:191
   **Comment:**
   	*Logic Error: The dropdown is controlled entirely by handlers on an inner `<span>` while the AntD tabs add button still owns the outer clickable button. Because `trigger` is disabled and propagation is only stopped from the inner element, clicks on button padding (or keyboard activation on the outer button) can still go through AntD's default `onEdit('add')` path and create a plain SQL tab instead of opening the extension new-tab menu. Wire the behavior at the actual add-button level (or guard the add path when extension tab types exist) so every add-button activation consistently uses the new-tab menu flow.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=473ef973961c6a31da04035d5f27afc0335e259a404f1ab55f1bb1ec0ac6171d&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=473ef973961c6a31da04035d5f27afc0335e259a404f1ab55f1bb1ec0ac6171d&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4843984193

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3498038673


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +302,48 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      writeNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY, null);
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;

Review Comment:
   **Suggestion:** Using a single global localStorage key to pass the pending north-pane mode creates a race when multiple tab-creation actions happen before React mounts the new editor. The last writer wins, so one tab can consume another tab’s mode. Store the desired mode in tab-scoped state tied to the created tab id (or pass it through createTab options/redux) instead of a process-wide shared key. [race condition]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Extension-created SQL Lab tabs open wrong pane view.
   - ⚠️ North-pane mode persistence unreliable for multi-tab workflows.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Extension authors follow the documented pattern in
   `superset-frontend/src/SqlLab/contributions.ts:61-72`, calling
   `localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'ext.view1')` then `sqlLab.createTab({
   title: 'Tab 1' })`, and immediately afterwards
   `localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'ext.view2')` then `sqlLab.createTab({
   title: 'Tab 2' })` before the first `SqlEditor` has mounted.
   
   2. The `sqlLab.createTab()` implementation in
   `superset-frontend/src/core/sqlLab/index.ts:12-74` dispatches `addQueryEditor` and returns
   Tab objects, but it does not read or clear `PENDING_NORTH_PANE_VIEW_KEY`, so the global
   key keeps the last written value (`'ext.view2'`) while both tabs are being created.
   
   3. When React mounts the `SqlEditor` component for Tab 1, the `useState` initializer at
   `superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:68-79` executes `const
   pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);` (line 318), sees the
   second tab's value (`'ext.view2'`), clears the global key, writes
   `NORTH_PANE_VIEW_KEY(northPaneStorageId)` for Tab 1, and returns that value as
   `northPaneViewId`.
   
   4. When `SqlEditor` for Tab 2 mounts, `pendingViewId` is now null because Tab 1 cleared
   the shared key; Tab 2 falls back to
   `readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId))`, which is empty, so Tab 1
   incorrectly opens in mode `ext.view2` while Tab 2 opens the default SQL editor layout,
   demonstrating the cross-tab race caused by the global pending-mode key.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=191549345e0747fc8eea81f3d05fa864&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=191549345e0747fc8eea81f3d05fa864&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
   **Line:** 318:325
   **Comment:**
   	*Race Condition: Using a single global localStorage key to pass the pending north-pane mode creates a race when multiple tab-creation actions happen before React mounts the new editor. The last writer wins, so one tab can consume another tab’s mode. Store the desired mode in tab-scoped state tied to the created tab id (or pass it through createTab options/redux) instead of a process-wide shared key.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=159c23cb979a8c30e3fbbcdc150ccc56ac07d36ce5187213065e3cedfda09821&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=159c23cb979a8c30e3fbbcdc150ccc56ac07d36ce5187213065e3cedfda09821&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4888437940

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3488903734


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -93,6 +96,105 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;

Review Comment:
   **Suggestion:** The menu item handler executes `item.command` even when `getCommand` returned `undefined`. If an extension contributes a menu item before its command is registered (or the command failed to load), clicking the item throws `Command "...\" not found` and breaks the add-tab flow. Filter out missing commands or guard execution and show a non-fatal fallback. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ SQL Lab new-tab menu crashes when command missing.
   - ⚠️ Extension-provided tab actions fail, reducing usability.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. An extension contributes a new tab type into the `sqllab.newTab` menu, so that
   `menus.getMenu(ViewLocations.sqllab.newTab)?.primary` returns an item with `item.command`
   in `NewTabButton`
   (`superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:115-121`).
   
   2. At the moment the SQL Lab `TabbedSqlEditors` component renders, assume the extension
   has not yet registered its command handler (or registration failed), so
   `commands.getCommand(item.command)` in the dropdown items mapper returns `undefined`
   (`TabbedSqlEditors/index.tsx:129-131`), while the label and icon fall back to defaults.
   
   3. Despite `command` being `undefined`, the code still builds a `MenuItemType` whose
   `onClick` handler calls `commands.executeCommand(item.command)` without any guard
   (`TabbedSqlEditors/index.tsx:136-143`).
   
   4. When the user opens the new-tab dropdown and clicks this contributed tab type,
   `commands.executeCommand` in `superset-frontend/src/core/commands/index.ts:52-59` looks up
   the command in `commandRegistry`, fails to find it, and throws `Error('Command "..." not
   found.')`, causing a runtime error that interrupts the add-tab flow for that
   extension-provided tab type.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f72d0080e84c4c798d67c1f14f8d20ed&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f72d0080e84c4c798d67c1f14f8d20ed&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 129:144
   **Comment:**
   	*Api Mismatch: The menu item handler executes `item.command` even when `getCommand` returned `undefined`. If an extension contributes a menu item before its command is registered (or the command failed to load), clicking the item throws `Command "...\" not found` and breaks the add-tab flow. Filter out missing commands or guard execution and show a non-fatal fallback.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=af053530bfba6f2755c4362d48fead2dfed34ba8c21865ac591d142aeb651010&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=af053530bfba6f2755c4362d48fead2dfed34ba8c21865ac591d142aeb651010&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +302,48 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      writeNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY, null);
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });
+
+  useEffect(() => {
+    writeNorthPaneStorage(
+      NORTH_PANE_VIEW_KEY(northPaneStorageId),
+      northPaneViewId,
+    );
+  }, [northPaneStorageId, northPaneViewId]);

Review Comment:
   **Suggestion:** This effect writes the current mode immediately whenever the storage key changes, but `northPaneStorageId` can switch from client `id` to backend `tabViewId` after hydration while `northPaneViewId` is still `null`. In that transition, the code removes the existing persisted value under the backend key before ever reading it, so a previously saved extension pane mode is lost on reload. Read/migrate the new key first (or gate writes until initialization for the new key completes) before writing/removing. [cache]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ NorthPane extension mode lost after backend persistence migration.
   - ⚠️ Extensions cannot rely on consistent northPane mode storage.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Open SQL Lab and create or use a tab that will be persisted via backend tab state
   (FeatureFlag.SqllabBackendPersistence), so that `EditorAutoSync` is active
   (`superset-frontend/src/SqlLab/components/EditorAutoSync/index.tsx:69-184`) and will later
   call `syncQueryEditor` for unsaved editors (`lines 161-168`).
   
   2. Install an extension that configures a northPane view by setting
   `PENDING_NORTH_PANE_VIEW_KEY` before creating a new tab, as documented in
   `superset-frontend/src/SqlLab/contributions.ts:60-72`, so that `SqlEditor` persists the
   chosen northPane view id into localStorage via
   `writeNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId), pendingViewId)` in the
   `useState` initializer
   (`superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:317-325`).
   
   3. Observe that `SqlEditor` derives the per-tab storage key as `northPaneStorageId =
   queryEditor.tabViewId ?? queryEditor.id` (`index.tsx:309-312`) and initially reads only
   `NORTH_PANE_VIEW_KEY(northPaneStorageId)` in the state initializer (`index.tsx:317-328`),
   while `EditorAutoSync` later migrates the same `QueryEditor` to the backend by setting
   `tabViewId` in `syncQueryEditor` (`superset-frontend/src/SqlLab/actions/sqlLab.ts:24-47`),
   causing `northPaneStorageId` to switch from the temporary `id` to the backend `tabViewId`.
   
   4. When `tabViewId` is populated after this migration while `northPaneViewId` in React
   state remains `null` for that tab, the effect at `SqlEditor/index.tsx:330-335` runs with
   the new `northPaneStorageId` and writes `null` via
   `writeNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId), northPaneViewId)`, which
   calls `localStorage.removeItem`, erasing any previously persisted northPane view id under
   the backend key so that subsequent reloads cannot restore the extension-specific northPane
   layout for that tab.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3c5596c8e0d44f419300a31a0f65f9ea&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=3c5596c8e0d44f419300a31a0f65f9ea&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
   **Line:** 330:335
   **Comment:**
   	*Cache: This effect writes the current mode immediately whenever the storage key changes, but `northPaneStorageId` can switch from client `id` to backend `tabViewId` after hydration while `northPaneViewId` is still `null`. In that transition, the code removes the existing persisted value under the backend key before ever reading it, so a previously saved extension pane mode is lost on reload. Read/migrate the new key first (or gate writes until initialization for the new key completes) before writing/removing.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=103334efa3560374713fb6e40a5ae899629a555f9f0cb6d02be3a91054e964df&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=103334efa3560374713fb6e40a5ae899629a555f9f0cb6d02be3a91054e964df&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3679085848


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -274,6 +306,48 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      writeNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY, null);
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });

Review Comment:
   SqlEditor consumes and clears the global PENDING_NORTH_PANE_VIEW_KEY during state initialization for *every* mounted SqlEditor. Since TabbedSqlEditors renders a SqlEditor for each tab, a stale pending key (e.g. left behind if createTab() fails) can be consumed by an arbitrary tab on the next render, causing the wrong tab to enter northPane mode. Consider only consuming the pending key for the active tab (newly created tabs are made active via tabHistory).



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4154933681


##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +274,49 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    expect(
+      getToastTexts(store).some(text =>
+        /Some extensions failed to load: Broken Extension/.test(text),
+      ),
+    ).toBe(true);
+  });

Review Comment:
   Good catch, added a `toastType === ToastType.Warning` assertion so these would actually catch a severity downgrade.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -275,6 +304,56 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout. A tab created through the extension API carries the
+  // requested view on its own query editor state, so it can never be picked
+  // up by another tab. Editors hydrated from the backend on reload don't
+  // carry the field, so fall back to the per-tab localStorage entry that the
+  // effect below keeps in sync.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(
+    () =>
+      queryEditor.northPaneViewId ??
+      readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId)),
+  );
+
+  // Tracks the storage id last written so that, when a tab syncs to the
+  // backend and `tabViewId` arrives, the entry under the old id-keyed key is
+  // removed rather than left orphaned in localStorage.
+  const northPaneStorageIdRef = useRef(northPaneStorageId);
+
+  useEffect(() => {
+    if (northPaneStorageIdRef.current !== northPaneStorageId) {
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageIdRef.current),
+        null,
+      );
+      northPaneStorageIdRef.current = northPaneStorageId;
+    }
+    writeNorthPaneStorage(
+      NORTH_PANE_VIEW_KEY(northPaneStorageId),
+      northPaneViewId,
+    );
+  }, [northPaneStorageId, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(northPaneStorageId)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [northPaneStorageId]);

Review Comment:
   Pulled this into a `useNorthPaneView` hook, behavior unchanged.



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -211,12 +252,18 @@ function extractBaseData(action: QueryAction): {
     queryLimit,
   } = query;
 
+  // Resolve backendId through the same path as every other Tab construction
+  // so query-event listeners can correlate the tab with its tabstateview row.
+  const queryEditor = findQueryEditorByAnyId(sqlEditorId ?? undefined);

Review Comment:
   Query events fire once per lifecycle transition, not per keystroke, so the scan is over however many tabs someone has open, a handful in practice. Not worth a memoized map and its own cache-invalidation surface for that.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5926382087

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5351036210

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4640323503


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1048,6 +1057,34 @@ const SqlEditor: FC<Props> = ({
         >
           <Skeleton active />
         </div>
+      ) : northPaneViewId &&
+        northPaneViews.some(v => v.id === northPaneViewId) ? (
+        <Flex
+          vertical
+          css={css`
+            height: 100%;
+          `}
+        >
+          <SqlEditorTopBar

Review Comment:
   Fixed in 0dee0008. The extension editor keeps tab navigation, unbinds the native editor shortcuts when switching away, and hides the toolbar actions that require an editor. The regression test checks Ctrl+Enter and the toolbar.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3454399459


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,14 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned identifier for this tab. Exposed as an opaque
+   * string so the public extension API does not leak the backend's internal
+   * numeric tab id. Set once the tab has been persisted to the backend;
+   * undefined for new tabs before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   Good catch β€” wired `tabViewId` through `makeTab`/`getTab` so `backendId` actually gets set on the runtime `Tab` now.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,50 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(northPaneStorageId);
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [northPaneStorageId, northPaneViewId]);

Review Comment:
   Fair point β€” wrapped the northPane `localStorage` reads/writes in try/catch so a storage-restricted browser can't crash the editor mount.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453825362


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));

Review Comment:
   **Suggestion:** The persisted north-pane mode is written using `tabViewId ?? id` but read back using only `id`, so tabs with a backend `tabViewId` can fail to restore their saved mode after reloads. Read with the same key strategy used for writes to keep persistence consistent. [cache]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ North-pane layout not restored for backend-persisted SQL tabs.
   - ⚠️ Extensions' full-pane modes appear unreliable after reloads.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Open SQL Lab so `TabbedSqlEditors` renders and instantiates `SqlEditor` for each
   `QueryEditor` tab, as seen in
   `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:254-268` where it
   builds `tabItems` and renders `<SqlEditor queryEditor={qe} />`.
   
   2. Configure an extension to set `PENDING_NORTH_PANE_VIEW_KEY` before creating a tab as
   documented in `superset-frontend/src/SqlLab/contributions.ts:60-72`; when the tab is
   created, `SqlEditor`'s initializer at `index.tsx:289-297` reads this key, stores it under
   `NORTH_PANE_VIEW_KEY(queryEditor.id)` and sets `northPaneViewId` for that tab.
   
   3. With backend persistence enabled, let `EditorAutoSync` at
   `superset-frontend/src/SqlLab/components/EditorAutoSync/index.tsx:161-168` call
   `syncQueryEditor(firstUnsavedQueryEditor)`, and then `syncQueryEditor` at
   `superset-frontend/src/SqlLab/actions/sqlLab.ts:124-171` persists the editor to
   `/tabstateview/` and sets `queryEditor.tabViewId = json.id.toString()`.
   
   4. While the persisted tab is open, any change that keeps `northPaneViewId` set (for
   example, the extension default) triggers the effect at `SqlEditor/index.tsx:299-307`,
   which computes `persistKey = NORTH_PANE_VIEW_KEY(queryEditor.tabViewId ?? queryEditor.id)`
   and writes the mode under `sqllab.northPaneView.<tabViewId>` when `tabViewId` is present.
   
   5. Reload the browser: on remount, `SqlEditor`'s state initializer at `index.tsx:289-297`
   still calls `localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id))` (line 296), which
   uses the `id`-based key instead of the `tabViewId`-based key written in step 4; because
   there is no value under `sqllab.northPaneView.<id>`, `northPaneViewId` becomes `null` and
   the tab falls back to the default editor+SouthPane layout instead of restoring the saved
   north-pane mode.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5c63cc9fe1c942b4aa61a15103e7675b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5c63cc9fe1c942b4aa61a15103e7675b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
   **Line:** 296:296
   **Comment:**
   	*Cache: The persisted north-pane mode is written using `tabViewId ?? id` but read back using only `id`, so tabs with a backend `tabViewId` can fail to restore their saved mode after reloads. Read with the same key strategy used for writes to keep persistence consistent.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=3c5fa4c500ff2369bc92b0fa7e4fa8651a87b34504a672b3523bd7ad2eb05b8d&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=3c5fa4c500ff2369bc92b0fa7e4fa8651a87b34504a672b3523bd7ad2eb05b8d&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(
+      queryEditor.tabViewId ?? queryEditor.id,
+    );
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [queryEditor.tabViewId, queryEditor.id, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(queryEditor.id)) {
+        setNorthPaneViewId(e.newValue || null);

Review Comment:
   **Suggestion:** The storage event listener only watches the `id`-based key, but updates are persisted to the `tabViewId`-based key once available. That mismatch prevents cross-tab/window synchronization of mode changes for persisted tabs. Listen on the same resolved key used when persisting. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ North-pane mode changes not synced between browser windows.
   - ⚠️ Users see inconsistent layouts across concurrent SQL Lab sessions.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Open SQL Lab in a browser so `TabbedSqlEditors` renders `SqlEditor` instances for each
   tab (`superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:254-268`), and
   ensure backend persistence is on so tabs acquire a `tabViewId` via `syncQueryEditor` in
   `actions/sqlLab.ts:124-171`.
   
   2. For a persisted tab (with `queryEditor.tabViewId` set), change or confirm an
   extension-provided north-pane view so that `northPaneViewId` in `SqlEditor` is non-null;
   the effect at `superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:299-307` then
   writes this id using `persistKey = NORTH_PANE_VIEW_KEY(queryEditor.tabViewId ??
   queryEditor.id)`, i.e. under `sqllab.northPaneView.<tabViewId>`.
   
   3. Open the same SQL Lab tab in a second browser window (or tab) so both windows render
   `SqlEditor` for the same backend-persisted `QueryEditor`; each instance registers a
   `storage` event listener in `SqlEditor/index.tsx:310-318`.
   
   4. Inspect the listener at `index.tsx:311-313`: it only updates state when `e.key ===
   NORTH_PANE_VIEW_KEY(queryEditor.id)` and then calls `setNorthPaneViewId(e.newValue ||
   null)`; there is no check for the `tabViewId`-based key used by the writer.
   
   5. In window A, switch the north-pane mode again; the effect at `index.tsx:299-307`
   updates `localStorage` key `sqllab.northPaneView.<tabViewId>`, which triggers a `storage`
   event in window B with `e.key` set to that `tabViewId`-based key, but window B's handler
   condition at line 312 fails (it is comparing against
   `NORTH_PANE_VIEW_KEY(queryEditor.id)`), so `setNorthPaneViewId` is never invoked and the
   second window's mode remains stale.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ec2f42d8792c4a1ab8b13c6716966f92&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ec2f42d8792c4a1ab8b13c6716966f92&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
   **Line:** 312:313
   **Comment:**
   	*Logic Error: The storage event listener only watches the `id`-based key, but updates are persisted to the `tabViewId`-based key once available. That mismatch prevents cross-tab/window synchronization of mode changes for persisted tabs. Listen on the same resolved key used when persisting.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=5c70909fcab90aef44b4be35d1df2adf6701ab08659052fc1b9a7a8591ecae1f&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=5c70909fcab90aef44b4be35d1df2adf6701ab08659052fc1b9a7a8591ecae1f&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -98,6 +101,82 @@ const AddTabIconWrapper = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <AddTabIconWrapper>
+    <Icons.PlusOutlined iconSize="l" data-test="add-tab-icon" />
+  </AddTabIconWrapper>
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
+        <span role="button" tabIndex={0} onClick={handleClick}>
+          {PlusIcon}

Review Comment:
   **Suggestion:** The custom add-tab behavior is only attached to the inner `<span>` click handler, while AntD wraps `addIcon` in its own button that still handles keyboard activation. Pressing Enter/Space on that wrapper triggers the default tab-add path instead of opening/using the extension tab-type dropdown, so extension tab types are inaccessible via keyboard. Move the custom handling to the wrapper interaction path (or intercept keyboard events as well). [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Keyboard users cannot open extension-contributed SQL tab types.
   - ⚠️ New-tab dropdown behavior regresses in accessibility and UX.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Register an extension that contributes `newTab` menu items under
   `ViewLocations.sqllab.newTab` defined in
   `superset-frontend/src/SqlLab/contributions.ts:40-57`, so
   `menus.getMenu(ViewLocations.sqllab.newTab)?.primary` returns items inside `NewTabButton`
   at `TabbedSqlEditors/index.tsx:116-147`.
   
   2. In SQL Lab, `TabbedSqlEditors` renders `StyledEditableTabs` with `type={...
   'editable-card'}` and `addIcon={<NewTabButton onAddSqlEditor={() => this.newQueryEditor()}
   />}` at `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:306-318`,
   delegating the add-tab control to a `NewTabButton`.
   
   3. `NewTabButton`'s `handleClick` at `index.tsx:150-161` contains the comment "Antd's Tabs
   wraps addIcon in its own `<button onClick={() => onEdit('add')}>`" and calls
   `e.stopPropagation()` before either opening the dropdown or calling `onAddSqlEditor()`,
   but this handler is only attached to the inner `<span>`'s `onClick`.
   
   4. The rendered markup for the inner control is `<span role="button" tabIndex={0}
   onClick={handleClick}>` with `{PlusIcon}` children at `index.tsx:171-174`; there is no
   `onKeyDown` or `onKeyPress` handler on this span, so keyboard events (Enter/Space) are
   handled by AntD's wrapper `<button>` around `addIcon`, not by `handleClick`.
   
   5. With an extension contributing `newTab` items, focus the plus button using the keyboard
   and press Enter/Space: AntD's wrapper button invokes `onEdit('add')`, which calls
   `handleEdit('add')` and `newQueryEditor()` at `TabbedSqlEditors/index.tsx:229-239`,
   creating a default SQL Editor tab; `handleClick` is never invoked, so the dropdown listing
   extension tab types is not shown and extension-provided tab types are inaccessible via
   keyboard.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6563e1c04129450e9e1e48028dd8b442&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6563e1c04129450e9e1e48028dd8b442&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 172:173
   **Comment:**
   	*Incomplete Implementation: The custom add-tab behavior is only attached to the inner `<span>` click handler, while AntD wraps `addIcon` in its own button that still handles keyboard activation. Pressing Enter/Space on that wrapper triggers the default tab-add path instead of opening/using the extension tab-type dropdown, so extension tab types are inaccessible via keyboard. Move the custom handling to the wrapper interaction path (or intercept keyboard events as well).
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=3d39fa019e43ff0113da80604a71e981b35e93dd5f0dfa68864328b88905c1d6&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=3d39fa019e43ff0113da80604a71e981b35e93dd5f0dfa68864328b88905c1d6&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -72,9 +75,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {
+          supersetCore.utils.logging.error(
+            'Error setting up extensions:',
+            error,
+          );
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),
+          );
+        });

Review Comment:
   **Suggestion:** `initializeExtensions()` already catches and swallows its own failures, so this promise chain always resolves and the `.catch(...)` branch here will never run. As a result, extension load failures still won't show the warning toast, and the success log can be emitted even after an error. Make the loader rethrow (or return a failure signal) so this caller can reliably detect and toast failures. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Extension load failures never surface as warning toasts.
   - ⚠️ Logs may report successful initialization despite underlying errors.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Ensure the extensions feature flag is enabled so `FeatureFlag.EnableExtensions` is
   true; in this case, `ExtensionsStartup`'s `useEffect` at
   `superset-frontend/src/extensions/ExtensionsStartup.tsx:62-80` sets `window.superset` and
   then executes the block starting at line 80 which calls
   `ExtensionsLoader.getInstance().initializeExtensions()`.
   
   2. Inspect `ExtensionsLoader.initializeExtensions()` in
   `superset-frontend/src/extensions/ExtensionsLoader.ts:55-79`: it wraps the async logic in
   a try/catch at lines 63-77, logging `logging.error('Error setting up extensions:',
   error);` on failure but never rethrowing or rejecting the promise; instead,
   `this.initializationPromise` always resolves (line 79) regardless of success.
   
   3. Configure `/api/v1/extensions/` to fail (for example, misconfigure the endpoint or have
   the backend return HTTP 500), causing `SupersetClient.get()` at
   `ExtensionsLoader.ts:65-67` to throw; the catch block at `ExtensionsLoader.ts:74-77` logs
   the error and then allows the async IIFE to complete normally, resolving
   `initializeExtensions()` without propagating the failure.
   
   4. Back in `ExtensionsStartup`, the `then` branch at `ExtensionsStartup.tsx:81-87` logs
   "Extensions initialized successfully." via `supersetCore.utils.logging.info(...)` when the
   resolved promise returns, even though initialization actually failed, and because
   `initializeExtensions()` never rejects, the `.catch(error => { ... addWarningToast(...)
   })` branch at `ExtensionsStartup.tsx:88-96` is never invoked and the intended warning
   toast is never shown.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8b4c69b5786548a1bf6bed66fbb6426f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8b4c69b5786548a1bf6bed66fbb6426f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/extensions/ExtensionsStartup.tsx
   **Line:** 81:96
   **Comment:**
   	*Api Mismatch: `initializeExtensions()` already catches and swallows its own failures, so this promise chain always resolves and the `.catch(...)` branch here will never run. As a result, extension load failures still won't show the warning toast, and the success log can be emitted even after an error. Make the loader rethrow (or return a failure signal) so this caller can reliably detect and toast failures.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=9f1635fc055ae3e78e94e37f56145476000405ddbb9255d35d172a57969d289b&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=9f1635fc055ae3e78e94e37f56145476000405ddbb9255d35d172a57969d289b&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3930321736


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>

Review Comment:
   Good catch. `initializeExtensions()` now resolves with the names of anything that failed to load, and the startup path raises a warning toast naming them instead of logging success.



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +161,29 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,
 ): Tab => {
   const panels: Panel[] = []; // TODO: Populate panels
   const editorGetter = closed
     ? () => Promise.reject(new Error(`Tab ${id} has been closed`))
     : () => getEditorAsync(id);
-  return new Tab(id, name, dbId, catalog, schema, editorGetter, panels);
+  return new Tab(
+    id,
+    name,
+    dbId,
+    catalog,
+    schema,
+    editorGetter,
+    panels,
+    backendId,
+  );
 };
 
 const getTab = (id: string): Tab | undefined => {
   const queryEditor = findQueryEditor(id);
   if (queryEditor?.dbId !== undefined) {
-    const { name, dbId, catalog, schema } = queryEditor;
-    return makeTab(id, name, dbId, catalog, schema);
+    const { name, dbId, catalog, schema, tabViewId } = queryEditor;

Review Comment:
   Yep, hydrated tabs carry the backend id as `queryEditor.id`, so `backendId` now falls back to that whenever the editor is not flagged `inLocalStorage`. Added a test for the reload case.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3941046966


##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',

Review Comment:
   These host locations are not added to the public `SqlLabLocation` union used by the extension manifest types. An external extension that declares `views.sqllab.northPane` or `menus.sqllab.newTab` therefore fails type checking even though the host supports it. Could the public contribution schema be updated with both locations?



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -80,6 +80,19 @@ const findQueryEditor = (editorId: string) => {
   return editor;
 };
 
+/**
+ * Resolves the backend-assigned id for a query editor, if it has one. A tab
+ * created locally and later synced carries it in `tabViewId`; a tab hydrated
+ * from the backend on page load uses that id directly as its `queryEditor.id`
+ * (with `inLocalStorage` unset). Only a tab that still lives solely in local
+ * storage has no backend id yet.
+ */
+const resolveBackendId = (

Review Comment:
   Query lifecycle callbacks still construct their `Tab` in `extractBaseData()` without this resolver, even when `query.sqlEditorId` identifies a persisted tab. That leaves `backendId` undefined for query-event listeners, so extensions cannot correlate those events with the tabstateview row. Could every Tab construction path use the same backend-ID resolution?



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,30 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),
+              ),
+            );
+          }
+        })
+        .catch((error: unknown) => {
+          dispatch(
+            addWarningToast(t('Extensions failed to load: %s', String(error))),

Review Comment:
   When fetching the extension list rejects with a response-like object, `String(error)` renders only `[object Response]` (or `[object Object]`) in the new warning toast. That hides the failure detail this path is meant to surface. Could this extract a useful message/status before displaying it?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5795232679

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4081164337


##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,93 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      const { findByTestId, queryByTestId } = setup(mockedProps, store);
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      // The default SQL editor pane is replaced, not rendered alongside.
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('opens the northPane view carried on the query editor and persists the per-tab key', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      // createTab({ northPaneViewId }) stamps the view onto the tab's own
+      // state, so nothing shared between tabs is involved.
+      const { findByTestId, queryByTestId } = setup(
+        {
+          ...mockedProps,
+          queryEditor: { ...queryEditor, northPaneViewId: 'test.northPane' },
+        },
+        store,
+      );
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+      // The chosen view is persisted under the per-tab key so it survives a
+      // reload that rehydrates the editor without the field.
+      expect(localStorage.getItem(storageKey)).toEqual('test.northPane');
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('does not open a northPane view requested for a different tab', () => {
+    const { queryEditor } = mockedProps;
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+    // Another tab was created with the view; this one mounts as a plain tab
+    // (as happens when a reload restores several tabs at once).
+    const otherTabStore = createStore({
+      ...mockInitialState,
+      sqlLab: {
+        ...mockInitialState.sqlLab,
+        queryEditors: [
+          ...mockInitialState.sqlLab.queryEditors,
+          { ...extraQueryEditor1, northPaneViewId: 'test.northPane' },
+        ],

Review Comment:
   <!-- Bito Reply -->
   The update to the fixture is correct. By using `.map` to update the existing entry instead of appending a new one, you avoid duplicating the tab ID and ensure the store state correctly reflects the intended scenario without shadowing the view-carrying entry.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1048,6 +1127,29 @@ const SqlEditor: FC<Props> = ({
         >
           <Skeleton active />
         </div>
+      ) : northPaneViewId &&
+        northPaneViews.some(v => v.id === northPaneViewId) ? (

Review Comment:
   <!-- Bito Reply -->
   The change correctly addresses the issue where the north pane would appear blank while waiting for an asynchronous view registration. By falling back to `queryPane()` in the ternary condition, the editor now maintains a consistent UI state during the loading process.
   
   **superset-frontend/src/SqlLab/components/SqlEditor/index.tsx**
   ```
   +      ) : northPaneViewId &&
   +        northPaneViews.some(v => v.id === northPaneViewId) ? (
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3826777906


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +161,29 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,
 ): Tab => {
   const panels: Panel[] = []; // TODO: Populate panels
   const editorGetter = closed
     ? () => Promise.reject(new Error(`Tab ${id} has been closed`))
     : () => getEditorAsync(id);
-  return new Tab(id, name, dbId, catalog, schema, editorGetter, panels);
+  return new Tab(
+    id,
+    name,
+    dbId,
+    catalog,
+    schema,
+    editorGetter,
+    panels,
+    backendId,
+  );
 };
 
 const getTab = (id: string): Tab | undefined => {
   const queryEditor = findQueryEditor(id);
   if (queryEditor?.dbId !== undefined) {
-    const { name, dbId, catalog, schema } = queryEditor;
-    return makeTab(id, name, dbId, catalog, schema);
+    const { name, dbId, catalog, schema, tabViewId } = queryEditor;

Review Comment:
   Tabs hydrated from `tabstateview` use the persisted ID as `queryEditor.id` but do not have `tabViewId`, so this leaves the newly documented `backendId` undefined after a reload. Could this fall back to the persisted editor ID when it represents the backend tab?



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>

Review Comment:
   A remote entry can fail while the extensions index still loads: `initializeExtension()` converts that failure to `false`, so `initializeExtensions()` resolves and this success handler runs instead of the toast path. Could the aggregate reject or otherwise surface a warning when any extension fails to initialize?



##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',
+    // Extensions register tab-type commands here. When any are present the
+    // "+" new-tab button becomes a dropdown listing all registered tab types
+    // plus the built-in SQL Editor option.
+    newTab: 'sqllab.newTab',
   },
 } as const;
+
+/**
+ * localStorage key an extension sets before calling createTab() to declare
+ * which northPane view the new tab should open with.  The value must be the
+ * view ID passed to views.registerView() (e.g. "my-ext.northPane").  SqlEditor
+ * consumes and removes this key during initialization, then persists the chosen
+ * view ID under a per-tab key so the mode survives page reloads.
+ *
+ * @example
+ * // In an extension's newTab command handler:
+ * localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'my-ext.northPane');
+ * sqlLab.createTab({ title: 'My View' });
+ */
+export const PENDING_NORTH_PANE_VIEW_KEY = 'sqllab.pendingNorthPaneView';

Review Comment:
   This is one origin-wide mailbox, so two extension `setItem`/`createTab` sequences can overwrite each other before the first editor mounts; the first tab then loses its requested pane. Could the requested view be carried in tab-creation state instead of shared localStorage?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4141899711


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +191,37 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,

Review Comment:
   Good catch, switched `closed`/`backendId` to an options object so call sites aren't left guessing what a bare `false` means.



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +261,56 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  const originalInitialize = ExtensionsLoader.prototype.initializeExtensions;
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    const { messageToasts } = store.getState() as unknown as {
+      messageToasts: { text: string }[];
+    };
+    expect(
+      messageToasts.some(toast =>
+        /Some extensions failed to load: Broken Extension/.test(toast.text),
+      ),
+    ).toBe(true);
+  });
+
+  ExtensionsLoader.prototype.initializeExtensions = originalInitialize;

Review Comment:
   Fixed both: the prototype restore now lives in `afterEach` so a failed assertion can't leak the mock into later tests, and pulled the toast-text unwrapping into a small helper.



##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,94 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );

Review Comment:
   Extracted the northPane registration and storage-key derivation into shared helpers, done.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -265,25 +424,7 @@ function TabbedSqlEditors({
       onEdit={handleEdit}
       popupClassName={SQLLAB_TAB_OVERFLOW_POPUP_CLASS}
       type={queryEditors?.length === 0 ? 'card' : 'editable-card'}
-      addIcon={
-        <Tooltip
-          id="add-tab"
-          placement="left"
-          title={
-            userOS === 'Windows'
-              ? t('New tab (Ctrl + q)')
-              : t('New tab (Ctrl + t)')
-          }
-        >
-          <Icons.PlusOutlined
-            iconSize="l"
-            css={css`
-              vertical-align: middle;
-            `}
-            data-test="add-tab-icon"
-          />
-        </Tooltip>
-      }
+      addIcon={<NewTabButton onAddSqlEditor={() => newQueryEditor()} />}

Review Comment:
   Good catch, passing `newQueryEditor` directly now instead of wrapping it in a new arrow function on every render.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4640317713


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/TabbedSqlEditors.test.tsx:
##########
@@ -176,3 +181,271 @@ test('should have an empty state when query editors is empty', async () => {
     expect(getByText('Add a new tab to create SQL Query')).toBeInTheDocument(),
   );
 });
+
+// The new-tab "+" button (NewTabButton) opens a dropdown of contributed
+// actions when an extension registers something under sqllab.newTab, and
+// otherwise falls back to adding a SQL editor tab directly. These tests cover
+// that branching plus the resilience to a contributed-but-unregistered command.
+const newTabDisposables: ReturnType<typeof menus.registerMenuItem>[] = [];
+
+afterEach(() => {
+  while (newTabDisposables.length) {
+    newTabDisposables.pop()?.dispose();
+  }
+});
+
+const contributeNewTabItem = (command: string) =>
+  newTabDisposables.push(
+    menus.registerMenuItem(
+      { view: 'builtin.editor', command },
+      ViewLocations.sqllab.newTab,
+      'primary',
+    ),
+  );
+
+test('new tab button opens a dropdown listing SQL Editor and the contributed item', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.getByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('new tab button runs the contributed command when its menu item is clicked', async () => {
+  const handler = jest.fn();
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      handler,
+    ),
+  );
+
+  const { getAllByRole } = setup(undefined, initialState);
+  const tabCount = () =>
+    getAllByRole('tab').filter(
+      tab => !tab.classList.contains('ant-tabs-tab-remove'),
+    ).length;
+  const countBefore = tabCount();
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  fireEvent.click(await screen.findByText('Contributed Tab'));
+
+  await waitFor(() => expect(handler).toHaveBeenCalledTimes(1));
+  // Regression: `handler` is a no-op mock that never touches tabs itself, so
+  // any tab appearing here can only be the bug's side effect. The dropdown
+  // popup is DOM-portaled, but stays a React-tree descendant of the native
+  // <button onClick={() => onEdit('add')}> that antd's Tabs wraps addIcon
+  // in. React's synthetic events bubble along the React tree (piercing the
+  // portal), so without stopping propagation in the popup, this click also
+  // fired that ancestor's onEdit('add') and created an unwanted plain tab.
+  expect(tabCount()).toEqual(countBefore);
+});
+
+test('clicking SQL Editor in the dropdown adds exactly one tab, not two', async () => {
+  // Same regression as above, exercised via the built-in "SQL Editor" item
+  // instead of a contributed one β€” this is the path a plain SQL tab actually
+  // goes through once any extension contribution makes the dropdown appear
+  // at all (with zero contributions, "+" adds a tab directly and never
+  // renders this dropdown β€” see the no-contributions test below).
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  const { getAllByRole } = setup(undefined, initialState);
+  const tabCount = () =>
+    getAllByRole('tab').filter(
+      tab => !tab.classList.contains('ant-tabs-tab-remove'),
+    ).length;
+  const countBefore = tabCount();
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  fireEvent.click(await screen.findByText('SQL Editor'));
+
+  await waitFor(() => expect(tabCount()).toEqual(countBefore + 1));
+  // Give any second (buggy) tab creation a chance to land before asserting
+  // the count didn't grow further.
+  await new Promise(resolve => setTimeout(resolve, 0));
+  expect(tabCount()).toEqual(countBefore + 1);
+});
+
+test('new tab button adds a tab directly when there are no contributions', async () => {
+  const { getAllByLabelText, getAllByRole, queryByText } = setup(
+    undefined,
+    initialState,
+  );
+  const tabCount = getAllByRole('tab').filter(
+    tab => !tab.classList.contains('ant-tabs-tab-remove'),
+  ).length;
+
+  fireEvent.click(getAllByLabelText('Add tab')[0]);
+
+  // No dropdown appears; a new editor tab is created immediately.
+  expect(queryByText('SQL Editor')).not.toBeInTheDocument();
+  await waitFor(() =>
+    expect(
+      getAllByRole('tab').filter(
+        tab => !tab.classList.contains('ant-tabs-tab-remove'),
+      ).length,
+    ).toEqual(tabCount + 1),
+  );
+});
+
+test('new tab button skips a contributed item whose command is not registered', async () => {
+  // Menu item registered, but its command never is β€” the item must be dropped
+  // rather than throwing "Command not found" when the dropdown renders.
+  contributeNewTabItem('ext.missing');
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.queryByText('ext.missing')).not.toBeInTheDocument();
+});
+
+test('new tab dropdown closes on a mousedown outside the button and menu', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  const menu = () =>
+    screen.getByText('Contributed Tab').closest('.ant-dropdown');
+  await waitFor(() => expect(menu()).not.toHaveClass('ant-dropdown-hidden'));
+
+  // trigger={[]} disables antd's own outside-click dismissal, so this is the
+  // component's explicit window listener at work.
+  fireEvent.mouseDown(document.body);
+
+  await waitFor(() => expect(menu()).toHaveClass('ant-dropdown-hidden'));
+});
+
+test('new tab dropdown closes on Escape', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  const menu = () =>
+    screen.getByText('Contributed Tab').closest('.ant-dropdown');
+  await waitFor(() => expect(menu()).not.toHaveClass('ant-dropdown-hidden'));
+
+  fireEvent.keyDown(document.body, { key: 'Escape' });
+
+  await waitFor(() => expect(menu()).toHaveClass('ant-dropdown-hidden'));
+});
+
+test('new tab button opens the dropdown on keyboard activation', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  const addButton = screen.getAllByLabelText('Add tab')[0];
+  addButton.focus();
+  // Enter on a focused native button synthesizes a click, which the
+  // capture-phase listener intercepts just like a mouse click.
+  await userEvent.type(addButton, '{enter}', { skipClick: true });
+
+  expect(await screen.findByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('empty state add control opens the dropdown instead of creating a plain tab', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, {
+    ...initialState,
+    sqlLab: { ...initialState.sqlLab, queryEditors: [], tabHistory: [] },
+  } as RootState);
+
+  fireEvent.click(await screen.findByTestId('add-tab-icon'));
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.getByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('new tab button ignores clicks while extensions load, then opens the dropdown once ready', async () => {
+  const resetLoader = () => {
+    (ExtensionsLoader as unknown as { instance?: ExtensionsLoader }).instance =
+      undefined;
+  };
+  const previousFlags = window.featureFlags;
+  window.featureFlags = { ...previousFlags, EnableExtensions: true };

Review Comment:
   Thanks for spotting the flag casing. I verified the branch uses ENABLE_EXTENSIONS and the TabbedSqlEditors tests pass.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "EnxDev (via GitHub) via notifications" <no...@superset.apache.org>.
EnxDev commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4431273441


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/TabbedSqlEditors.test.tsx:
##########
@@ -176,3 +181,271 @@ test('should have an empty state when query editors is empty', async () => {
     expect(getByText('Add a new tab to create SQL Query')).toBeInTheDocument(),
   );
 });
+
+// The new-tab "+" button (NewTabButton) opens a dropdown of contributed
+// actions when an extension registers something under sqllab.newTab, and
+// otherwise falls back to adding a SQL editor tab directly. These tests cover
+// that branching plus the resilience to a contributed-but-unregistered command.
+const newTabDisposables: ReturnType<typeof menus.registerMenuItem>[] = [];
+
+afterEach(() => {
+  while (newTabDisposables.length) {
+    newTabDisposables.pop()?.dispose();
+  }
+});
+
+const contributeNewTabItem = (command: string) =>
+  newTabDisposables.push(
+    menus.registerMenuItem(
+      { view: 'builtin.editor', command },
+      ViewLocations.sqllab.newTab,
+      'primary',
+    ),
+  );
+
+test('new tab button opens a dropdown listing SQL Editor and the contributed item', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.getByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('new tab button runs the contributed command when its menu item is clicked', async () => {
+  const handler = jest.fn();
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      handler,
+    ),
+  );
+
+  const { getAllByRole } = setup(undefined, initialState);
+  const tabCount = () =>
+    getAllByRole('tab').filter(
+      tab => !tab.classList.contains('ant-tabs-tab-remove'),
+    ).length;
+  const countBefore = tabCount();
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  fireEvent.click(await screen.findByText('Contributed Tab'));
+
+  await waitFor(() => expect(handler).toHaveBeenCalledTimes(1));
+  // Regression: `handler` is a no-op mock that never touches tabs itself, so
+  // any tab appearing here can only be the bug's side effect. The dropdown
+  // popup is DOM-portaled, but stays a React-tree descendant of the native
+  // <button onClick={() => onEdit('add')}> that antd's Tabs wraps addIcon
+  // in. React's synthetic events bubble along the React tree (piercing the
+  // portal), so without stopping propagation in the popup, this click also
+  // fired that ancestor's onEdit('add') and created an unwanted plain tab.
+  expect(tabCount()).toEqual(countBefore);
+});
+
+test('clicking SQL Editor in the dropdown adds exactly one tab, not two', async () => {
+  // Same regression as above, exercised via the built-in "SQL Editor" item
+  // instead of a contributed one β€” this is the path a plain SQL tab actually
+  // goes through once any extension contribution makes the dropdown appear
+  // at all (with zero contributions, "+" adds a tab directly and never
+  // renders this dropdown β€” see the no-contributions test below).
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  const { getAllByRole } = setup(undefined, initialState);
+  const tabCount = () =>
+    getAllByRole('tab').filter(
+      tab => !tab.classList.contains('ant-tabs-tab-remove'),
+    ).length;
+  const countBefore = tabCount();
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  fireEvent.click(await screen.findByText('SQL Editor'));
+
+  await waitFor(() => expect(tabCount()).toEqual(countBefore + 1));
+  // Give any second (buggy) tab creation a chance to land before asserting
+  // the count didn't grow further.
+  await new Promise(resolve => setTimeout(resolve, 0));
+  expect(tabCount()).toEqual(countBefore + 1);
+});
+
+test('new tab button adds a tab directly when there are no contributions', async () => {
+  const { getAllByLabelText, getAllByRole, queryByText } = setup(
+    undefined,
+    initialState,
+  );
+  const tabCount = getAllByRole('tab').filter(
+    tab => !tab.classList.contains('ant-tabs-tab-remove'),
+  ).length;
+
+  fireEvent.click(getAllByLabelText('Add tab')[0]);
+
+  // No dropdown appears; a new editor tab is created immediately.
+  expect(queryByText('SQL Editor')).not.toBeInTheDocument();
+  await waitFor(() =>
+    expect(
+      getAllByRole('tab').filter(
+        tab => !tab.classList.contains('ant-tabs-tab-remove'),
+      ).length,
+    ).toEqual(tabCount + 1),
+  );
+});
+
+test('new tab button skips a contributed item whose command is not registered', async () => {
+  // Menu item registered, but its command never is β€” the item must be dropped
+  // rather than throwing "Command not found" when the dropdown renders.
+  contributeNewTabItem('ext.missing');
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.queryByText('ext.missing')).not.toBeInTheDocument();
+});
+
+test('new tab dropdown closes on a mousedown outside the button and menu', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  const menu = () =>
+    screen.getByText('Contributed Tab').closest('.ant-dropdown');
+  await waitFor(() => expect(menu()).not.toHaveClass('ant-dropdown-hidden'));
+
+  // trigger={[]} disables antd's own outside-click dismissal, so this is the
+  // component's explicit window listener at work.
+  fireEvent.mouseDown(document.body);
+
+  await waitFor(() => expect(menu()).toHaveClass('ant-dropdown-hidden'));
+});
+
+test('new tab dropdown closes on Escape', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  fireEvent.click(screen.getAllByLabelText('Add tab')[0]);
+  const menu = () =>
+    screen.getByText('Contributed Tab').closest('.ant-dropdown');
+  await waitFor(() => expect(menu()).not.toHaveClass('ant-dropdown-hidden'));
+
+  fireEvent.keyDown(document.body, { key: 'Escape' });
+
+  await waitFor(() => expect(menu()).toHaveClass('ant-dropdown-hidden'));
+});
+
+test('new tab button opens the dropdown on keyboard activation', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, initialState);
+
+  const addButton = screen.getAllByLabelText('Add tab')[0];
+  addButton.focus();
+  // Enter on a focused native button synthesizes a click, which the
+  // capture-phase listener intercepts just like a mouse click.
+  await userEvent.type(addButton, '{enter}', { skipClick: true });
+
+  expect(await screen.findByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('empty state add control opens the dropdown instead of creating a plain tab', async () => {
+  contributeNewTabItem('ext.newTab');
+  newTabDisposables.push(
+    commands.registerCommand(
+      { id: 'ext.newTab', title: 'Contributed Tab' },
+      jest.fn(),
+    ),
+  );
+
+  setup(undefined, {
+    ...initialState,
+    sqlLab: { ...initialState.sqlLab, queryEditors: [], tabHistory: [] },
+  } as RootState);
+
+  fireEvent.click(await screen.findByTestId('add-tab-icon'));
+
+  expect(await screen.findByText('SQL Editor')).toBeInTheDocument();
+  expect(screen.getByText('Contributed Tab')).toBeInTheDocument();
+});
+
+test('new tab button ignores clicks while extensions load, then opens the dropdown once ready', async () => {
+  const resetLoader = () => {
+    (ExtensionsLoader as unknown as { instance?: ExtensionsLoader }).instance =
+      undefined;
+  };
+  const previousFlags = window.featureFlags;
+  window.featureFlags = { ...previousFlags, EnableExtensions: true };

Review Comment:
   `window.featureFlags` is keyed by the flag value, so `EnableExtensions` sets something nothing reads. That's the TS2561 behind lint-frontend.
   
   It's also why this test fails in shard 5: with the flag off `useExtensionsReady` is true from the start, so the first click already opens the dropdown.
   
   ```suggestion
     window.featureFlags = { ...previousFlags, ENABLE_EXTENSIONS: true };
   ```



##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +74,41 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),

Review Comment:
   The `messages.pot` regen commit didn't survive the rebase, so this string, `Extensions failed to load: %s` below and `SQL Editor` in TabbedSqlEditors are missing from the template again. That's what babel-extract is failing on.
   
   Adding the three msgids back to `superset/translations/messages.pot` should clear it.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3493511536


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -93,6 +96,105 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.map(item => {
+        const command = commands.getCommand(item.command);
+        const Icon = command?.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return {
+          key: command?.id ?? item.command,
+          label: command?.title ?? item.command,
+          icon: <Icon iconSize="m" />,
+          onClick: () => {
+            setOpen(false);
+            commands.executeCommand(item.command);
+          },
+        } as MenuItemType;

Review Comment:
   Good catch β€” commands can register after the menu renders, so I'm filtering out any item whose command isn't registered yet rather than risk the throw.
   



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +302,48 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = readNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      writeNorthPaneStorage(PENDING_NORTH_PANE_VIEW_KEY, null);
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });
+
+  useEffect(() => {
+    writeNorthPaneStorage(
+      NORTH_PANE_VIEW_KEY(northPaneStorageId),
+      northPaneViewId,
+    );
+  }, [northPaneStorageId, northPaneViewId]);

Review Comment:
   I don't think this one's reachable β€” backend-persisted tabs hydrate with the backend id as `queryEditor.id` (tabViewId stays undefined), so the key is stable across reloads and the initializer reads it directly. The `id`β†’`tabViewId` switch only happens for a freshly-synced tab, where that key has no prior value and the active view rides along in React state. So nothing gets clobbered.
   



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3493549640


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -93,6 +96,113 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command);
+            },
+          } as MenuItemType,
+        ];
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = () => {
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    if (primaryItems.length === 0) {
+      onAddSqlEditor();
+    } else {
+      setOpen(prev => !prev);
+    }
+  };
+
+  const handleClick = (e: React.MouseEvent) => {
+    // Antd's Tabs wraps addIcon in its own <button onClick={() => onEdit('add')}>.
+    // Stop propagation so antd doesn't also call newQueryEditor() while we handle it.
+    e.stopPropagation();
+    activate();
+  };
+
+  const handleKeyDown = (e: React.KeyboardEvent) => {
+    // The same wrapper button activates on Enter/Space; intercept those keys so
+    // keyboard users reach the extension new-tab dropdown rather than antd's
+    // default add-tab path.
+    if (e.key === 'Enter' || e.key === ' ') {
+      e.preventDefault();
+      e.stopPropagation();
+      activate();
+    }
+  };
+
+  return (
+    <Tooltip id="add-tab" placement="left" title={newTabTooltip}>
+      <Dropdown
+        open={open}
+        onOpenChange={setOpen}
+        menu={{ items: dropdownItems }}
+        trigger={[]}
+      >
+        <span
+          role="button"
+          tabIndex={0}
+          onClick={handleClick}
+          onKeyDown={handleKeyDown}
+        >
+          {PlusIcon}
+        </span>

Review Comment:
   **Suggestion:** The Enter/Space interception is attached to an inner span, but AntD wraps addIcon in its own button that receives keyboard activation; this means keyboard activation can still hit the default add-tab path and bypass the extension dropdown logic. Move interception to the actual trigger button path (or use capture on the wrapper path) so keyboard behavior matches click behavior. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Keyboard users bypass extension new-tab dropdown behavior.
   - ⚠️ SQL Lab tab creation inconsistent between mouse and keyboard.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Open SQL Lab so the tab strip renders `TabbedSqlEditors` from
   `superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:208-219` with
   `StyledEditableTabs` using `addIcon=<NewTabButton onAddSqlEditor={() => newQueryEditor()}
   />` and `onEdit={handleEdit}` at lines 106-118.
   
   2. Inspect `NewTabButton` in the same file at lines 112-204: it renders a `Tooltip` and
   `Dropdown` wrapping a `<span role="button" tabIndex={0} onClick={handleClick}
   onKeyDown={handleKeyDown}>` (lines 193-199), with `handleClick` stopping propagation and
   calling `activate()` (lines 167-172) and `handleKeyDown` intercepting Enter/Space, calling
   `preventDefault()`, `stopPropagation()`, and `activate()` (lines 174-182).
   
   3. Note the inline comment at lines 167-176 stating that Ant Design Tabs wraps `addIcon`
   in its own `<button onClick={() => onEdit('add')}>`, meaning the actual focusable control
   and default keyboard activation handlers live on the wrapper button around `NewTabButton`,
   not on the inner span.
   
   4. In the browser, navigate via keyboard to the SQL Lab β€œAdd tab” control (the AntD add
   button that wraps `addIcon`) and press Enter or Space: the keydown and resulting click
   events target the outer button, which invokes `handleEdit('add')` (lines 17-28) and calls
   `newQueryEditor()`, while the inner span’s `onKeyDown={handleKeyDown}` never fires; this
   causes keyboard activation to bypass the extension-aware dropdown logic in `NewTabButton`
   even when extensions have contributed `sqllab.newTab` items (declared in
   `superset-frontend/src/SqlLab/contributions.ts:40-56`), leading to inconsistent behaviour
   between mouse and keyboard.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9e0e664b257f4ebda0610f85fcefcfee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=9e0e664b257f4ebda0610f85fcefcfee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx
   **Line:** 174:200
   **Comment:**
   	*Logic Error: The Enter/Space interception is attached to an inner span, but AntD wraps addIcon in its own button that receives keyboard activation; this means keyboard activation can still hit the default add-tab path and bypass the extension dropdown logic. Move interception to the actual trigger button path (or use capture on the wrapper path) so keyboard behavior matches click behavior.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=09e5e936a6d35ed9c52619123b8bea64664093e17118dc71ac2d030b478d4eaa&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=09e5e936a6d35ed9c52619123b8bea64664093e17118dc71ac2d030b478d4eaa&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453930101


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   βœ… **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag opaque, backend-assigned string identifiers in sqlLab public APIs as internal ID leaks; only flag cases where a numeric backend ID is actually exposed.
   
   **Applied to:**
     - `superset-frontend/packages/superset-core/src/sqlLab/**`
   
   ---
   πŸ’‘ *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3454043415


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,50 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(
+        NORTH_PANE_VIEW_KEY(northPaneStorageId),
+        pendingViewId,
+      );
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(northPaneStorageId));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(northPaneStorageId);
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [northPaneStorageId, northPaneViewId]);

Review Comment:
   **Suggestion:** Direct `localStorage` reads/writes in render-time initialization and effects can throw (e.g., storage blocked/quota/security errors), which would crash the editor path. This file already uses storage helper utilities elsewhere that guard failures; these new accesses should use guarded helpers or `try/catch` to avoid runtime crashes. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ SQL Lab editor can crash on storage-restricted browsers.
   - ⚠️ NorthPane layout persistence unreliable when storage errors occur.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Run Superset in a browser/environment where `localStorage` access may throw (for
   example, storage disabled, blocked by policy, or in a strict private mode), so calls to
   `localStorage.getItem` or `setItem` can raise a `DOMException`.
   
   2. Navigate to SQL Lab so `SqlEditor` mounts
   (`superset-frontend/src/SqlLab/components/SqlEditor/index.tsx`, lines 1-22), which
   immediately evaluates the `useState` initializer for `northPaneViewId` at lines 55-65.
   
   3. In that initializer, `localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY)` and
   `localStorage.getItem(NORTH_PANE_VIEW_KEY(northPaneStorageId))` are called directly
   without try/catch or helper wrappers (lines 55, 65); if `localStorage` throws here, the
   exception bubbles and prevents the component from mounting, crashing the SQL Lab editor
   view.
   
   4. Even if initialization succeeds, subsequent renders run the `useEffect` at lines 68-75,
   which directly invokes `localStorage.setItem` and `localStorage.removeItem`; any storage
   error here similarly propagates, while other parts of this file and nearby code (e.g.,
   `getItem`/`setItem` from `src/utils/localStorageHelpers.ts` used at lines 92-97)
   demonstrate an established pattern of guarding `localStorage` access, confirming this new
   unguarded usage is inconsistent and can realistically break the editor for affected users.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=64fc89c00bfa4462906b3083646d487b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=64fc89c00bfa4462906b3083646d487b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
   **Line:** 294:314
   **Comment:**
   	*Possible Bug: Direct `localStorage` reads/writes in render-time initialization and effects can throw (e.g., storage blocked/quota/security errors), which would crash the editor path. This file already uses storage helper utilities elsewhere that guard failures; these new accesses should use guarded helpers or `try/catch` to avoid runtime crashes.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=7503a995bcfedd5cf083f689fbbdd4e0a4e6a1da166bac3349af4b3c51270f7f&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=7503a995bcfedd5cf083f689fbbdd4e0a4e6a1da166bac3349af4b3c51270f7f&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3454400727


##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',
+    // Extensions register tab-type commands here. When any are present the
+    // "+" new-tab button becomes a dropdown listing all registered tab types
+    // plus the built-in SQL Editor option.
+    newTab: 'sqllab.newTab',
   },
 } as const;
+
+/**
+ * localStorage key an extension sets before calling createTab() to declare
+ * which northPane view the new tab should open with.  The value must be the
+ * view ID passed to views.registerView() (e.g. "my-ext.northPane").  SqlEditor
+ * consumes and removes this key during initialization, then persists the chosen
+ * view ID under a per-tab key so the mode survives page reloads.
+ *
+ * @example
+ * // In an extension's newTab command handler:
+ * localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'my-ext.northPane');
+ * sqlLab.createTab({ title: 'My View' });
+ */
+export const PENDING_NORTH_PANE_VIEW_KEY = 'sqllab.pendingNorthPaneView';

Review Comment:
   The pending key is written then consumed on the same synchronous `createTab` handoff, so back-to-back creations don't actually interleave here. Tokenizing it would mean threading the view id through the public `createTab` payload, which feels like its own change rather than part of this wiring β€” leaving the single-key handoff as-is.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453768261


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   **Suggestion:** Avoid adding a public tab identifier that represents the backend `tabstateview` integer ID; expose a UUID-based public identifier instead (or keep this value internal and non-exported) to prevent leaking internal numeric IDs through the extension API. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? πŸ€” </b></summary>
   
   This is a new public API field that explicitly exposes the backend's `tabstateview` integer ID. The custom rule forbids exposing internal integer IDs in public identifiers when a UUID-based public identifier should be used instead, so this is a real violation.
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=37689e341efa44e6b4f3b3b427070e75&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=37689e341efa44e6b4f3b3b427070e75&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/packages/superset-core/src/sqlLab/index.ts
   **Line:** 65:70
   **Comment:**
   	*Custom Rule: Avoid adding a public tab identifier that represents the backend `tabstateview` integer ID; expose a UUID-based public identifier instead (or keep this value internal and non-exported) to prevent leaking internal numeric IDs through the extension API.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=863a8e21822ca16cb6f43f1f17793c2205d924fbf3dd1a4f3c0776ca05e4bd3b&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=863a8e21822ca16cb6f43f1f17793c2205d924fbf3dd1a4f3c0776ca05e4bd3b&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4770508968

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/41285?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `45.31250%` with `35 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.33%. Comparing base ([`7340d06`](https://app.codecov.io/gh/apache/superset/commit/7340d06a05b4e78f23c7cc4b2e55b745903097c9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`88bc776`](https://app.codecov.io/gh/apache/superset/commit/88bc7766f219f52292d42999c53f4f7799e5e762?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/41285?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...d/src/SqlLab/components/TabbedSqlEditors/index.tsx](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2FSqlLab%2Fcomponents%2FTabbedSqlEditors%2Findex.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmJlZFNxbEVkaXRvcnMvaW5kZXgudHN4) | 25.00% | [24 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...frontend/src/SqlLab/components/SqlEditor/index.tsx](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2FSqlLab%2Fcomponents%2FSqlEditor%2Findex.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvci9pbmRleC50c3g=) | 68.00% | [8 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...rset-frontend/src/extensions/ExtensionsStartup.tsx](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2Fextensions%2FExtensionsStartup.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4dGVuc2lvbnMvRXh0ZW5zaW9uc1N0YXJ0dXAudHN4) | 50.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/41285?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #41285      +/-   ##
   ==========================================
   - Coverage   64.34%   64.33%   -0.01%     
   ==========================================
     Files        2653     2653              
     Lines      144963   145024      +61     
     Branches    33452    33471      +19     
   ==========================================
   + Hits        93281    93308      +27     
   - Misses      49997    50031      +34     
     Partials     1685     1685              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/41285/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/41285/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.54% <45.31%> (-0.02%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/41285?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4243318147


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +99,199 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+// Shown in place of PlusIcon while extensions are still loading β€” see the
+// extensionsReady guard in NewTabButton below.
+const LoadingIcon = (
+  <Icons.LoadingOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+  // Until this is true, menus.getMenu(sqllab.newTab) can't be trusted to
+  // reflect the final set of contributions β€” an extension that hasn't
+  // finished loading yet looks identical to "no extensions at all". Without
+  // this, clicking "+" during that window fell back to adding a plain SQL
+  // tab instead of waiting to show the real dropdown.
+  const extensionsReady = useExtensionsReady();
+
+  // Resolved at render time rather than module load so `t()` runs after the
+  // translator has been configured.
+  const newTabTooltip = !extensionsReady
+    ? t('Loading…')

Review Comment:
   Done, switched to `Loading...`. Thanks @EnxDev.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -219,23 +422,11 @@ function TabbedSqlEditors({
   const emptyTab = (
     <StyledTab>
       <TabTitle>{t('Add a new tab')}</TabTitle>
-      <Tooltip
-        id="add-tab"
-        placement="bottom"
-        title={
-          userOS === 'Windows'
-            ? t('New tab (Ctrl + q)')
-            : t('New tab (Ctrl + t)')
-        }
-      >
-        <Icons.PlusCircleOutlined
-          iconSize="s"
-          css={css`
-            vertical-align: middle;
-          `}
-          data-test="add-tab-icon"
-        />
-      </Tooltip>
+      {/* Reuses the toolbar's own add-tab control (dropdown when an
+          extension contributes to sqllab.newTab, plain create otherwise)
+          instead of a bare icon, so this empty-state entry point offers the
+          same choices as the "+" in the tab bar once tabs exist. */}
+      <NewTabButton onAddSqlEditor={newQueryEditor} />

Review Comment:
   Good catch. The empty state now falls back to the anchor itself when there is no antd button, and I added a zero-editor test. Not run locally, so CI will confirm.



##########
superset-frontend/src/extensions/ExtensionsLoader.ts:
##########
@@ -100,22 +112,61 @@ class ExtensionsLoader {
         const results = await Promise.all(
           extensions.map(ext => this.initializeExtension(ext)),
         );
-        if (results.every(Boolean)) {
+        const failed = extensions
+          .filter((_, index) => !results[index])
+          .map(ext => ext.name);
+        if (failed.length === 0) {
           logging.info('Extensions initialized successfully.');
         } else {
-          const failedCount = results.filter(succeeded => !succeeded).length;
           logging.info(
-            `Extensions initialized with ${failedCount} of ` +
+            `Extensions initialized with ${failed.length} of ` +
               `${extensions.length} extension(s) failing. See errors above.`,
           );
         }
+        return failed;
       } catch (error) {
+        // Reset so a later call can retry, and rethrow so callers (e.g.
+        // ExtensionsStartup) can surface the failure instead of it being
+        // swallowed here and the success path running regardless.
+        this.initializationPromise = null;
         logging.error('Error setting up extensions:', error);
+        throw error;
       }
     })();
+    // Attached separately (not reassigning this.initializationPromise) so
+    // ready-tracking is purely a side effect and every caller still sees the
+    // original promise's own resolve/reject value.
+    this.initializationPromise.finally(() => this.markReady());

Review Comment:
   Done, both branches are handled now via `.then(onOk, onErr)`.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4079425617


##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1048,6 +1127,29 @@ const SqlEditor: FC<Props> = ({
         >
           <Skeleton active />
         </div>
+      ) : northPaneViewId &&
+        northPaneViews.some(v => v.id === northPaneViewId) ? (

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Blank pane during async view load</b></div>
   <div id="fix">
   
   When `northPaneViewId` is set but the view is not yet registered (extension loads async after mount, per the comment on `useViews`), this branch renders nothing: the ternary falls through to `showEmptyState && !hasSqlStatement` and then to `queryPane()` only when `showEmptyState` is falsy. With an empty editor and `showEmptyState` true, the whole north pane blanks out until registration completes. Consider falling back to `queryPane()` while the view is pending.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #b6e90e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,93 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      const { findByTestId, queryByTestId } = setup(mockedProps, store);
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      // The default SQL editor pane is replaced, not rendered alongside.
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('opens the northPane view carried on the query editor and persists the per-tab key', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      // createTab({ northPaneViewId }) stamps the view onto the tab's own
+      // state, so nothing shared between tabs is involved.
+      const { findByTestId, queryByTestId } = setup(
+        {
+          ...mockedProps,
+          queryEditor: { ...queryEditor, northPaneViewId: 'test.northPane' },
+        },
+        store,
+      );
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+      // The chosen view is persisted under the per-tab key so it survives a
+      // reload that rehydrates the editor without the field.
+      expect(localStorage.getItem(storageKey)).toEqual('test.northPane');
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('does not open a northPane view requested for a different tab', () => {
+    const { queryEditor } = mockedProps;
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+    // Another tab was created with the view; this one mounts as a plain tab
+    // (as happens when a reload restores several tabs at once).
+    const otherTabStore = createStore({
+      ...mockInitialState,
+      sqlLab: {
+        ...mockInitialState.sqlLab,
+        queryEditors: [
+          ...mockInitialState.sqlLab.queryEditors,
+          { ...extraQueryEditor1, northPaneViewId: 'test.northPane' },
+        ],

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicate tab id in store</b></div>
   <div id="fix">
   
   Appending `{ ...extraQueryEditor1, northPaneViewId }` to `mockInitialState.sqlLab.queryEditors` duplicates id 'diekd23': fixtures' `initialState` already contains `extraQueryEditor1` (fixtures.ts:719). The store then holds an impossible two-tabs-one-id state, and any id-based lookup resolves the plain entry, shadowing the view-carrying one. Stamp the existing entry via `.map` so setup matches the scenario described.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #b6e90e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4119793274


##########
superset/translations/en/LC_MESSAGES/messages.po:
##########
@@ -14254,6 +14284,12 @@ msgid ""
 "exporting them:"
 msgstr ""
 
+msgid ""
+"The following charts were omitted because their size cannot be determined"
+" before they run. Ask an administrator to enable background exports to "
+"include them."
+msgstr ""
+

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Orphaned translation entry</b></div>
   <div id="fix">
   
   This added msgid has no matching source string anywhere in the repo: `grep -rn "omitted because their size" superset/ superset-frontend/` returns nothing. It is an orphaned translation entry that will never be matched by gettext, so it is dead cruft. Either wire the string into the export code that omits charts, or drop the entry.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
   
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #dc8857</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5910643178

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4395717556


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +99,202 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+// Shown in place of PlusIcon while extensions are still loading β€” see the
+// extensionsReady guard in NewTabButton below.
+const LoadingIcon = (
+  <Icons.LoadingOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+  // Until this is true, menus.getMenu(sqllab.newTab) can't be trusted to
+  // reflect the final set of contributions β€” an extension that hasn't
+  // finished loading yet looks identical to "no extensions at all". Without
+  // this, clicking "+" during that window fell back to adding a plain SQL
+  // tab instead of waiting to show the real dropdown.
+  const extensionsReady = useExtensionsReady();
+
+  // Resolved at render time rather than module load so `t()` runs after the
+  // translator has been configured.
+  const newTabTooltip = !extensionsReady
+    ? t('Loading...')
+    : userOS === 'Windows'
+      ? t('New tab (Ctrl + q)')
+      : t('New tab (Ctrl + t)');
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command).catch(error => {
+                logging.error(
+                  `Failed to execute command ${item.command}`,
+                  error,
+                );
+              });
+            },
+          } as MenuItemType,
+        ];
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = useCallback(() => {
+    if (!extensionsReady) {

Review Comment:
   Capped it: readiness now flips after 5s even if a remote entry is still loading, so the `+` falls back to the normal flow. Slow extensions still register their contributions when they land.



##########
superset-frontend/src/extensions/useExtensionsReady.ts:
##########
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useSyncExternalStore } from 'react';
+import { FeatureFlag, isFeatureEnabled } from '@superset-ui/core';
+import ExtensionsLoader from './ExtensionsLoader';
+
+/**
+ * Host-internal only (not part of the @apache-superset/core extension-author
+ * API): whether extension loading has settled, so UI that reads contributed
+ * menus/views/commands β€” e.g. the sqllab.newTab dropdown β€” can distinguish
+ * "still loading" (show a spinner, don't fall back yet) from "loaded, and
+ * there's genuinely nothing registered" (the fallback is correct).
+ *
+ * When the EnableExtensions feature flag is off, ExtensionsStartup never
+ * calls initializeExtensions() at all, so there's nothing to wait for β€”
+ * this returns true immediately in that case rather than reporting an
+ * indefinite pending state.
+ */
+export function useExtensionsReady(): boolean {

Review Comment:
   Added loader tests for `markReady` on resolve, reject and the timeout, plus a `NewTabButton` test with the flag on: click is ignored while init is pending, then the dropdown opens once it resolves.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453811409


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type mismatch with backend API</b></div>
   <div id="fix">
   
   The type `string` contradicts the docstring on line 66 which explicitly states 'integer ID', and the backend API returns `tab_state_id: number` (see `sqlLab.ts:46` and `sqlLab.ts:869`). This mismatch could cause type errors and runtime issues.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset-frontend/packages/superset-core/src/sqlLab/index.ts (lines 65-71) ---
    65:   /**
    66:    * The stable backend-assigned ID for this tab (the tabstateview integer ID).
    67:    * Set once the tab has been persisted to the backend. Undefined for new tabs
    68:    * before the first backend sync.
    69:    */
    70: -  backendId?: string;
    70: +  backendId?: number;
    71: 
        /**
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #68d738</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(
+      queryEditor.tabViewId ?? queryEditor.id,
+    );
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [queryEditor.tabViewId, queryEditor.id, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(queryEditor.id)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [queryEditor.id]);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing unit tests for northPane feature</b></div>
   <div id="fix">
   
   The northPane view feature (lines 124-318) introduces new localStorage-based state management with storage event listeners for cross-tab sync. SqlEditor.test.tsx has zero test coverage for any northPane-related logic. Per BITO.md rule [11730], new features should include comprehensive unit tests covering success paths, error scenarios, and edge cases.
   </div>
   
   
   </div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Storage listener key mismatch</b></div>
   <div id="fix">
   
   The storage event listener on line 312 only watches `NORTH_PANE_VIEW_KEY(queryEditor.id)`, but the persistence effect on lines 299-308 writes to `NORTH_PANE_VIEW_KEY(queryEditor.tabViewId ?? queryEditor.id)`. When `tabViewId` differs from `id`, cross-tab synchronization via the `storage` event will silently miss updates to the persisted key, breaking multi-tab state sync.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #68d738</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3454032271


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,14 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned identifier for this tab. Exposed as an opaque
+   * string so the public extension API does not leak the backend's internal
+   * numeric tab id. Set once the tab has been persisted to the backend;
+   * undefined for new tabs before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   **Suggestion:** The new public `backendId` field is declared but the runtime `Tab` objects are still created without setting it, so extensions will always receive `undefined` and cannot correlate tabs with backend `tabstateview` rows as documented. Populate this field when building `Tab` instances (for example from the persisted tab identifier) so the API contract is actually fulfilled. [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Extensions cannot map tabs to backend tabstateview rows.
   - ⚠️ Extensions must re-derive mappings from internal Redux state.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Extensions access the SQL Lab API via `window.superset.sqlLab` as wired in
   `ExtensionsStartup` (superset-frontend/src/extensions/ExtensionsStartup.tsx:65-76), which
   exposes the `sqlLab` implementation from `src/core/sqlLab/index.ts`.
   
   2. A caller invokes `sqlLab.createTab()` or listens to `sqlLab.onDidCreateTab`, whose
   implementations in `src/core/sqlLab/index.ts:217-233` and `239-38` construct `Tab`
   instances by calling `makeTab(...)` (same file, lines 18-31) or `getTab(...)` (lines
   33-40).
   
   3. `makeTab(...)` returns `new Tab(id, name, dbId, catalog, schema, editorGetter, panels)`
   (src/core/sqlLab/index.ts:18-31), using the `Tab` class defined in
   `src/core/sqlLab/models.ts:34-70`, which only declares `id`, `title`, `databaseId`,
   `catalog`, `schema`, `panels`, and `getEditor()` β€” it has no `backendId` field and never
   assigns one.
   
   4. The public API type in this PR adds `backendId?: string;` to `sqlLab.Tab`
   (superset-frontend/packages/superset-core/src/sqlLab/index.ts:65-71), but since neither
   `Tab` in `models.ts` nor `makeTab(...)`/`getTab(...)` ever set that property, any
   extension reading `tab.backendId` from `getCurrentTab()`, `getTabs()`, or `onDidCreateTab`
   will always see `undefined`, making the new API field unusable.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1edd73deea6348ac9808de6dd6a67dbd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1edd73deea6348ac9808de6dd6a67dbd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/packages/superset-core/src/sqlLab/index.ts
   **Line:** 71:71
   **Comment:**
   	*Incomplete Implementation: The new public `backendId` field is declared but the runtime `Tab` objects are still created without setting it, so extensions will always receive `undefined` and cannot correlate tabs with backend `tabstateview` rows as documented. Populate this field when building `Tab` instances (for example from the persisted tab identifier) so the API contract is actually fulfilled.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=86e7389754e06ca54d459b34e9133385c293a76ed2ee4cc6d22a9152b304e5e2&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=86e7389754e06ca54d459b34e9133385c293a76ed2ee4cc6d22a9152b304e5e2&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/SqlLab/contributions.ts:
##########
@@ -46,5 +46,27 @@ export const ViewLocations = {
     statusBar: 'sqllab.statusBar',
     results: 'sqllab.results',
     queryHistory: 'sqllab.queryHistory',
+    // Extensions can register a full-pane replacement here. SqlEditor renders
+    // the registered view instead of the default editor+SouthPane split when
+    // a tab was opened in that mode.
+    northPane: 'sqllab.northPane',
+    // Extensions register tab-type commands here. When any are present the
+    // "+" new-tab button becomes a dropdown listing all registered tab types
+    // plus the built-in SQL Editor option.
+    newTab: 'sqllab.newTab',
   },
 } as const;
+
+/**
+ * localStorage key an extension sets before calling createTab() to declare
+ * which northPane view the new tab should open with.  The value must be the
+ * view ID passed to views.registerView() (e.g. "my-ext.northPane").  SqlEditor
+ * consumes and removes this key during initialization, then persists the chosen
+ * view ID under a per-tab key so the mode survives page reloads.
+ *
+ * @example
+ * // In an extension's newTab command handler:
+ * localStorage.setItem(PENDING_NORTH_PANE_VIEW_KEY, 'my-ext.northPane');
+ * sqlLab.createTab({ title: 'My View' });
+ */
+export const PENDING_NORTH_PANE_VIEW_KEY = 'sqllab.pendingNorthPaneView';

Review Comment:
   **Suggestion:** Using a single global localStorage key for pending north-pane selection introduces a race: two extension tab creations in quick succession can overwrite each other before `SqlEditor` consumes the key, causing the wrong tab mode to open. Use a per-request/per-tab tokenized key (or pass the view id through tab creation payload/state) to avoid cross-tab collisions. [race condition]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ North-pane tabs can show another extension's view.
   - ⚠️ Tab layout becomes nondeterministic under rapid tab creation.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Extensions register custom north-pane views under `ViewLocations.sqllab.northPane` and
   follow the documented pattern in `superset-frontend/src/SqlLab/contributions.ts:61-71`,
   setting the global `localStorage` key `sqllab.pendingNorthPaneView` via
   `PENDING_NORTH_PANE_VIEW_KEY` before calling `window.superset.sqlLab.createTab({ title:
   ... })`.
   
   2. `sqlLab.createTab()` is implemented in
   `superset-frontend/src/core/sqlLab/index.ts:239-38`; it dispatches `ADD_QUERY_EDITOR` and
   the new `QueryEditor` entries are rendered by `TabbedSqlEditors`
   (superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:273-288), which for
   each `queryEditor` mounts a corresponding `<SqlEditor queryEditor={qe} ... />`.
   
   3. Each `SqlEditor` instance initializes its `northPaneViewId` state by reading the
   *global* pending key: the initializer in
   `superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:292-305` does `const
   pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);` and, if present,
   removes that key and writes the value to a per-tab key
   `NORTH_PANE_VIEW_KEY(northPaneStorageId)`.
   
   4. If two different extension commands run in quick succession (e.g., two `sqllab.newTab`
   menu items from separate extensions, activated via the `NewTabButton` dropdown at
   `TabbedSqlEditors/index.tsx:113-147` and `commands.executeCommand(item.command)`), they
   each overwrite the same global `PENDING_NORTH_PANE_VIEW_KEY` before both `SqlEditor`
   instances have run their initialization. As a result, at least one tab will read a stale
   or mismatched `pendingViewId` (or none at all), causing that tab to open with the wrong
   north-pane view or fall back to the default editor layout, despite the extension having
   set a different desired view for its tab.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=faf89980cbf145fa9cce8fca09c402cd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=faf89980cbf145fa9cce8fca09c402cd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/SqlLab/contributions.ts
   **Line:** 72:72
   **Comment:**
   	*Race Condition: Using a single global localStorage key for pending north-pane selection introduces a race: two extension tab creations in quick succession can overwrite each other before `SqlEditor` consumes the key, causing the wrong tab mode to open. Use a per-request/per-tab tokenized key (or pass the view id through tab creation payload/state) to avoid cross-tab collisions.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=b9cb7e3dc042f479f2d3115c757ef8bd303d76f0da5fdfd9076352056e2a65ca&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=b9cb7e3dc042f479f2d3115c757ef8bd303d76f0da5fdfd9076352056e2a65ca&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3455324337


##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   Good catch β€” added `backendId` coverage in `sqlLab.test.ts`: it stays undefined for a fresh tab and surfaces the editor `tabViewId` once set.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4772315565

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3455015460


##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing backendId test coverage</b></div>
   <div id="fix">
   
   The `backendId` property added to `Tab` class has no test coverage. sqlLab.test.ts (585 lines) contains zero assertions for backendId β€” not in 'createTab' (line 560), 'setActiveTab', nor any other test. Per rule [11730], new features must have unit tests covering success paths, error scenarios, and edge cases. Add assertions verifying backendId is undefined for new tabs before sync and properly stored when set via constructor.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #43c3dc</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4774186105

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4801529388

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4976294579

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3525756749


##########
superset-frontend/src/core/sqlLab/sqlLab.test.ts:
##########
@@ -561,10 +561,29 @@ test('createTab dispatches ADD_QUERY_EDITOR and returns the new tab', async () =
 
   expect(tab).toBeDefined();
   expect(tab.title).toBe('Custom Tab');
+  // A freshly created tab has no backend identifier until it syncs.
+  expect(tab.backendId).toBeUndefined();
   const tabs = sqlLab.getTabs();
   expect(tabs.length).toBeGreaterThanOrEqual(2);
 });
 
+test('getTabs leaves backendId undefined when the editor has no tabViewId', () => {
+  // The preloaded editor has no tabViewId, so its backendId stays undefined.
+  const [tab] = sqlLab.getTabs();
+  expect(tab.id).toBe(EDITOR_ID);
+  expect(tab.backendId).toBeUndefined();
+});
+
+test('getTabs surfaces the editor tabViewId as the tab backendId', () => {
+  // Stamp a backend id onto the editor and confirm it flows through to the tab.
+  (mockStore.getState().sqlLab.queryEditors[0] as QueryEditor).tabViewId =
+    'backend-42';
+
+  const tab = sqlLab.getCurrentTab();

Review Comment:
   Good catch β€” switched it to actually call `getTabs()`.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1046,6 +1120,29 @@ const SqlEditor: FC<Props> = ({
             'Choose one of the available databases from the panel on the left.',
           )}

Review Comment:
   Right β€” moved the northPane check ahead of the empty-state branch so extension tabs render without a db selected.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +97,114 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const newTabTooltip =
+  userOS === 'Windows' ? t('New tab (Ctrl + q)') : t('New tab (Ctrl + t)');
+
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command);

Review Comment:
   Added a `.catch` so a rejected command logs instead of going unhandled.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4154935224


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -440,7 +487,7 @@ const onDidCloseTab: typeof sqlLabApi.onDidCloseTab = (
         action.queryEditor.dbId ?? 0,
         action.queryEditor.catalog,
         action.queryEditor.schema,
-        true, // closed
+        { closed: true, backendId: resolveBackendId(action.queryEditor) },

Review Comment:
   This one's intentional, not a regression. resolveBackendId already returns undefined for a tab that's still local-only (no tabViewId yet), same as every other Tab construction site here. Falling back to the editor id would bring back the exact bug sadpandajoe flagged earlier in this PR.



##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -557,6 +605,9 @@ const createTab: typeof sqlLabApi.createTab = async (
       inheritedValues.queryLimit ?? common?.conf?.DEFAULT_SQLLAB_LIMIT,
     autorun: false,
     name,
+    ...(options?.northPaneViewId && {
+      northPaneViewId: options.northPaneViewId,
+    }),

Review Comment:
   northPaneViewId isn't meant to live on the returned Tab. It's carried on the queryEditor's own redux state, and SqlEditor reads it from there to pick which view to render, covered in sqlLab.test.ts.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4083080355


##########
superset-frontend/src/core/sqlLab/index.ts:
##########
@@ -161,19 +191,37 @@ const makeTab = (
   catalog: string | null = null,
   schema: string | null = null,
   closed: boolean = false,
+  backendId?: string,

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Positional boolean placeholders</b></div>
   <div id="fix">
   
   Adding `backendId` as an eighth positional parameter forces every `makeTab` call site to pass a bare `false` placeholder for `closed` (lines 271, 564, 636), which readers cannot interpret without opening the signature. Consider an options object (e.g. `{ closed, backendId }`) so arguments are self-describing and future params stop growing the positional list.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #f2f26e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -260,26 +261,56 @@ test('does not initialize ExtensionsLoader when EnableExtensions feature flag is
   initializeSpy.mockRestore();
 });
 
-test('continues rendering children even when ExtensionsLoader initialization fails', async () => {
+test('surfaces a warning toast naming the extensions that failed to initialize', async () => {
+  mockIsFeatureEnabled.mockReturnValue(true);
+
+  // A single extension's remote entry failing does not reject the aggregate;
+  // the loader resolves with the names of the failed extensions instead.
+  const originalInitialize = ExtensionsLoader.prototype.initializeExtensions;
+  ExtensionsLoader.prototype.initializeExtensions = jest
+    .fn()
+    .mockResolvedValue(['Broken Extension']);
+
+  const store = createStore(mockInitialState, reducerIndex);
+
+  render(
+    <ExtensionsStartup>
+      <div data-testid="child" />
+    </ExtensionsStartup>,
+    { store, useRouter: true },
+  );
+
+  await waitFor(() => {
+    const { messageToasts } = store.getState() as unknown as {
+      messageToasts: { text: string }[];
+    };
+    expect(
+      messageToasts.some(toast =>
+        /Some extensions failed to load: Broken Extension/.test(toast.text),
+      ),
+    ).toBe(true);
+  });
+
+  ExtensionsLoader.prototype.initializeExtensions = originalInitialize;

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Mock leaks on test failure</b></div>
   <div id="fix">
   
   Assigning `ExtensionsLoader.prototype.initializeExtensions` is only reverted on the happy path: if any `waitFor` assertion in this test (or the two sibling failure tests) fails, the trailing restore is skipped and the mock leaks into later tests, since `afterEach` resets the loader instance but not the prototype. Restore in `finally` or in `afterEach`.
   </div>
   
   
   </div>
   
   
   
   <div id="suggestion">
   <div id="issue"><b>Repeated toast assertion boilerplate</b></div>
   <div id="fix">
   
   The `store.getState() as unknown as { messageToasts: ... }` plus regex-search block repeats three times (here, lines 327-334 and 365-374). Extracting a small helper that returns the toast texts keeps the three failure-path tests consistent and gives one place to adapt if the toast state shape or wording changes.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #f2f26e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,94 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicated test setup</b></div>
   <div id="fix">
   
   The three new tests repeat an identical `views.registerView({ id: 'test.northPane', ... }, ViewLocations.sqllab.northPane, ...)` block (also at lines 430-434 and 460-464) and the `sqllab.northPaneView.${queryEditor.id}` key derivation (lines 407, 429, 459). A shared helper like the existing `setupWithLatestQuery`, or a `beforeEach` registration, keeps the fixture in sync when the view id or key format changes.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #f2f26e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -265,25 +424,7 @@ function TabbedSqlEditors({
       onEdit={handleEdit}
       popupClassName={SQLLAB_TAB_OVERFLOW_POPUP_CLASS}
       type={queryEditors?.length === 0 ? 'card' : 'editable-card'}
-      addIcon={
-        <Tooltip
-          id="add-tab"
-          placement="left"
-          title={
-            userOS === 'Windows'
-              ? t('New tab (Ctrl + q)')
-              : t('New tab (Ctrl + t)')
-          }
-        >
-          <Icons.PlusOutlined
-            iconSize="l"
-            css={css`
-              vertical-align: middle;
-            `}
-            data-test="add-tab-icon"
-          />
-        </Tooltip>
-      }
+      addIcon={<NewTabButton onAddSqlEditor={() => newQueryEditor()} />}

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Unstable callback defeats memoization</b></div>
   <div id="fix">
   
   The inline `() => newQueryEditor()` creates a new prop on every render of `TabbedSqlEditors`, which re-renders on every keystroke via `queries`. That defeats the `dropdownItems` memo and re-runs the listener-attaching `useEffect` whenever `activate` changes. `newQueryEditor` is already a stable `useCallback` β€” pass it directly.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #f2f26e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5903427291

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4772895379

   ### <span aria-hidden="true">βœ…</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">πŸ”¨</span> Latest commit | 25595b0a9d788a35bcb9ddf06a639ec809d7fafa |
   |<span aria-hidden="true">πŸ”</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a399eb796b71f000822e3e0 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-41285--superset-docs-preview.netlify.app](https://deploy-preview-41285--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">πŸ“±</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQxMjg1LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.RVKJX-12EDe5wQyhiB37hKApaZNVhv0Ek0cLF5_QVRk)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">πŸ€–</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcvBDYMwDADAXfxuRApSIN2gY9jBiEipnQbzQFV3J7_73A9q0081eAE8gBpK2rs3RhuObylILqlYy3RaVnFVs9jhUmGUHlauRa_32kvAKUamOQaan5v3fhlHntjD_wY) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-41285--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3455325127


##########
superset-frontend/src/core/sqlLab/models.ts:
##########
@@ -62,6 +65,7 @@ export class Tab implements sqlLabType.Tab {
     this.schema = schema;
     this.editorGetter = editorGetter;
     this.panels = panels;
+    this.backendId = backendId;

Review Comment:
   <!-- Bito Reply -->
   The suggestion to add test coverage for the `backendId` property is appropriate. Verifying that `backendId` is undefined for new tabs and correctly stored when set ensures the property behaves as expected, which improves the reliability of the `Tab` class.
   
   **superset-frontend/src/core/sqlLab/models.ts**
   ```
   this.schema = schema;
       this.editorGetter = editorGetter;
       this.panels = panels;
   +    this.backendId = backendId;
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3474545450


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +70,28 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(() =>
+          supersetCore.utils.logging.info(
+            'Extensions initialized successfully.',
+          ),
+        )
+        .catch(error => {

Review Comment:
   **Suggestion:** Avoid an implicit `any` for the Promise rejection parameter by typing the caught error as `unknown` (or another concrete error type) and narrowing it before use. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? πŸ€” </b></summary>
   
   The suggestion is verified: in TypeScript, the Promise rejection handler parameter for `catch` is typed as `any` in the standard lib definitions. This is new TSX code introduced in the diff, so it matches the custom rule against using `any` in modified TypeScript/TSX code.
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bd84e8032a874d2dbc84422b95e2fa5b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bd84e8032a874d2dbc84422b95e2fa5b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/extensions/ExtensionsStartup.tsx
   **Line:** 83:83
   **Comment:**
   	*Custom Rule: Avoid an implicit `any` for the Promise rejection parameter by typing the caught error as `unknown` (or another concrete error type) and narrowing it before use.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=1c9d8796d42edaa432c0ac4a420904fa9a6cab637c12bfd68eb9d22da57ddfed&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=1c9d8796d42edaa432c0ac4a420904fa9a6cab637c12bfd68eb9d22da57ddfed&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/extensions/ExtensionsStartup.test.tsx:
##########
@@ -291,6 +289,17 @@ test('continues rendering children even when ExtensionsLoader initialization fai
     ).toBeInTheDocument();
   });
 
+  // The failure must reach the user as a warning toast rather than being
+  // swallowed silently.
+  await waitFor(() => {
+    const toasts = (store.getState() as any).messageToasts;

Review Comment:
   **Suggestion:** Replace the `any` cast on `store.getState()` with a concrete state type (for example a `RootState`/test-store state type) so `messageToasts` is accessed through typed state instead of `any`. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? πŸ€” </b></summary>
   
   The file is TypeScript (`.tsx`), and the code uses an explicit `any` cast on Redux state. This directly violates the rule forbidding new or modified TypeScript/TSX code that uses `any`, so the suggestion is valid.
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=636d2bb7962e453aa2aa18fde4fc23f6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=636d2bb7962e453aa2aa18fde4fc23f6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/extensions/ExtensionsStartup.test.tsx
   **Line:** 295:295
   **Comment:**
   	*Custom Rule: Replace the `any` cast on `store.getState()` with a concrete state type (for example a `RootState`/test-store state type) so `messageToasts` is accessed through typed state instead of `any`.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=37a3089c925e332217aa5faac97f3404c777217a5d859c78efe4dbcb1dded3ee&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41285&comment_hash=37a3089c925e332217aa5faac97f3404c777217a5d859c78efe4dbcb1dded3ee&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-4829005409

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r3453927090


##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   Kept `backendId` as an opaque string deliberately so the public extension API doesn't leak the internal numeric tab id β€” clarified the docstring to say as much rather than calling it an integer id.



##########
superset-frontend/packages/superset-core/src/sqlLab/index.ts:
##########
@@ -62,6 +62,13 @@ export interface Tab {
    */
   id: string;
 
+  /**
+   * The stable backend-assigned ID for this tab (the tabstateview integer ID).
+   * Set once the tab has been persisted to the backend. Undefined for new tabs
+   * before the first backend sync.
+   */
+  backendId?: string;

Review Comment:
   Leaving this as a string on purpose β€” we don't want the public extension API exposing the backend's internal numeric id. Fixed the misleading docstring that called it an integer.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -271,6 +279,44 @@ const SqlEditor: FC<Props> = ({
 
   const logAction = useLogAction({ queryEditorId: queryEditor.id });
   const isActive = currentQueryEditorId === queryEditor.id;
+
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // ID of the northPane view active for this tab, or null for the default
+  // SQL editor layout.  Set by an extension via PENDING_NORTH_PANE_VIEW_KEY
+  // before calling createTab(); persisted per-tab in localStorage.
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(() => {
+    const pendingViewId = localStorage.getItem(PENDING_NORTH_PANE_VIEW_KEY);
+    if (pendingViewId) {
+      localStorage.removeItem(PENDING_NORTH_PANE_VIEW_KEY);
+      localStorage.setItem(NORTH_PANE_VIEW_KEY(queryEditor.id), pendingViewId);
+      return pendingViewId;
+    }
+    return localStorage.getItem(NORTH_PANE_VIEW_KEY(queryEditor.id));
+  });
+
+  useEffect(() => {
+    const persistKey = NORTH_PANE_VIEW_KEY(
+      queryEditor.tabViewId ?? queryEditor.id,
+    );
+    if (northPaneViewId) {
+      localStorage.setItem(persistKey, northPaneViewId);
+    } else {
+      localStorage.removeItem(persistKey);
+    }
+  }, [queryEditor.tabViewId, queryEditor.id, northPaneViewId]);
+
+  useEffect(() => {
+    const handler = (e: StorageEvent) => {
+      if (e.key === NORTH_PANE_VIEW_KEY(queryEditor.id)) {
+        setNorthPaneViewId(e.newValue || null);
+      }
+    };
+    window.addEventListener('storage', handler);
+    return () => window.removeEventListener('storage', handler);
+  }, [queryEditor.id]);

Review Comment:
   Fixed the storage-listener key mismatch β€” read/write/listener all resolve to `tabViewId ?? id` now. Also added coverage for the extension load-failure path.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4163409223


##########
superset-frontend/src/SqlLab/components/SqlEditor/useNorthPaneView.ts:
##########
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useEffect, useRef, useState } from 'react';
+import type { QueryEditor } from 'src/SqlLab/types';
+import { ViewLocations } from 'src/SqlLab/contributions';
+import { useViews } from 'src/core/views';
+
+/** Per-tab localStorage key storing the active northPane view ID. */
+const NORTH_PANE_VIEW_KEY = (tabId: string) => `sqllab.northPaneView.${tabId}`;
+
+// The northPane keys are dynamic per-tab strings rather than members of the
+// typed LocalStorageKeys enum, so the typed helpers don't apply. Guard the raw
+// access here so a storage-restricted browser can't crash the editor mount.
+const readNorthPaneStorage = (key: string): string | null => {
+  try {
+    return localStorage.getItem(key);
+  } catch {
+    return null;
+  }
+};
+
+const writeNorthPaneStorage = (key: string, value: string | null): void => {
+  try {
+    if (value === null) {
+      localStorage.removeItem(key);
+    } else {
+      localStorage.setItem(key, value);
+    }
+  } catch {
+    // localStorage may be unavailable (blocked/quota/private mode); ignore.
+  }
+};
+
+/**
+ * Tracks which view (if any) a tab's north pane should render, keeping it in
+ * sync across reloads and other tabs via a per-tab localStorage entry.
+ *
+ * A tab created through the extension API carries the requested view on its
+ * own query editor state, so it can never be picked up by another tab.
+ * Editors hydrated from the backend on reload don't carry the field, so this
+ * falls back to the per-tab localStorage entry kept in sync below.
+ */
+export default function useNorthPaneView(queryEditor: QueryEditor) {
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(
+    () =>
+      queryEditor.northPaneViewId ??
+      readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId)),
+  );
+
+  // Tracks the storage id last written so that, when a tab syncs to the
+  // backend and `tabViewId` arrives, the entry under the old id-keyed key is
+  // removed rather than left orphaned in localStorage.
+  const northPaneStorageIdRef = useRef(northPaneStorageId);
+
+  useEffect(() => {
+    if (northPaneStorageIdRef.current !== northPaneStorageId) {
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageIdRef.current),
+        null,
+      );
+      northPaneStorageIdRef.current = northPaneStorageId;
+    }
+    writeNorthPaneStorage(

Review Comment:
   Nit, take it or leave it. Nothing removes `sqllab.northPaneView.<id>` when a tab is closed, so every closed extension tab leaves a key behind in localStorage.
   
   Clearing it on the close path (or in `removeQueryEditor`) would keep it tidy.



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -219,23 +422,11 @@ function TabbedSqlEditors({
   const emptyTab = (
     <StyledTab>
       <TabTitle>{t('Add a new tab')}</TabTitle>
-      <Tooltip
-        id="add-tab"
-        placement="bottom"
-        title={
-          userOS === 'Windows'
-            ? t('New tab (Ctrl + q)')
-            : t('New tab (Ctrl + t)')
-        }
-      >
-        <Icons.PlusCircleOutlined
-          iconSize="s"
-          css={css`
-            vertical-align: middle;
-          `}
-          data-test="add-tab-icon"
-        />
-      </Tooltip>
+      {/* Reuses the toolbar's own add-tab control (dropdown when an
+          extension contributes to sqllab.newTab, plain create otherwise)
+          instead of a bare icon, so this empty-state entry point offers the
+          same choices as the "+" in the tab bar once tabs exist. */}
+      <NewTabButton onAddSqlEditor={newQueryEditor} />

Review Comment:
   In the empty state there's no antd add `<button>` around this (the Tabs are `card`, not `editable-card`), so `closest('button')` at L250 returns null and the capture listener never attaches.
   
   The click just bubbles to `onTabClicked` and creates a plain SQL tab, so the dropdown never shows here, even while extensions are still loading. Could this path get its own click handler that calls `activate()`, and a test that starts with zero query editors?



##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +99,199 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+// Shown in place of PlusIcon while extensions are still loading β€” see the
+// extensionsReady guard in NewTabButton below.
+const LoadingIcon = (
+  <Icons.LoadingOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+  // Until this is true, menus.getMenu(sqllab.newTab) can't be trusted to
+  // reflect the final set of contributions β€” an extension that hasn't
+  // finished loading yet looks identical to "no extensions at all". Without
+  // this, clicking "+" during that window fell back to adding a plain SQL
+  // tab instead of waiting to show the real dropdown.
+  const extensionsReady = useExtensionsReady();
+
+  // Resolved at render time rather than module load so `t()` runs after the
+  // translator has been configured.
+  const newTabTooltip = !extensionsReady
+    ? t('Loading…')

Review Comment:
   `Loading…` with the ellipsis character isn't in `messages.pot`, which is what's failing babel-extract and `check_pot_drift_test`.
   
   The pot already has `Loading...` with three dots and existing translations, so reusing it fixes both checks:
   ```suggestion
       ? t('Loading...')
   ```



##########
superset-frontend/src/extensions/ExtensionsLoader.ts:
##########
@@ -100,22 +112,61 @@ class ExtensionsLoader {
         const results = await Promise.all(
           extensions.map(ext => this.initializeExtension(ext)),
         );
-        if (results.every(Boolean)) {
+        const failed = extensions
+          .filter((_, index) => !results[index])
+          .map(ext => ext.name);
+        if (failed.length === 0) {
           logging.info('Extensions initialized successfully.');
         } else {
-          const failedCount = results.filter(succeeded => !succeeded).length;
           logging.info(
-            `Extensions initialized with ${failedCount} of ` +
+            `Extensions initialized with ${failed.length} of ` +
               `${extensions.length} extension(s) failing. See errors above.`,
           );
         }
+        return failed;
       } catch (error) {
+        // Reset so a later call can retry, and rethrow so callers (e.g.
+        // ExtensionsStartup) can surface the failure instead of it being
+        // swallowed here and the success path running regardless.
+        this.initializationPromise = null;
         logging.error('Error setting up extensions:', error);
+        throw error;
       }
     })();
+    // Attached separately (not reassigning this.initializationPromise) so
+    // ready-tracking is purely a side effect and every caller still sees the
+    // original promise's own resolve/reject value.
+    this.initializationPromise.finally(() => this.markReady());

Review Comment:
   `.finally()` returns a new promise that rejects whenever the original does, and nothing handles it. When the list fetch fails, that surfaces as an unhandled rejection: it's what crashes the worker in sharded-jest-tests (3) at `ExtensionsLoader.test.ts:500`, and in the browser it shows up as an `Uncaught (in promise)` next to the toast.
   
   Handling both branches avoids the dangling chain:
   ```suggestion
       this.initializationPromise.then(
         () => this.markReady(),
         () => this.markReady(),
       );
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4319700995


##########
superset-frontend/src/SqlLab/components/SqlEditor/useNorthPaneView.ts:
##########
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useEffect, useRef, useState } from 'react';
+import type { QueryEditor } from 'src/SqlLab/types';
+import { ViewLocations } from 'src/SqlLab/contributions';
+import { useViews } from 'src/core/views';
+
+/** Per-tab localStorage key storing the active northPane view ID. */
+const NORTH_PANE_VIEW_KEY = (tabId: string) => `sqllab.northPaneView.${tabId}`;
+
+// The northPane keys are dynamic per-tab strings rather than members of the
+// typed LocalStorageKeys enum, so the typed helpers don't apply. Guard the raw
+// access here so a storage-restricted browser can't crash the editor mount.
+const readNorthPaneStorage = (key: string): string | null => {
+  try {
+    return localStorage.getItem(key);
+  } catch {
+    return null;
+  }
+};
+
+const writeNorthPaneStorage = (key: string, value: string | null): void => {
+  try {
+    if (value === null) {
+      localStorage.removeItem(key);
+    } else {
+      localStorage.setItem(key, value);
+    }
+  } catch {
+    // localStorage may be unavailable (blocked/quota/private mode); ignore.
+  }
+};
+
+/**
+ * Tracks which view (if any) a tab's north pane should render, keeping it in
+ * sync across reloads and other tabs via a per-tab localStorage entry.
+ *
+ * A tab created through the extension API carries the requested view on its
+ * own query editor state, so it can never be picked up by another tab.
+ * Editors hydrated from the backend on reload don't carry the field, so this
+ * falls back to the per-tab localStorage entry kept in sync below.
+ */
+export default function useNorthPaneView(queryEditor: QueryEditor) {
+  // Re-renders when an extension registers a northPane view after async load.
+  const northPaneViews = useViews(ViewLocations.sqllab.northPane) || [];
+
+  // Resolve the per-tab localStorage key the same way every other SQL Lab
+  // consumer does (`tabViewId ?? id`), so the value written, read back, and
+  // observed via the `storage` event all agree once a tab is backend-persisted.
+  const northPaneStorageId = queryEditor.tabViewId ?? queryEditor.id;
+
+  const [northPaneViewId, setNorthPaneViewId] = useState<string | null>(
+    () =>
+      queryEditor.northPaneViewId ??
+      readNorthPaneStorage(NORTH_PANE_VIEW_KEY(northPaneStorageId)),
+  );
+
+  // Tracks the storage id last written so that, when a tab syncs to the
+  // backend and `tabViewId` arrives, the entry under the old id-keyed key is
+  // removed rather than left orphaned in localStorage.
+  const northPaneStorageIdRef = useRef(northPaneStorageId);
+
+  useEffect(() => {
+    if (northPaneStorageIdRef.current !== northPaneStorageId) {
+      writeNorthPaneStorage(
+        NORTH_PANE_VIEW_KEY(northPaneStorageIdRef.current),
+        null,
+      );
+      northPaneStorageIdRef.current = northPaneStorageId;
+    }
+    writeNorthPaneStorage(

Review Comment:
   Went ahead and did this one, @EnxDev. closeTab (and the UI's own removeQueryEditor action) now clear the tab's northPaneView key instead of leaving it behind forever.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4329640995


##########
superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx:
##########
@@ -94,6 +99,202 @@ const TabTitle = styled.span`
 // Get the user's OS
 const userOS = detectOS();
 
+const PlusIcon = (
+  <Icons.PlusOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+// Shown in place of PlusIcon while extensions are still loading β€” see the
+// extensionsReady guard in NewTabButton below.
+const LoadingIcon = (
+  <Icons.LoadingOutlined
+    iconSize="l"
+    css={css`
+      vertical-align: middle;
+    `}
+    data-test="add-tab-icon"
+  />
+);
+
+function NewTabButton({ onAddSqlEditor }: { onAddSqlEditor: () => void }) {
+  const [open, setOpen] = useState(false);
+  // Until this is true, menus.getMenu(sqllab.newTab) can't be trusted to
+  // reflect the final set of contributions β€” an extension that hasn't
+  // finished loading yet looks identical to "no extensions at all". Without
+  // this, clicking "+" during that window fell back to adding a plain SQL
+  // tab instead of waiting to show the real dropdown.
+  const extensionsReady = useExtensionsReady();
+
+  // Resolved at render time rather than module load so `t()` runs after the
+  // translator has been configured.
+  const newTabTooltip = !extensionsReady
+    ? t('Loading...')
+    : userOS === 'Windows'
+      ? t('New tab (Ctrl + q)')
+      : t('New tab (Ctrl + t)');
+
+  const dropdownItems = useMemo<MenuItemType[]>(() => {
+    if (!open) return [];
+    const primaryItems =
+      menus.getMenu(ViewLocations.sqllab.newTab)?.primary ?? [];
+    return [
+      {
+        key: 'sql-editor',
+        label: t('SQL Editor'),
+        icon: <Icons.TableOutlined iconSize="m" />,
+        onClick: () => {
+          setOpen(false);
+          onAddSqlEditor();
+        },
+      },
+      ...primaryItems.flatMap(item => {
+        const command = commands.getCommand(item.command);
+        if (!command) {
+          // An extension contributed this menu item but its command isn't
+          // registered (load is still pending or failed). Skip it so clicking
+          // can't throw "Command not found" and break the add-tab flow.
+          return [];
+        }
+        const Icon = command.icon
+          ? ((Icons as Record<string, typeof Icons.FileOutlined>)[
+              command.icon
+            ] ?? Icons.FileOutlined)
+          : Icons.FileOutlined;
+        return [
+          {
+            key: command.id,
+            label: command.title ?? item.command,
+            icon: <Icon iconSize="m" />,
+            onClick: () => {
+              setOpen(false);
+              commands.executeCommand(item.command).catch(error => {
+                logging.error(
+                  `Failed to execute command ${item.command}`,
+                  error,
+                );
+              });
+            },
+          } as MenuItemType,
+        ];
+      }),
+    ];
+  }, [open, onAddSqlEditor]);
+
+  const activate = useCallback(() => {
+    if (!extensionsReady) {

Review Comment:
   Until every extension's remote entry settles, the `+` is dead: the capture listener swallows the click and `activate()` returns early. Readiness waits on the `Promise.all` at `ExtensionsLoader.ts:112` and the script load has no timeout, so one slow bundle, even from an extension that contributes nothing to SQL Lab, leaves users looking at a spinner and a "Loading..." tooltip.
   
   Could we cap the wait and fall back to a plain tab after a few seconds, or open the dropdown right away with SQL Editor and let contributed items fill in as they register?



##########
superset-frontend/src/extensions/useExtensionsReady.ts:
##########
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useSyncExternalStore } from 'react';
+import { FeatureFlag, isFeatureEnabled } from '@superset-ui/core';
+import ExtensionsLoader from './ExtensionsLoader';
+
+/**
+ * Host-internal only (not part of the @apache-superset/core extension-author
+ * API): whether extension loading has settled, so UI that reads contributed
+ * menus/views/commands β€” e.g. the sqllab.newTab dropdown β€” can distinguish
+ * "still loading" (show a spinner, don't fall back yet) from "loaded, and
+ * there's genuinely nothing registered" (the fallback is correct).
+ *
+ * When the EnableExtensions feature flag is off, ExtensionsStartup never
+ * calls initializeExtensions() at all, so there's nothing to wait for β€”
+ * this returns true immediately in that case rather than reporting an
+ * indefinite pending state.
+ */
+export function useExtensionsReady(): boolean {

Review Comment:
   Nothing tests the readiness path. Every TabbedSqlEditors test runs with `EnableExtensions` off, so this hook is always true there, and the loader tests never touch `isReady`/`onReady`.
   
   A loader test that `markReady` fires on both resolve and reject, plus one NewTabButton test with the flag on and a pending init (click does nothing, then the dropdown opens once it resolves), would cover it.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5865626362

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5818774947

   Still intending to follow up on this, just not a burning priority right now. May wait for @justinpark 's left pane SIP to land first, as this can capitalize on that.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4141902603


##########
superset/translations/en/LC_MESSAGES/messages.po:
##########
@@ -14254,6 +14284,12 @@ msgid ""
 "exporting them:"
 msgstr ""
 
+msgid ""
+"The following charts were omitted because their size cannot be determined"
+" before they run. Ask an administrator to enable background exports to "
+"include them."
+msgstr ""
+

Review Comment:
   That msgid isn't orphaned, it's the concatenated string in `superset/dashboards/excel_export/email.py` (unrelated file, already on `master`). Bito's own grep for the full sentence misses it because the source splits it across two adjacent string literals.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "EnxDev (via GitHub)" <gi...@apache.org>.
EnxDev commented on PR #41285:
URL: https://github.com/apache/superset/pull/41285#issuecomment-5339741076

   ## EnxDev's Review Agent β€” apache/superset#41285 Β· HEAD fee0981
   **comment** β€” one real UX bug in the new `+` dropdown; everything else is clean and CI is green apart from the `hold!` gate.
   
   Supersedes my [earlier review at 5c38df7](https://github.com/apache/superset/pull/41285#pullrequestreview-4572665212). Re-verified against this HEAD: `lint-frontend` is green now, `NewTabButton` has four tests, the command-not-registered filter and the `isActive` gate are in, and the a11y concern about the nested interactive `<span>` is gone with the capture-listener rewrite. `check-hold-label` is the only red check β€” that's the `hold!` label, not the code.
   
   ### πŸ”΄ Functional
   - **`SqlLab/components/TabbedSqlEditors/index.tsx:206`** Β· _High_ β€” `trigger={[]}` opts the Dropdown out of rc-trigger's own dismissal. antd passes `trigger` straight through as `action` (`antd/lib/dropdown/dropdown.js:135,228`), rc-dropdown forwards it (`@rc-component/dropdown/lib/Dropdown.js:122-124`), and rc-trigger derives `clickToHide` from it β€” with an empty array `clickToHide` is `false`, so `useWinClick` never registers the outside `mousedown` listener. Once an extension contributes a `newTab` item and the user opens the dropdown, it stays open until they re-click `+` or pick an item: clicking into the editor, switching tabs, or clicking anywhere else leaves it floating over the UI. Keeping `trigger={[]}`, add an explicit window `mousedown` + `Escape` dismiss while `open` (what `useWinClick` would have done). `trigger={['click']}` restores outside-click for free but makes a second `+` click reopen rather than close, since rc-trigger's mousedown closes it just before y
 our capture handler toggles it back. **regression test:** open the dropdown with a contributed item, `fireEvent.mouseDown(document.body)`, assert the menu is gone.
   
   ### 🟑 Should-fix
   - **`SqlLab/components/SqlEditor/index.tsx:325-337`** β€” the `isActive` gate (the fix for Copilot's stale-pending-key finding) has no test; both new SqlEditor tests mount the active tab. Add one that mounts a non-active editor with `PENDING_NORTH_PANE_VIEW_KEY` set and asserts it neither consumes the key nor swaps to the view β€” otherwise the regression it guards against comes back silently.
   - **`SqlLab/components/TabbedSqlEditors/index.tsx:176-198`** β€” the listener moved to capture-phase click specifically so Enter/Space reach the dropdown, but all four new tests use `fireEvent.click`, so the keyboard path is unguarded. `userEvent.keyboard('{Enter}')` on the focused add button would cover it.
   - **`SqlLab/components/TabbedSqlEditors/index.tsx:101`** β€” `newTabTooltip` moved from render-time to module scope, so `t()` now runs at module load. That's the pattern `TranslatorSingleton.warnPreConfigure` calls out ("called before configure() β€” the result is the fallback language"); it only resolves today because the HTML template pre-stashes `__SUPERSET_LANGUAGE_PACK__` on `window`. Anywhere that pack isn't there first the tooltip silently falls back to English. Move it back into the component or make it a function.
   
   ### πŸ”΅ Nits
   - `SqlLab/components/TabbedSqlEditors/index.tsx:304` β€” `onTabClicked` still calls `Logger.markTimeOrigin()` immediately before `newQueryEditor()`, which now marks again at `:263`. Drop the one at `:304` to match the "centralized here" comment.
   - `extensions/ExtensionsLoader.ts:117` + `extensions/ExtensionsStartup.tsx:85` β€” both log `'Error setting up extensions:'`. Now that the loader rethrows, a failed load is always logged twice.
   - `SqlLab/components/SqlEditor/index.tsx:341-345` β€” when `tabViewId` arrives after backend sync, `northPaneStorageId` flips from `id` and the old `id`-keyed entry is left orphaned in `localStorage`. Harmless (I confirmed reload still restores, since hydrated editors carry the backend id as `queryEditor.id`), just untidy.
   
   ### πŸ™Œ Praise
   - `SqlLab/components/SqlEditor/index.tsx:311-355` β€” driving northPane off the reactive `useViews()` hook, guarding the raw `localStorage` access, and syncing via the `storage` event is a tidy design; async-registered extension views appear without blocking mount.
   - Good turnaround on the last round β€” the `isActive` gate, the unregistered-command filter, and the `markTimeOrigin` centralization all landed as real fixes rather than assertions.
   
   <!-- enxdev-review-agent:fee0981 -->
   _Reviewed by EnxDev's Review Agent β€” @EnxDev Β· HEAD fee0981._
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4081161972


##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -397,6 +400,93 @@ describe('SqlEditor', () => {
     ).toBeInTheDocument();
   });
 
+  test('renders a registered northPane view in place of the editor', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id;
+    // mirror that here to derive the same persistence key.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    localStorage.setItem(storageKey, 'test.northPane');
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      const { findByTestId, queryByTestId } = setup(mockedProps, store);
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      // The default SQL editor pane is replaced, not rendered alongside.
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('opens the northPane view carried on the query editor and persists the per-tab key', async () => {
+    const { queryEditor } = mockedProps;
+    // The fixture has no tabViewId, so the component falls back to the id.
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+
+    try {
+      // createTab({ northPaneViewId }) stamps the view onto the tab's own
+      // state, so nothing shared between tabs is involved.
+      const { findByTestId, queryByTestId } = setup(
+        {
+          ...mockedProps,
+          queryEditor: { ...queryEditor, northPaneViewId: 'test.northPane' },
+        },
+        store,
+      );
+      expect(await findByTestId('np-view')).toBeInTheDocument();
+      expect(queryByTestId('react-ace')).not.toBeInTheDocument();
+      // The chosen view is persisted under the per-tab key so it survives a
+      // reload that rehydrates the editor without the field.
+      expect(localStorage.getItem(storageKey)).toEqual('test.northPane');
+    } finally {
+      disposable.dispose();
+      localStorage.removeItem(storageKey);
+    }
+  });
+
+  test('does not open a northPane view requested for a different tab', () => {
+    const { queryEditor } = mockedProps;
+    const storageKey = `sqllab.northPaneView.${queryEditor.id}`;
+    const disposable = views.registerView(
+      { id: 'test.northPane', name: 'Test North Pane' },
+      ViewLocations.sqllab.northPane,
+      () => <div data-test="np-view">NorthPane content</div>,
+    );
+    // Another tab was created with the view; this one mounts as a plain tab
+    // (as happens when a reload restores several tabs at once).
+    const otherTabStore = createStore({
+      ...mockInitialState,
+      sqlLab: {
+        ...mockInitialState.sqlLab,
+        queryEditors: [
+          ...mockInitialState.sqlLab.queryEditors,
+          { ...extraQueryEditor1, northPaneViewId: 'test.northPane' },
+        ],

Review Comment:
   Good catch, fixed the fixture to update the existing `extraQueryEditor1` entry instead of duplicating the id.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -1048,6 +1127,29 @@ const SqlEditor: FC<Props> = ({
         >
           <Skeleton active />
         </div>
+      ) : northPaneViewId &&
+        northPaneViews.some(v => v.id === northPaneViewId) ? (

Review Comment:
   Good catch, falls back to `queryPane()` now while the view is still registering instead of the empty state.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(sqllab,extensions): contribution surfaces for tab/pane extensions [superset]

Posted by "rusackas (via GitHub) via notifications" <no...@superset.apache.org>.
rusackas commented on code in PR #41285:
URL: https://github.com/apache/superset/pull/41285#discussion_r4640319727


##########
superset-frontend/src/extensions/ExtensionsStartup.tsx:
##########
@@ -67,9 +74,41 @@ const ExtensionsStartup: React.FC<{ children?: React.ReactNode }> = ({
       views,
     };
 
+    // Load extensions without blocking the initial render (see #40915);
+    // surface any load failure as a warning toast instead of failing silently.
+    // ExtensionsLoader already logs the details of each failure, so only the
+    // user-facing toast is raised here.
     if (isFeatureEnabled(FeatureFlag.EnableExtensions)) {
-      ExtensionsLoader.getInstance().initializeExtensions();
+      ExtensionsLoader.getInstance()
+        .initializeExtensions()
+        .then(failed => {
+          if (failed.length > 0) {
+            dispatch(
+              addWarningToast(
+                t('Some extensions failed to load: %s', failed.join(', ')),

Review Comment:
   Verified that all three strings are back in messages.pot, including β€œSQL Editor” and both load warnings.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org