Repository navigation
Conversation
…e routes Catch domain-level ValueErrors in asset_state_store route handlers and translate them to HTTP 400 errors rather than allowing unhandled 500 Internal Server Errors.
|
Hi Team, The single failure in the Thanks! |
There was a problem hiding this comment.
Thanks for looking into this! Unless I'm missing something, I don't think these three calls can raise a ValueError today. The API route always writes with kind=API and no task fields, so validate_writer_fields and _build_asset_writer_fields never raise, and delete/clear on an AssetScope are plain DELETE statements. The new tests pass because the backend is mocked to raise errors that don't exist on these paths.
If you hit a 500 on one of these endpoints, could you share the request? That would tell us what actually needs handling. Otherwise I think this would mostly add a 400 to the public spec that clients can never get.
Closing until you can provide a way to reproduce.
| kind=AssetStateStoreWriterKind.API, | ||
| session=session, | ||
| ) | ||
| except ValueError as e: |
There was a problem hiding this comment.
With kind=API and no task or identity fields, I don't think set_asset_state_store can raise here. Also, task_state_store.py maps its ValueError (the missing DagRun) to a 404, not a 400, so the two wouldn't quite match anyway.
Catch domain-level
ValueErrors inasset_state_storeroute handlers and translate them to HTTP 400 Bad Request errors. Previously, these were unhandled and surfaced as HTTP 500 Internal Server Errors, leaking internal traces.This implements the same exception translation pattern already established in
task_state_store.py.Was generative AI tooling used to co-author this PR?
Generated-by: Antigravity following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.