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: [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