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


##########
superset/utils/core.py:
##########
@@ -2245,6 +2245,41 @@ def parse_boolean_string(bool_str: str | None) -> bool:
     return bool_str.lower() in ("y", "Y", "yes", "True", "t", "true", "On", 
"on", "1")
 
 
+def is_truthy_str(value: str | None, default: bool = False) -> bool:
+    """
+    Case-insensitive match against the literal string "true", nothing else.
+
+    Unlike `parse_boolean_string`, this does not treat "yes"/"y"/"t"/"on"/"1"
+    as true -- it exists to de-duplicate several call sites that already had
+    this exact narrow semantics (e.g. `value.lower() == "true"`), without
+    silently widening what they accept.
+
+    >>> is_truthy_str(None)
+    False
+    >>> is_truthy_str(None, default=True)
+    True
+    >>> is_truthy_str('true')
+    True
+    >>> is_truthy_str('True')
+    True
+    >>> is_truthy_str('TRUE')
+    True
+    >>> is_truthy_str('false')
+    False
+    >>> is_truthy_str('1')
+    False
+    >>> is_truthy_str('yes')
+    False
+
+    :param value: string representation of a value assumed to be boolean
+    :param default: value to return when `value` is `None`
+    :return: strictly parsed boolean value
+    """
+    if value is None:
+        return default
+    return value.strip().lower() == "true"

Review Comment:
   **Suggestion:** Stripping whitespace changes the old exact-match behavior: 
values like `" true "` now enable shared storage or data export when they 
previously remained false.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Api mismatch`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=f97caca6406f42fcbbb194f6ef671409&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=f97caca6406f42fcbbb194f6ef671409&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/utils/core.py
   **Line:** 2280:2280
   **Comment:**
        *Api Mismatch: Stripping whitespace changes the old exact-match 
behavior: values like `" true "` now enable shared storage or data export when 
they previously remained false.
   
   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%2F45768&comment_hash=b98c47b7eaaf71a4ac989cc3f9186c84058fdab9940db68b2956ad553e604375&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45768&comment_hash=b98c47b7eaaf71a4ac989cc3f9186c84058fdab9940db68b2956ad553e604375&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/extensions/storage/api.py:
##########
@@ -187,7 +188,7 @@ def get_ephemeral(
         if not extension:
             return self.response_404("Extension not found")
 
-        shared = request.args.get("shared", "false").lower() == "true"
+        shared = is_truthy_str(request.args.get("shared", "false"))

Review Comment:
   **Suggestion:** Because `is_truthy_str` strips whitespace, 
`?shared=%20true%20` now selects global storage instead of remaining 
user-scoped under the prior strict comparison.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Incorrect condition 
logic`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=8e65004a453047b99a5169a466562704&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=8e65004a453047b99a5169a466562704&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/extensions/storage/api.py
   **Line:** 191:191
   **Comment:**
        *Incorrect Condition Logic: Because `is_truthy_str` strips whitespace, 
`?shared=%20true%20` now selects global storage instead of remaining 
user-scoped under the prior strict comparison.
   
   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%2F45768&comment_hash=e20674be10f69f3f3cb990ee74e1f87bbb0d1ed0adbe3da6f05e82a5a87dfbac&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45768&comment_hash=e20674be10f69f3f3cb990ee74e1f87bbb0d1ed0adbe3da6f05e82a5a87dfbac&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