codeant-ai-for-open-source[bot] commented on code in PR #43479:
URL: https://github.com/apache/superset/pull/43479#discussion_r3846269591
##########
superset/daos/base.py:
##########
@@ -433,6 +443,11 @@ def find_by_ids(
try:
results = query.all()
+ except OperationalError:
+ # A transient connection-level failure (e.g. the server dropping
the
+ # connection mid-query) surfaces as OperationalError. Let it
propagate
+ # as a 5xx instead of masking it as a 400 "record doesn't exist".
+ raise
Review Comment:
**Suggestion:** The re-raised `OperationalError` is still caught by
Superset's API exception handler as a SQLAlchemy `DatabaseError`, which returns
HTTP 422 rather than the intended 5xx response for a database outage. Add an
explicit `OperationalError` mapping before the broader `DatabaseError` handler,
or translate it to an exception that produces a 5xx response. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Dataset API outages return misleading HTTP 422 responses.
- ⚠️ Clients may avoid retrying transient database failures.
- ⚠️ Monitoring may classify infrastructure faults as client errors.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9d3fe4097f4f4425a58352f0abdec761&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=9d3fe4097f4f4425a58352f0abdec761&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/daos/base.py
**Line:** 446:450
**Comment:**
*Api Mismatch: The re-raised `OperationalError` is still caught by
Superset's API exception handler as a SQLAlchemy `DatabaseError`, which returns
HTTP 422 rather than the intended 5xx response for a database outage. Add an
explicit `OperationalError` mapping before the broader `DatabaseError` handler,
or translate it to an exception that produces a 5xx response.
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%2F43479&comment_hash=5557bc35eee6688916533eb9d6200952e7cdc9b5641aa446431eabae8d9724fd&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43479&comment_hash=5557bc35eee6688916533eb9d6200952e7cdc9b5641aa446431eabae8d9724fd&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]