You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Kaap10 (via GitHub)" <gi...@apache.org> on 2026/10/04 07:44:07 UTC
[PR] API: Translate domain ValueError to HTTPException in Asset State Store routes [airflow]
Kaap10 opened a new pull request, #74179:
URL: https://github.com/apache/airflow/pull/74179
Catch domain-level `ValueError`s in `asset_state_store` route 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`.
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
For user-facing UI changes, please attach before/after screenshots (or a short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [x] Yes (Antigravity AI Assistant)
Generated-by: Antigravity following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] API: Translate domain ValueError to HTTPException in Asset State Store routes [airflow]
Posted by "Kaap10 (via GitHub)" <gi...@apache.org>.
Kaap10 commented on PR #74179:
URL: https://github.com/apache/airflow/pull/74179#issuecomment-5980396564
Hi Team,
This PR is ready for review. All core, DB (Postgres/MySQL/SQLite), and integration tests are passing cleanly.
The single failure in the `Static checks` job appears to be caused by a transient `prek` hook cache issue on the runner (`insert_license: No such file or directory`). Could a maintainer please trigger a quick re-run for that job when taking a look?
Thanks!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] API: Translate domain ValueError to HTTPException in Asset State Store routes [airflow]
Posted by "pierrejeambrun (via GitHub) via commits" <co...@airflow.apache.org>.
pierrejeambrun closed pull request #74179: API: Translate domain ValueError to HTTPException in Asset State Store routes
URL: https://github.com/apache/airflow/pull/74179
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] API: Translate domain ValueError to HTTPException in Asset State Store routes [airflow]
Posted by "pierrejeambrun (via GitHub) via commits" <co...@airflow.apache.org>.
pierrejeambrun commented on code in PR #74179:
URL: https://github.com/apache/airflow/pull/74179#discussion_r4457256620
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py:
##########
@@ -172,19 +172,22 @@ def set_asset_state_store(
session: SessionDep,
) -> None:
"""Set an asset state store value. Creates or overwrites the key."""
- _get_db_backend().set_asset_state_store(
- AssetScope(asset_id=asset_id),
- key,
- json.dumps(body.value),
- kind=AssetStateStoreWriterKind.API,
- session=session,
- )
+ try:
+ _get_db_backend().set_asset_state_store(
+ AssetScope(asset_id=asset_id),
+ key,
+ json.dumps(body.value),
+ kind=AssetStateStoreWriterKind.API,
+ session=session,
+ )
+ except ValueError as e:
Review 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.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org