codeant-ai-for-open-source[bot] commented on code in PR #42390:
URL: https://github.com/apache/superset/pull/42390#discussion_r3676675358
##########
superset-frontend/src/SqlLab/components/TablePreview/index.tsx:
##########
@@ -257,14 +261,15 @@ const TablePreview: FC<Props> = ({ dbId, catalog, schema,
tableName }) => {
}
if (hasMetadataError || metadataExtrError) {
- return (
- <Alert
- type="warning"
- message={
- ((metadataError || metadataExtrError) as ClientErrorObject)?.error
- }
- />
- );
+ // Pass the structured SupersetError through to ErrorMessageWithStackTrace
so
+ // that OAuth2 redirect errors (error_type=OAUTH2_REDIRECT) render the
+ // "Authorization needed" link and auto-retry once the OAuth2 dance
completes.
+ // The source="crud" value drives the tag-invalidation retry in
+ // OAuth2RedirectMessage.tsx (which invalidates the TableMetadatas tag).
+ const errorPayload = (
+ (metadataError || metadataExtrError) as ClientErrorObject
+ )?.errors?.[0];
+ return <ErrorMessageWithStackTrace error={errorPayload} source="crud" />;
Review Comment:
**Suggestion:** When both metadata requests fail, this always selects
`metadataError` first. If the main metadata request has a generic error while
the extended metadata request contains the actionable `OAUTH2_REDIRECT`
payload, the OAuth-specific component and authorization link are suppressed.
Select the structured OAuth error when either request provides one, or
otherwise preserve the most useful error. [incorrect condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ OAuth authorization link can be suppressed.
- ❌ Table preview does not retry after reauthentication.
- ⚠️ Metadata requests can fail with inconsistent error types.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8bd29901218b44c5b072635144aac077&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=8bd29901218b44c5b072635144aac077&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/TablePreview/index.tsx
**Line:** 269:272
**Comment:**
*Incorrect Condition Logic: When both metadata requests fail, this
always selects `metadataError` first. If the main metadata request has a
generic error while the extended metadata request contains the actionable
`OAUTH2_REDIRECT` payload, the OAuth-specific component and authorization link
are suppressed. Select the structured OAuth error when either request provides
one, or otherwise preserve the most useful error.
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%2F42390&comment_hash=25a9c6214fc2187e28dd432175e6728d8680e59db0b95fbbbc02a20af0e37eb4&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42390&comment_hash=25a9c6214fc2187e28dd432175e6728d8680e59db0b95fbbbc02a20af0e37eb4&reaction=dislike'>👎</a>
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -121,6 +121,7 @@ export function OAuth2RedirectMessage({
{ type: 'Schemas', id: 'LIST' },
{ type: 'Catalogs', id: 'LIST' },
'Tables',
+ 'TableMetadatas',
Review Comment:
**Suggestion:** Invalidating the unscoped string tag refetches every active
table-metadata query in the application, including previews for unrelated
databases and tables. A single OAuth completion can therefore trigger a
potentially large burst of metadata requests and UI updates. Use a
table/database-scoped tag or pass the initiating resource identity through the
CRUD error flow so only the failed preview is retried. [performance]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Unrelated SQL Lab metadata queries refetch.
- ⚠️ Multiple database connections may receive unnecessary requests.
- ⚠️ OAuth completion can cause avoidable UI updates.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ac5f00c3450549dfa43f2d564c0d3a2e&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=ac5f00c3450549dfa43f2d564c0d3a2e&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/components/ErrorMessage/OAuth2RedirectMessage.tsx
**Line:** 124:124
**Comment:**
*Performance: Invalidating the unscoped string tag refetches every
active table-metadata query in the application, including previews for
unrelated databases and tables. A single OAuth completion can therefore trigger
a potentially large burst of metadata requests and UI updates. Use a
table/database-scoped tag or pass the initiating resource identity through the
CRUD error flow so only the failed preview is retried.
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%2F42390&comment_hash=b48b1799cd63621a34f842c99f4e244a57f0879c22b1124ad23a1e2e8177633c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42390&comment_hash=b48b1799cd63621a34f842c99f4e244a57f0879c22b1124ad23a1e2e8177633c&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]