Skip to content

Add compat tests against "v3-X-test" branch tip for providers - #76957

Open
sjyangkevin wants to merge 4 commits into
apache:mainfrom
sjyangkevin:providers-branch-tip-compat-tests
Open

sjyangkevin wants to merge 4 commits into
apache:mainfrom
sjyangkevin:providers-branch-tip-compat-tests

Conversation

@sjyangkevin

@sjyangkevin sjyangkevin commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

closes: #54454

The following illustration use 3.4.0 as an example, but it should work for future release.

What

Today, the provider compatibility tests only run against Airflow versions that are already released on PyPI. Bug fixes for the next patch release are backported to the release branch (v3-4-test at the moment). So if a backport breaks a provider, we might find out after the release is out. #54454 asks for compatibility tests against the v3-X-test branch tip, so we can catch this earlier.

This PR adds a new workflow, test-providers-branch-tip.yml, that runs the provider tests from main against Airflow built from the tip of the release branch. It runs next to the existing compatibility jobs and does not change them.

How it works

  1. Find the branches. Selective checks pass the latest release in PROVIDERS_COMPATIBILITY_TESTS_MATRIX (3.4.0 today). The job lists the vX-Y-test branches of the repository and keeps the ones whose X.Y is at least 3.4 and that have a constraints-X-Y branch. Today that is only v3-4-test. While the next minor release is in beta, it would be both v3-4-test and v3-5-test. Once 3.5.0 is released and added to the matrix, v3-4-test drops out. There is no new list to maintain, and the matrix keeps only published releases, which the OpenLineage e2e compatibility tests also rely on.
  2. Build Airflow from the branch tip. The job checks out the branch at the commit it found and builds the Airflow and Task SDK wheels with the branch's own breeze, the same way a release is built, including the compiled UI. It then checks that the wheel records that commit (airflow/git_version).
  3. Run the provider tests. These are the same steps as the existing compatibility job, except that Airflow is installed from those wheels (--use-airflow-version wheel) with the branch's constraints (constraints-3-4).

The issue suggests installing Airflow from the branch with git (#54070). I tried that first, but it needs a full clone of the repository, it builds the providers Airflow depends on from the branch's outdated copies (which conflict with the branch constraints), and it skips the UI build that some provider tests need. Building wheels avoids all three. Installing them from dist also pins Airflow, so the resolver cannot replace the branch build with the 3.4.0 release from PyPI, which has the same version number.

When it runs

Event Runs?
Canary runs on main (twice a day on AMD, twice a day on ARM) Yes
A PR with the full tests needed label Yes
A PR that changes test-providers-branch-tip.yml, like this one Yes
Any other PR, including provider changes No
Release branches No

It does not run on every provider PR because the branch tip moves on its own. A provider change is already covered by the 3.4.0 job, and a failure on the branch tip would usually come from a backport that the PR author cannot fix.

Before and after, for a canary run

Before After
Compatibility jobs against released versions 6 (2.11.1 to 3.4.0) 6, unchanged
Branch tip jobs None 1 lookup (seconds), 1 build (a few minutes), 1 test job. Two builds and two test jobs while a minor release is in beta
Regular PR runs No branch tip jobs No branch tip jobs, except the cases in the table above

When the branch tip job fails and the 3.4.0 job in the same run passes, the cause is in a backport since 3.4.0 (git log 3.4.0..<sha>).

The new job is listed in CI passed and Check for timed-out CI jobs, so a failure shows up on the canary run and in Slack. I did not add it to Finalize tests, so that a broken backport on a release branch does not stop main from publishing its images. Does this sound right to you?

Testing

I ran the steps of the job locally in breeze against v3-4-test at a707ed72f8:

  • Building the wheels with the branch's own breeze took about two and a half minutes. The wheels include the compiled UI, and git_version matches the commit.
  • The standard provider tests had 1227 passed and 9 failed. The same 9 tests failed against released 3.4.0, because my local run did not include the openlineage provider. So the branch tip did not break anything there.
  • The fab provider tests, which start the API app and need the compiled UI, had 747 passed.
  • As a negative control, I renamed a keyword argument of upsert_hitl_detail() in a local commit on top of the branch tip. Only the HITL tests failed, with a TypeError. This shows the job catches a breaking backport, and that the tests really used the branch wheels.

I also ran the branch lookup against the GitHub API with different latest releases, to check that it compares versions as numbers (v2-10-test comes after v2-9-test) and skips branches without a constraints branch. The new selective-check outputs have unit tests, and test_selective_checks.py and test_verification_plan.py pass. The workflow itself can only run on GitHub, and this PR changes it, so its CI runs the new job.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Claude Code (Fable 5.2)] following the guidelines


  • Read the 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) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@sjyangkevin
