codeant-ai-for-open-source[bot] commented on code in PR #41303:
URL: https://github.com/apache/superset/pull/41303#discussion_r3456324369
##########
superset-frontend/src/features/home/RightMenu.test.tsx:
##########
@@ -412,6 +416,10 @@ test('Logs out and clears local storage item redux', async
() => {
expect(localStorage.getItem('redux')).toBeNull();
expect(sessionStorage.getItem('login_attempted')).toBeNull();
});
+ // The namespaced Cache API store is purged on logout.
+ expect(deleteMock).toHaveBeenCalledWith('@SUPERSET-UI/CONNECTION');
+
+ delete (global as any).caches;
Review Comment:
**Suggestion:** Remove the `any` cast in the cleanup step and use the same
narrowed typed global reference used for the cache mock setup. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is also modified TypeScript test code and it uses `any` in the cleanup
step.
That directly violates the custom rule against introducing `any` in new or
modified TS/TSX code.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7d92fe23c5b94a58ad297f43167ab187&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7d92fe23c5b94a58ad297f43167ab187&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/features/home/RightMenu.test.tsx
**Line:** 422:422
**Comment:**
*Custom Rule: Remove the `any` cast in the cleanup step and use the
same narrowed typed global reference used for the cache mock setup.
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%2F41303&comment_hash=7affc875554c7d8b2a213cb498a00dc575739db2d3acad9dd2e3081b22a9f75a&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41303&comment_hash=7affc875554c7d8b2a213cb498a00dc575739db2d3acad9dd2e3081b22a9f75a&reaction=dislike'>👎</a>
##########
superset-frontend/src/features/home/RightMenu.test.tsx:
##########
@@ -401,6 +401,10 @@ test('Logs out and clears local storage item redux', async
() => {
expect(localStorage.getItem('redux')).not.toBeNull();
expect(sessionStorage.getItem('login_attempted')).not.toBeNull();
+ // Mock the Cache API so we can assert the namespaced store is purged.
+ const deleteMock = jest.fn().mockResolvedValue(true);
+ (global as any).caches = { delete: deleteMock };
Review Comment:
**Suggestion:** Replace the `any` cast on `global` with a specific
cache-aware type (for example a narrowed global interface) before assigning
`caches`. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a modified TypeScript test file and it directly uses `any` in a cast.
The custom rule explicitly flags new or modified TypeScript/TSX code that
uses `any`, so this is a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f77b9b2812414a8ab83cf55f74fbd601&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f77b9b2812414a8ab83cf55f74fbd601&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/features/home/RightMenu.test.tsx
**Line:** 406:406
**Comment:**
*Custom Rule: Replace the `any` cast on `global` with a specific
cache-aware type (for example a narrowed global interface) before assigning
`caches`.
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%2F41303&comment_hash=2135e4941d7e4a9747aa75774a1055557a8d82a9b4c834f50253c565f2fb8dc4&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41303&comment_hash=2135e4941d7e4a9747aa75774a1055557a8d82a9b4c834f50253c565f2fb8dc4&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]