Under which category would you file this issue?
Airflow Core
Apache Airflow version
main
What happened and how to reproduce it?
Issue Description:
According to Airflow's coding standards, functions receiving a session parameter should not manually call session.commit(). In the new FastAPI implementation, the database session is injected via the SessionDep dependency. This dependency leverages the create_session context manager, which automatically commits the transaction when the request completes successfully.
Despite this, several route handlers manually call session.commit(), which is redundant and breaks composability.
Steps to reproduce:
Observe explicit session.commit() calls in the following endpoints:
airflow/api_fastapi/execution_api/routes/xcoms.py (in delete_xcom)
airflow/api_fastapi/execution_api/routes/hitl.py
airflow/api_fastapi/core_api/routes/public/hitl.py
airflow/api_fastapi/core_api/routes/public/backfills.py
What you think should happen instead?
The explicit session.commit() calls at the end of these route handlers should be removed, allowing the SessionDep dependency to handle the transaction lifecycle as designed.
Operating System
Not Applicable
Deployment
None
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
Not Applicable
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable
Helm Chart configuration
Not Applicable
Docker Image customizations
Not Applicable
Anything else?
Not Applicable
Are you willing to submit PR?
Code of Conduct
Under which category would you file this issue?
Airflow Core
Apache Airflow version
main
What happened and how to reproduce it?
Issue Description:
According to Airflow's coding standards, functions receiving a
sessionparameter should not manually callsession.commit(). In the new FastAPI implementation, the database session is injected via theSessionDepdependency. This dependency leverages thecreate_sessioncontext manager, which automatically commits the transaction when the request completes successfully.Despite this, several route handlers manually call
session.commit(), which is redundant and breaks composability.Steps to reproduce:
Observe explicit
session.commit()calls in the following endpoints:airflow/api_fastapi/execution_api/routes/xcoms.py(indelete_xcom)airflow/api_fastapi/execution_api/routes/hitl.pyairflow/api_fastapi/core_api/routes/public/hitl.pyairflow/api_fastapi/core_api/routes/public/backfills.pyWhat you think should happen instead?
The explicit
session.commit()calls at the end of these route handlers should be removed, allowing theSessionDepdependency to handle the transaction lifecycle as designed.Operating System
Not Applicable
Deployment
None
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
Not Applicable
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable
Helm Chart configuration
Not Applicable
Docker Image customizations
Not Applicable
Anything else?
Not Applicable
Are you willing to submit PR?
Code of Conduct