sjyangkevin marked this pull request as ready for review November 12, 2026 02:11
@sjyangkevin sjyangkevin changed the title Test providers against Airflow built from release branch tips Add compat tests against "v3-X-test" branch tip for providers Nov 12, 2026
@sjyangkevin
sjyangkevin force-pushed the providers-branch-tip-compat-tests branch 3 times, most recently from 03bae2b to 19170e7 Compare November 12, 2026 18:56
@sjyangkevin

Copy link
Copy Markdown
Contributor Author

End-to-end run of the new job in my own fork

Project CI for this PR is waiting for workflow approval, so I ran the full Tests (AMD) workflow in my fork to check the new job end to end.

What the run shows

Step Evidence in the log Where
Selective checks turn the job on run-providers-branch-tip-compatibility-tests = true, latest release 3.4.0 Build info, "Selective checks"
The release branch tip is resolved v3-4-test: 5aac527431c2e6610384bfa09073897f29cd1071 Find release branch tips
Airflow is built from that commit, with the compiled UI git_version of the airflow-core wheel: .release:5aac527431c2e6610384bfa09073897f29cd1071 Build Airflow from v3-4-test
The tests install that build, not 3.4.0 from PyPI Installed apache-airflow-core 3.4.0 git_version: .release:5aac527431c2e6610384bfa09073897f29cd1071 Compat v3-4-test, "Check that Airflow installed from the wheels…"
Provider unit tests pass on the branch tip All five test groups OK: 33,683 passed, 608 skipped, 0 failed Compat v3-4-test, "Run provider unit tests…"
Same result as the released version Compat 3.4.0 in the same run: identical counts in every group Compat 3.4.0

The branch tip and the 3.4.0 wheel have the same version number, so the fourth row is what tells them apart. That check is new in this PR since the first push: the job now fails if the installed Airflow was not built from the resolved commit.

Screenshot from 2026-11-12 15-03-44 Screenshot from 2026-11-12 15-04-06 Screenshot from 2026-11-12 15-04-38 Screenshot from 2026-11-12 15-05-16

What this run does not show

  • It is a fork run, not project CI. It used public runners and my fork's caches.
  • I pushed copies of v3-4-test and constraints-3-4 to my fork first. The job reads the release branches, the commit and the constraints from the repository it runs in. In a fork without those branches it finds no target and passes without testing anything.
  • A green run shows the job works, not that it catches a break. The negative control for that is the local run in the PR description.

One question

Should the job always read the branch tips from apache/airflow, the way #75632 did for provider release tags? Then a run in a contributor's fork would test the real branch tip instead of whatever copy the fork has. I kept it on the running repository for now and can change it here if that is preferred.

Changes since the first push

  • The scripts test that lists the jobs selecting prek hooks did not include the new job. Fixed.
  • Added the installed-version check described above.

env:
LATEST_RELEASE: ${{ inputs.latest-release }}
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
REPOSITORY: ${{ github.repository }}
REPOSITORY: "apache/airflow"

Under ADIP-12 ("Your PR, Your CI"), workflows run on runners inside the contributor's fork repository where ${{ github.repository }} evaluates to <fork-owner>/airflow.

GitHub only clones the default branch (main) on fork creation; maintenance branches (vX-Y-test) and constraint branches (constraints-*) are not replicated to forks. Querying ${REPOSITORY} causes gh api to return an empty array [], setting targets=[] and causing the compatibility checks to silently no-op on all fork CI runs.

Because apache/airflow is a public repo, runner GITHUB_TOKENs have read access to query its refs directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. Updated in ea2ec7f4d2. Reading from apache/airflow also lets the lookup fail when it finds nothing. The branch of the latest release in the matrix and its constraints branch always exist there, so not finding them means the lookup is broken. Before, the job passed and tested nothing.

Comment on lines +124 to +126
with:
ref: ${{ matrix.target.sha }}
persist-credentials: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
with:
ref: ${{ matrix.target.sha }}
persist-credentials: false
with:
repository: apache/airflow
ref: ${{ matrix.target.sha }}
persist-credentials: false

When repository: is omitted from actions/checkout, it defaults to the runner repository (github.repository).

