Repository navigation
Stop generating constraints for PRs that do not use them - #76685
Conversation
Generate constraints ran for every PR that builds the CI image, about 149 jobs a day, though for 46% of those runs nothing reads its output. The PROD image, its only reader on an ordinary PR, reads just the source-providers file. The PyPI step asks PyPI for 108 providers and resolves 725 packages against what it serves, which a change that touches no dependency cannot affect. That step turned PyPI outages into red PRs: of the 51 jobs that failed from 2026-10-16 to 2026-11-05, 40 were network errors and 38 were on PRs that touched no dependency files. The only two failures no other job caught were in PRs that changed dependency files, which still run it. Canary runs still cover the state of PyPI. Claude-Session: https://claude.ai/code/session_01BVx6g6v9hW7wi1tV4bqvrp
|
The re-run of the jobs stopped by EC2 Spot interruptions finished: attempt 2 passed. |
potiuk
left a comment
There was a problem hiding this comment.
Gating Generate constraints on the PROD image build and dependency changes is consistent with every consumer of its output: the PROD image build and its tests need it only when it runs, Update constraints runs only when the PyPI step does, and main canaries and dispatched release-branch runs keep the full resolution.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Airflow handles maintainer review:
Contributing guide.
Backport failed to create: v3-4-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker e1150d7 v3-4-testThis should apply the commit to the v3-4-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
…76685) (#76849) Generate constraints ran for every PR that builds the CI image, about 149 jobs a day, though for 46% of those runs nothing reads its output. The PROD image, its only reader on an ordinary PR, reads just the source-providers file. The PyPI step asks PyPI for 108 providers and resolves 725 packages against what it serves, which a change that touches no dependency cannot affect. That step turned PyPI outages into red PRs: of the 51 jobs that failed from 2026-10-16 to 2026-11-05, 40 were network errors and 38 were on PRs that touched no dependency files. The only two failures no other job caught were in PRs that changed dependency files, which still run it. Canary runs still cover the state of PyPI. Claude-Session: https://claude.ai/code/session_01BVx6g6v9hW7wi1tV4bqvrp (cherry picked from commit e1150d7) Generated-by: Claude Opus 5 Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
…76685) (#76849) Generate constraints ran for every PR that builds the CI image, about 149 jobs a day, though for 46% of those runs nothing reads its output. The PROD image, its only reader on an ordinary PR, reads just the source-providers file. The PyPI step asks PyPI for 108 providers and resolves 725 packages against what it serves, which a change that touches no dependency cannot affect. That step turned PyPI outages into red PRs: of the 51 jobs that failed from 2026-10-16 to 2026-11-05, 40 were network errors and 38 were on PRs that touched no dependency files. The only two failures no other job caught were in PRs that changed dependency files, which still run it. Canary runs still cover the state of PyPI. Claude-Session: https://claude.ai/code/session_01BVx6g6v9hW7wi1tV4bqvrp (cherry picked from commit e1150d7) Generated-by: Claude Opus 5 Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
This PR replaces #76656. It has the same commit, rebased onto
mainand moved to anapache/airflowbranch. A stacked PR needs all its branches in the same repository.Why
The
Generate constraintsjob runs on every PR that builds the CI image. Many of these PRs do not use its output.The data comes from
Tests (AMD)PR runs from 2026-10-16 to 2026-11-05. There were 5177 runs. I sampled 15 runs per day, 308 runs in total.ubuntu-22.04pypi.orgJSON requests per jobpypi.orgJSON requests per dayIn the 46% of runs without a PROD image, no job reads the output.
The job also causes failures that are not related to the PR. I read the logs of all 51 jobs that failed in this period:
pypi.org36,nodejs.org3,api.github.com1)common-compat==1.22.0)38 of the 51 failures are on PRs that do not change dependency files.
Two of the 3 PR errors are on PRs that change dependency files (#74696, #76317). These PRs still run the job after this change. The third PR (#76548) also failed
React UI testsandStatic checks.How
This PR adds two selective-check outputs:
generate-pypi-constraintspyproject.tomlfile changed,uv.lockchanged, full tests are necessary, the run is a canary, or the PR has theupgrade to newer dependencieslabelgenerate-constraintsgenerate-pypi-constraintsis true, or the PROD image is builtFull tests are necessary when the job's workflow or script changes. Thus, a change to these files still runs the PyPI step.
ci-amd.ymlandci-arm.ymluse these outputs to control the job.The PROD image build reads only the
constraints-source-providersfile. Whengenerate-pypi-constraintsis false and the PROD image is built, the job makes only that file. It does not build the provider, Airflow and Task SDK wheels, and it does not run the PyPI step.The other workflows that call
generate-constraints.ymlset their own inputs. This PR does not change them.Expected result
The job does not run on PRs that do not build the PROD image and do not change dependencies. These runs used 43% of the job's minutes in the sample. The steps removed from the other runs used 29%.
The maximum saving is 72% of the job's minutes, about 17 runner hours per day. The real saving is smaller because PRs that change dependencies still run the job. I did not measure the number of these PRs.
Risk
A PR can break the PyPI resolution or the wheel builds without a change to dependency files. This job does not find that error on the PR after this change. The canary runs find it instead. AMD and ARM canaries each run two times per day.
This type of failure did not occur in the 21 days of data.
Verification
test_selective_checks.pyandtest_verification_plan.pytest_generate_constraintscasesprek, pre-commit stagelychee-dockerprek, manual stagedev/breeze/testslychee-dockerdid not start because the local Docker proxy refused a writable bind mount. I ranlycheeverse/lychee:nightlyon the two changed documents with a read-only mount. The result is 0 errors.The 16 errors are
botocore.exceptions.MissingDependencyExceptionintest_release_management_commands.py. The cause is thatpublish_docs_to_s3.pycreates AWS clients during import. #76658 fixes this.The failed test is
test_reproducible_build_matches_svn. It does not use AWS. It failed because the local Docker proxy refusedbuildx_buildkit_default, sodocker builddid not start. This test compares a real build with real SVN artifacts, so it cannot use mocks. CI skips it.The workflow changes have not run in CI. The CI run of this PR must confirm them.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines
🤖 Generated with Claude Code
https://claude.ai/code/session_01BVx6g6v9hW7wi1tV4bqvrp