Skip to content

Fix broken CI due to fastapi incompatibility with cadwyn for Airflow 3#2076

Merged
pankajkoti merged 6 commits into
mainfrom
test-ci
Nov 4, 2025
Merged

Fix broken CI due to fastapi incompatibility with cadwyn for Airflow 3#2076
pankajkoti merged 6 commits into
mainfrom
test-ci

Conversation

@pankajkoti
Copy link
Copy Markdown
Contributor

@pankajkoti pankajkoti commented Nov 3, 2025

Our CI started failing after fastapi 0.121.0 was released yesterday. It's observed that cadwyn(that airflow uses for its migrations) is incompatible with the latest the release of fastapi. Hence, putting an upper bound for fastapi version which can be removed once cadwyn becomes compatible.

Succesful run: https://github.com/astronomer/astronomer-cosmos/actions/runs/19061976838

closes: #2079

@pankajkoti pankajkoti changed the title Commit dummy change to test CI run Fix broken CI due to fastapi incompatibility with cadwyn for Airflow 3 Nov 4, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.77%. Comparing base (205f912) to head (736abb0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2076   +/-   ##
=======================================
  Coverage   97.77%   97.77%           
=======================================
  Files          91       91           
  Lines        5848     5848           
=======================================
  Hits         5718     5718           
  Misses        130      130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .github/workflows/test.yml Outdated
@pankajkoti pankajkoti marked this pull request as ready for review November 4, 2025 09:00
Copilot AI review requested due to automatic review settings November 4, 2025 09:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a CI failure caused by an incompatibility between cadwyn (used by Airflow for migrations) and fastapi version 0.121.0 released recently. The fix adds an upper bound constraint on the fastapi version to prevent the incompatible version from being installed.

Key changes:

  • Added fastapi version constraint to prevent installation of incompatible version 0.121.0
  • Updated comment to reference the specific GitHub issue documenting the incompatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/test/integration-setup.sh
Comment thread scripts/test/integration-setup.sh Outdated
Comment thread scripts/test/integration-setup.sh Outdated
Copy link
Copy Markdown
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, @pankajkoti , happy for us to merge this once the checks pass 🎉

@pankajkoti pankajkoti merged commit 67a53af into main Nov 4, 2025
81 checks passed
@pankajkoti pankajkoti deleted the test-ci branch November 4, 2025 09:33
tatiana pushed a commit that referenced this pull request Nov 7, 2025
#2076)

Our CI started failing after fastapi [0.121.0
](https://pypi.org/project/fastapi/0.121.0/) was released yesterday.
It's observed that cadwyn(that airflow uses for its migrations) is
[incompatible](zmievsa/cadwyn#305) with the
latest the release of fastapi. Hence, putting an upper bound for fastapi
version which can be removed once cadwyn becomes compatible.

Succesful run:
https://github.com/astronomer/astronomer-cosmos/actions/runs/19061976838

closes: #2079

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@tatiana tatiana mentioned this pull request Nov 7, 2025
@tatiana tatiana added this to the Cosmos 1.11.1 milestone Nov 10, 2025
tatiana added a commit that referenced this pull request Nov 12, 2025
Bug fixes

* Fix ``ExecutionMode.WATCHER`` deadlock in Airflow 3.0 & 3.1 by
@tatiana in #2087
* Fix ``ExecutionMode.AIRFLOW_ASYNC`` ``TaskGroup`` XCom issue by
@tatiana in #2088
* Guard watcher callback exceptions to avoid hanging producer tasks by
@pankajkoti in #2101
* Fix SQL templated field rendering for dynamically mapped tasks in
Airflow 2 by @tatiana in #2119

Enhancements

* Remove usage of contextmanager in plugins for accessing connections in
Airflow >= 3.1.2 by @pankajkoti in #2073

Docs

* Improve ``ExecutionMode.AIRFLOW_ASYNC`` docs by @tatiana in #2103
* Add note about experimenting threads count for the Watcher Execution
mode by @pankajkoti in #2083
* Fix minor documentation formatting issue by @dnskrv in #2098
* Correct example YAML key from ``operator_args`` to ``operator_kwargs``
by @jx2lee in #2091

Others

* Fix broken CI due to fastapi incompatibility with cadwyn for Airflow 3
by @pankajkoti in #2076
* pre-commit autoupdate in #2078, #2104

related:
astronomer/oss-integrations-private#272
@tatiana tatiana mentioned this pull request Nov 12, 2025
tatiana added a commit that referenced this pull request Nov 13, 2025
Bug fixes

* Fix ``ExecutionMode.WATCHER`` deadlock in Airflow 3.0 & 3.1 by
@tatiana in #2087
* Fix ``ExecutionMode.AIRFLOW_ASYNC`` ``TaskGroup`` XCom issue by
@tatiana in #2088
* Guard watcher callback exceptions to avoid hanging producer tasks by
@pankajkoti in #2101
* Fix SQL templated field rendering for dynamically mapped tasks in
Airflow 2 by @tatiana in #2119

Enhancements

* Remove usage of contextmanager in plugins for accessing connections in
Airflow >= 3.1.2 by @pankajkoti in #2073

Docs

* Improve ``ExecutionMode.AIRFLOW_ASYNC`` docs by @tatiana in #2103
* Add note about experimenting threads count for the Watcher Execution
mode by @pankajkoti in #2083
* Fix minor documentation formatting issue by @dnskrv in #2098
* Correct example YAML key from ``operator_args`` to ``operator_kwargs``
by @jx2lee in #2091

Others

* Fix broken CI due to fastapi incompatibility with cadwyn for Airflow 3
by @pankajkoti in #2076
* pre-commit autoupdate in #2078, #2104

Closes: astronomer/oss-integrations-private#272
tatiana added a commit that referenced this pull request Feb 11, 2026
**Context**

Over the past few months, we have experienced recurring CI failures
caused by dependency conflicts. These issues are not triggered by
changes in Cosmos itself, but rather by unpinned and dynamically
resolved dependencies.

These conflicts have been disruptive, time-consuming to debug, and
difficult to reproduce locally.

Some recent examples:

- #2268
- #2172
- #2076
- #1987
- #1909
- #1902

**Current Situation**

We have tried several approaches to mitigate dependency issues:
- Dynamically resolving dependencies while restricting requirements as
little as possible
- Handling Airflow version–specific dependencies individually
- Sometimes relying on Airflow constraints (which do not include
provider versions), sometimes not
- Attempting to isolate dependencies in `pre-install-airflow.sh`

More recently, however, Airflow began being reinstalled via
`integration-setup.sh`, leading to overlapping installations and Python
virtual environments with conflicting packages.

Additionally, if we try to recreate the environment locally using the
exact dependency list printed by the CI at the end of the “Install
packages and dependencies” step, the environment cannot be created due
to dependencies conflicts.

This results in:
- Non-deterministic Python package installation
- CI failures that are difficult (or impossible) to reproduce locally
- Significant frustration and lost engineering time

**Proposed Approach**

This PR proposes pinning dependencies more strictly to make our CI
environments deterministic and reproducible.

I do not believe this is a perfect solution. Some trade-offs include:
- We will no longer automatically test against newly released dependency
versions
- Pinned versions may require manual updates, including potential
security updates

This PR also does not introduce pip constraints files (since we
currently rely on pip install -r). However, it can be viewed as a step
toward the approach discussed in:
#967

I discussed this proposal with @pankajastro and @pankajkoti, and we
agreed it is worth trying. If this strategy does not work well in
practice, we can revert to the current approach.

**Known Side Effects**

The changes in this PR introduce a few limitations:

- Tests no longer run the cross-project example DAG (dbt Loom) using the
LoadMode.DBT_LS approach, as dbt Loom is now installed in a separate
virtual environment due to dependency conflicts.
- The S3 load manifest task is no longer executed in the corresponding
DAG for Airflow 2.9, due to conflicts between aiobotocore and other
dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cosmos CI broken

3 participants