On fork CI under ADIP-12, the runner tries to check out matrix.target.sha from the contributor's fork repository. Because that SHA only exists on upstream apache/airflow, checkout immediately crashes with:
fatal: reference is not a tree: <sha>.

Explicitly setting repository: apache/airflow ensures git fetches the tree object from upstream.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, done in the same commit ea2ec7f4d2. Each target now carries the repository it was read from, and the checkout uses it, so the lookup and the checkout cannot point at different repositories.

Screenshot from 2026-11-12 22-01-03

timeout-minutes: 80
# yamllint disable rule:line-length
name: Compat ${{ matrix.target.branch }}:P${{ matrix.target.python-version }}:${{ matrix.test-types.description }}
needs: [find-branch-tips, build-airflow]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
needs: [find-branch-tips, build-airflow]
needs: [find-branch-tips, build-airflow]
if: needs.find-branch-tips.outputs.targets != '[]' && needs.find-branch-tips.outputs.targets != ''

build-airflow has an if guard (if: needs.find-branch-tips.outputs.targets != '[]'), but providers-branch-tip-compatibility-tests is missing it.

In GitHub Actions, matrix expansion happens prior to step execution. If targets is empty ([]), matrix.target: ${{ fromJSON(needs.find-branch-tips.outputs.targets) }} receives an empty list, causing GitHub Actions to fail the workflow run with a syntax error:
The workflow is not valid. Matrix [target] cannot be empty.

Adding this job-level if ensures the job is cleanly skipped without error when no targets are resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After running some tests. This guard might not be needed. When targets is [], build-airflow is skipped, and GitHub skips a job whose needs include a skipped job unless its if uses always() or a similar function. The test job is skipped before its matrix is expanded, so the run does not fail.

With the change for the first comment, [] is also left only for a matrix without any release: a lookup that finds nothing now fails in Find release branch tips.

