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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to