codeant-ai-for-open-source[bot] commented on code in PR #42491:
URL: https://github.com/apache/superset/pull/42491#discussion_r3661809951


##########
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx:
##########
@@ -92,13 +92,22 @@ export function ErrorMessageWithStackTrace({
         <br />
         {stackTrace && <pre>{stackTrace}</pre>}
       </>
-    ) : undefined);
+    ) : (
+      subtitle
+    ));
+
+  // When the subtitle is the only detail available (no stack trace, link, or
+  // explicit details), surface it exclusively in the collapsible "See more"
+  // section rather than inline. This guarantees an expand affordance instead
+  // of a flat, unexpandable error card.
+  const message =
+    computedDescriptionDetails === subtitle ? undefined : subtitle;

Review Comment:
   **Suggestion:** The identity check cannot distinguish the subtitle fallback 
from an explicitly supplied `descriptionDetails`. When a caller intentionally 
passes the same React node or string as both `subtitle` and 
`descriptionDetails`, `message` is incorrectly set to `undefined`, so the 
primary subtitle disappears from the alert until the collapsed details are 
expanded. Track whether the fallback branch was selected rather than comparing 
the resulting values. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Repeated subtitle content disappears from the alert summary.
   - ⚠️ Users must expand “See more” to view the subtitle.
   - ⚠️ Affects all `ErrorMessageWithStackTrace` consumers.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Render `ErrorMessageWithStackTrace` through the shared component path 
exercised by
   
`superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx:40-58`,
   supplying a subtitle string and the same string as `descriptionDetails`.
   
   2. In `ErrorMessageWithStackTrace` at
   
`superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx:79-97`,
 the
   truthy explicit `descriptionDetails` is selected as 
`computedDescriptionDetails`; because
   it is the same string as `subtitle`, the values compare equal.
   
   3. At
   
`superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx:103-104`,
   the identity/value comparison sets `message` to `undefined` instead of the 
supplied
   subtitle.
   
   4. `ErrorAlert` receives that value at
   
`superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx:107-113`;
   its renderer at 
`superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx:79-86`
   therefore omits the primary message, while the duplicated content remains 
only in the
   collapsible details rendered at `ErrorAlert.tsx:95-109`. The same behavior 
applies when
   the same React element instance is passed through both props; existing 
shared consumers
   include `ChartErrorMessage` at
   `superset-frontend/src/components/Chart/ChartErrorMessage.tsx:48-55` and SQL 
Lab errors at
   `superset-frontend/src/SqlLab/components/ResultSet/index.tsx:617-626`.
   ```
   </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=863e6a77830c4b929c0db17d969ba812&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=863e6a77830c4b929c0db17d969ba812&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/ErrorMessageWithStackTrace.tsx
   **Line:** 103:104
   **Comment:**
        *Api Mismatch: The identity check cannot distinguish the subtitle 
fallback from an explicitly supplied `descriptionDetails`. When a caller 
intentionally passes the same React node or string as both `subtitle` and 
`descriptionDetails`, `message` is incorrectly set to `undefined`, so the 
primary subtitle disappears from the alert until the collapsed details are 
expanded. Track whether the fallback branch was selected rather than comparing 
the resulting values.
   
   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%2F42491&comment_hash=5092807e0973febebfa1dda4d38380d99e8e20b9dc6641e0f30bc339703ba2f5&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42491&comment_hash=5092807e0973febebfa1dda4d38380d99e8e20b9dc6641e0f30bc339703ba2f5&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