run: |
for provider in ${REMOVE_PROVIDERS}; do
echo "Removing incompatible provider: ${provider}"
rm -vf dist/apache_airflow_providers_${provider/./_}-*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
rm -vf dist/apache_airflow_providers_${provider/./_}-*
rm -vf dist/apache_airflow_providers_${provider//./_}-*

Bash parameter expansion ${provider/./_} (single slash) only replaces the first occurrence of .. If a provider identifier contains multiple dots, subsequent dots remain unmodified, causing the glob to miss the wheel file in dist/ and leaving the incompatible wheel installed.

Using double-slash ${provider//./_} ensures global replacement of all dots with underscores.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, / replaces only the first dot. No provider id has more than one dot today, so nothing is missed. The line is copied from the compatibility job in test-providers.yml, and I'd rather keep the two the same than fix only the copy. I can change both in a separate PR if needed.

@@ -1724,6 +1750,7 @@ jobs:
- migration-round-trip
- mypy-providers
- providers
- providers-branch-tip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove providers-branch-tip from ci-passed's needs list (and from check-timed-out-jobs).

ci-passed is the required status check gate for pull request merges. If providers-branch-tip is in needs, any unstable backport on upstream v3-4-test will cause ci-passed to fail and block all PRs on main that have the full tests needed label.

As noted in the selective_checks.py docstring: "A release branch tip moves independently of the pull request, so a pull request can neither cause nor fix a failure there." Having failures on an external branch tip block unrelated PR merges on main breaks CI reliability. This check should run as an informational/canary check, but it should not be a blocking gate in ci-passed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think you're right that a broken backport on v3-4-test would fail CI passed on every PR with the full tests needed label until the branch is fixed. Removing the job from ci-passed alone would also stop Slack from reporting it, because notify-slack waits for the rest of the run only through ci-passed. I'd move the job to the needs of notify-slack instead. Since this changes what blocks merges, I would appreciate feedback to align on a direction for this. Please see comment below: #76957 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, moving it out of ci-passed / check-timed-out-jobs and into notify-slack's needs is 100% the right architecture.

The sole purpose of ci-passed is protecting main against regressions introduced by the PR itself. Holding PRs on main hostage to external branch churn on v3-4-test would cause unnecessary merge gridlock whenever full tests needed is used. Having notify-slack wait on it directly gives the exact behavior we want: scheduled canary runs will alert maintainers on Slack if a backport breaks compatibility, without blocking unrelated PRs.

The tradeoff on workflow-modifying PRs is completely fine and standard in Airflow—reviewers always inspect the individual check runs on workflow PRs before approving anyway.

Also agree on keeping ${provider/./_} in sync with test-providers.yml for now and handling both in a follow-up, and good catch on GHA skipping dependent jobs before matrix expansion. The PR is looking really solid!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I'm holding off on the change for moving it out of ci-passed / check-timed-out-jobs for now while waiting for more feedback, because it means changing what the merge gate leaves out.

The check-ci-gate-needs prek hook (scripts/ci/prek/check_ci_gate_needs.py, added with the auto-merge gate in #75142) requires every job in ci-amd.yml to be in the needs of CI passed, and check-timed-out-jobs to need the same jobs. The only exceptions are listed in EXEMPT_JOBS, which today holds only notify-slack and summarize-warnings: "reporting-only jobs that cannot make a PR wrong". So moving the job out of CI passed means adding it to that list, based on my understanding.

@sjyangkevin
sjyangkevin force-pushed the providers-branch-tip-compat-tests branch from 1c9c082 to ea2ec7f Compare November 13, 2026 01:23
@sjyangkevin

Copy link
Copy Markdown
Contributor Author

Update after review: branch tips from apache/airflow, and a question about CI passed

Changes since last comment:

  • ea2ec7f4d2 reads the release and constraints branches from apache/airflow instead of the repository the run is in, and checks out the branch tip from there. This answers the question in my previous comment: a run in a fork now tests the real branch tip.
  • The lookup now fails when it cannot find the branch of the latest release in the matrix, instead of passing with nothing to test. It also runs with pipefail now: before, a failed API call inside the pipe still gave an empty list and the job passed.
  • 126055982e is an empty commit. It only starts the fork run again after I re-enabled Actions in my fork.
  • Rebased on main.

Fork run with the change

I deleted my fork's copies of v3-4-test and constraints-3-4 first, so the job could only find the branch tip in apache/airflow.

Step Evidence in the log
The branch tip is read from apache/airflow v3-4-test: 6a6baff34dda9eea30c373d7412a2f871a6467fb (Find release branch tips)
It is checked out from apache/airflow Syncing repository: apache/airflow, HEAD is now at 6a6baff (Build Airflow from v3-4-test)
The wheels are built from that commit git_version of the airflow-core wheel: .release:6a6baff34d…
The tests install that build Installed apache-airflow-core 3.4.0 git_version: .release:6a6baff34d… (Compat v3-4-test)
Provider tests 33,683 passed, 608 skipped, the same counts as Compat 3.4.0 in the same run

Question: should a failure on the branch tip block merges?

The new job is in the needs of CI passed and Check for timed-out CI jobs. CI passed is the check main requires before a merge. The job runs on canary runs, on PRs with the full tests needed label, and on PRs that change its workflow. So if a backport breaks a provider test on v3-4-test, every PR with the full tests needed label fails CI passed until the branch is fixed, even when the PR has nothing to do with it. Running it again does not help, because the job picks up the same broken branch tip.

The alternative is to remove the job from CI passed and Check for timed-out CI jobs, and add it to the needs of Notify Slack. Notify Slack waits for the rest of the run only through CI passed, so it needs the job listed directly. It reports every failed job of the run, timeouts included, so a broken branch tip would still show up in Slack after a canary run. The cost: a PR that changes test-providers-branch-tip.yml would no longer be blocked by its own failing job. Reviewers would still see it fail.

@sjyangkevin
sjyangkevin force-pushed the providers-branch-tip-compat-tests branch 2 times, most recently from 1df76c0 to 143d5f8 Compare November 18, 2026 03:43
The provider compatibility tests only cover Airflow releases from PyPI,
so a backport that breaks a provider is found only after the next patch
release from that branch is published.
A release branch tip can carry the version number of an Airflow that is
already on PyPI, and the tests hide their output when they pass, so the
job log did not show which of the two the tests ran against.

The test that lists the jobs selecting prek hooks did not know the new
job and failed.
Forks lack the release and constraints branches, or keep outdated
copies of them, so a run in a fork either found no branch and passed
without testing anything, or tested an old copy of the branch.

A failed branch lookup passed too: without pipefail, a failing API call
inside the pipe still produced an empty list of branches.
@sjyangkevin
sjyangkevin force-pushed the providers-branch-tip-compat-tests branch from 143d5f8 to 0f45774 Compare November 24, 2026 04:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compat tests against "v3-X-test" branch tip for providers.

2 participants