codeant-ai-for-open-source[bot] commented on code in PR #43261:
URL: https://github.com/apache/superset/pull/43261#discussion_r3797345561
##########
superset/commands/importers/v1/utils.py:
##########
@@ -247,6 +247,20 @@ def load_configs(
)
exc.messages = {file_name: exc.messages}
exceptions.append(exc)
+ except json.JSONDecodeError as exc:
Review Comment:
**Suggestion:** The new handler still allows a malformed non-string YAML
value, such as a mapping or list assigned to `masked_encrypted_extra`, to
escape as `TypeError` from `json.loads()`. Since this field is user-controlled
and the stated goal is to aggregate malformed values as validation failures,
catch `TypeError` alongside `json.JSONDecodeError` and convert it to the same
structured `ValidationError`. [type error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Database or asset import returns an uncaught server error.
- ⚠️ Malformed YAML receives no structured field validation response.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b6b335f2f26f44c586afc9be18027e11&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=b6b335f2f26f44c586afc9be18027e11&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/commands/importers/v1/utils.py
**Line:** 250:250
**Comment:**
*Type Error: The new handler still allows a malformed non-string YAML
value, such as a mapping or list assigned to `masked_encrypted_extra`, to
escape as `TypeError` from `json.loads()`. Since this field is user-controlled
and the stated goal is to aggregate malformed values as validation failures,
catch `TypeError` alongside `json.JSONDecodeError` and convert it to the same
structured `ValidationError`.
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%2F43261&comment_hash=79766e7482337cbbacea31428f6415a3a821e5ddfdc2c2a0d662586352baa3c2&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43261&comment_hash=79766e7482337cbbacea31428f6415a3a821e5ddfdc2c2a0d662586352baa3c2&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]