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`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](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)
[](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`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](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)
[](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]