codeant-ai-for-open-source[bot] commented on code in PR #43772:
URL: https://github.com/apache/superset/pull/43772#discussion_r3906385246
##########
superset/db_engine_specs/gsheets.py:
##########
@@ -393,7 +393,22 @@ def validate_parameters(
# On create the encrypted credentials are a string,
# at all other times they are a dict
if isinstance(encrypted_credentials, str):
- encrypted_credentials = json.loads(encrypted_credentials)
+ try:
+ encrypted_credentials = json.loads(encrypted_credentials)
+ except json.JSONDecodeError:
+ errors.append(
Review Comment:
**Suggestion:** Valid JSON scalars and arrays pass this check, then reach
the credentials adapter as `None`, a list, or a scalar and can raise an
unhandled connection error instead of returning a validation error. [type error]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ab0d2c40c211440e81a073feef147404&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=ab0d2c40c211440e81a073feef147404&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/db_engine_specs/gsheets.py
**Line:** 397:399
**Comment:**
*Type Error: Valid JSON scalars and arrays pass this check, then reach
the credentials adapter as `None`, a list, or a scalar and can raise an
unhandled connection error instead of returning a validation 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%2F43772&comment_hash=09340339984b29b9d94f0924b39c5377c302b1ef6c60682c1166fa789896b6a8&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43772&comment_hash=09340339984b29b9d94f0924b39c5377c302b1ef6c60682c1166fa789896b6a8&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]