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


##########
superset-frontend/packages/superset-ui-core/src/query/getClientErrorObject.ts:
##########
@@ -88,7 +88,14 @@ const ERROR_CODE_LOOKUP = {
 };
 
 export function checkForHtml(str: string): boolean {
-  return !isJsonString(str) && isProbablyHTML(str);
+  // An HTML error page served by a proxy or gateway begins with markup, and
+  // has no message worth showing. A server-authored error that merely quotes
+  // a tag — a database syntax error echoing back the offending `<a>`, say —
+  // begins with prose, and is the whole point of the response. Only the
+  // former may be collapsed into a generic status message.
+  return (
+    !isJsonString(str) && str.trimStart().startsWith('<') && 
isProbablyHTML(str)
+  );

Review Comment:
   **Suggestion:** The new prefix check still collapses any message beginning 
with a recognized HTML tag, even when that tag is a quoted database fragment 
rather than an error page. For example, a response such as `<a> is not valid 
syntax` is parsed by `isProbablyHTML` as HTML, so `parseErrorJson` replaces the 
diagnostic with the HTTP status text. Restrict the page detection to stronger 
indicators such as a doctype or document-like markup, or otherwise preserve 
short/prose messages beginning with tags. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Chart query diagnostics can become generic status messages.
   - ❌ Database syntax details are hidden from users.
   - ⚠️ String and JSON error branches share this behavior.
   ```
   </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=88808fbf9762435b8b846f1e6dd979bd&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=88808fbf9762435b8b846f1e6dd979bd&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/packages/superset-ui-core/src/query/getClientErrorObject.ts
   **Line:** 96:98
   **Comment:**
        *Logic Error: The new prefix check still collapses any message 
beginning with a recognized HTML tag, even when that tag is a quoted database 
fragment rather than an error page. For example, a response such as `<a> is not 
valid syntax` is parsed by `isProbablyHTML` as HTML, so `parseErrorJson` 
replaces the diagnostic with the HTTP status text. Restrict the page detection 
to stronger indicators such as a doctype or document-like markup, or otherwise 
preserve short/prose messages beginning with tags.
   
   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%2F42489&comment_hash=dd16ada4b97a87a3a80e16cc210c35f514855c9d0b2e6b2a660bff2a3d936dac&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42489&comment_hash=dd16ada4b97a87a3a80e16cc210c35f514855c9d0b2e6b2a660bff2a3d936dac&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