You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2026/10/15 14:24:16 UTC
[PR] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
ashb opened a new pull request, #74803:
URL: https://github.com/apache/airflow/pull/74803
Several hooks ran uv without --frozen, so a commit could re-lock with
whichever uv was on PATH (seen: lock format revision and environment
markers rewritten by an unrelated commit). Set UV_FROZEN=1 through prek's
default_env (needs prek 0.4.8); the manual upgrade hooks set UV_FROZEN=0
because they need real resolution.
update-uv-lock ran `uv lock --frozen`, which exits 0 on a stale lock, and
CI always skipped it, so the 2026-10-14 providers release merged with
version bumps that were never re-locked. Run `uv lock --check` with
UV_FROZEN=0 and stop skipping it in CI.
The breeze shim passes --locked, which older uv rejects together with an
inherited UV_FROZEN. Unset UV_FROZEN in the shim and bump SHIM_VERSION to 3
so existing installs are told to re-run setup_breeze.
<!-- 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".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] 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] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #74803:
URL: https://github.com/apache/airflow/pull/74803#discussion_r4284751652
##########
scripts/tools/setup_breeze:
##########
@@ -84,7 +84,8 @@ else
echo "breeze: not inside an Airflow worktree, AIRFLOW_REPO_ROOT is unset or not an Airflow worktree, and the install-time fallback '\${fallback_root}/dev/breeze' is missing — re-run scripts/tools/setup_breeze" >&2
exit 1
fi
-exec env AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
+# '--locked' already guarantees no rewrite; an inherited UV_FROZEN conflicts with it on older uv.
+exec env -u UV_FROZEN AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
Review Comment:
This fixes new installs, but a v2 shim already on someone's PATH still runs `uv run --locked` with the `UV_FROZEN=1` it now inherits from prek. On uv 0.11.8 and 0.12.8 (both inside our `required-version = ">=0.11.8"` floor) that's a hard `error: the argument --locked cannot be used with UV_FROZEN`; 0.12.9 is fine. So every breeze-backed root hook (`check-template-fields-valid`, for one) fails on commit, and the SHIM_VERSION bump never gets to tell them why, since `warn_if_shim_outdated` runs inside breeze, which doesn't start. Could `initialize_breeze_prek` call `describe_breeze_not_running_from_lock()` and exit with the re-run hint? Dropping `UV_FROZEN` from `new_env` in `run_command_via_breeze_*`, or raising the uv floor to 0.12.9, would also cover it.
##########
.pre-commit-config.yaml:
##########
@@ -17,11 +17,14 @@
---
default_stages: [pre-commit, pre-push]
default_install_hook_types: [pre-commit, commit-msg]
-minimum_prek_version: '0.3.4'
+minimum_prek_version: '0.4.8'
default_language_version:
python: python3
node: 22.19.0
golang: 1.25.0
+default_env:
+ # Unless overridden, no hook should change the resolutions in uv.lock; hooks use the committed ones.
+ UV_FROZEN: "1"
Review Comment:
`default_env` only reaches hooks defined in this file. With prek 0.5.3, a hook in a nested config like `providers/.pre-commit-config.yaml` sees `UV_FROZEN` unset. The nested hook that still writes the lock is `check-provider-yaml-valid`: `run_provider_yaml_files_check.py:128` runs `uv sync --no-dev --all-packages` without `--frozen` inside breeze, with the host `pyproject.toml`, `providers/` and `uv.lock` all bind-mounted. A provider version bump without a re-lock (the release case from #74799) gets re-resolved by the container's uv and written back to the host lock. That predates this PR, but adding `--frozen` to that `uv sync` would close it. Breeze doesn't forward `UV_FROZEN` into the container, so the flag is the only way there.
##########
contributing-docs/07_local_virtualenv.rst:
##########
@@ -287,8 +287,12 @@ or when running tests), you can pass the ``--frozen`` flag:
uv sync --frozen
-This will fail if the lock file is out of date with respect to ``pyproject.toml``, rather than
-silently updating it. This is useful when you want to guarantee fully reproducible environments.
+This never resolves or writes to the lock file, even when it is out of date with respect to
+``pyproject.toml``. Use ``--locked`` (or ``uv lock --check``) to fail on a stale lock file instead.
+
+A change to a ``pyproject.toml`` (including a workspace member's version) must be committed together
+with the refreshed ``uv.lock``: run ``uv lock``. The ``update-uv-lock`` prek hook, which also runs in CI,
+fails otherwise. All other prek hooks run ``uv`` frozen and never change ``uv.lock``.
Review Comment:
This overstates it a bit. The two manual upgrade hooks run unfrozen on purpose (`upgrade-important-versions` rewrites `dev/breeze/uv.lock`), and hooks in nested configs don't get `default_env`. Maybe "Hooks in the root config that run on commit use `uv` frozen and never change `uv.lock`"?
--
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] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #74803:
URL: https://github.com/apache/airflow/pull/74803#issuecomment-6200239941
### Backport successfully created: v3-4-test
Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
<table>
<tr>
<th>Status</th>
<th>Branch</th>
<th>Result</th>
</tr>
<tr>
<td>✅</td>
<td>v3-4-test</td>
<td><a href="https://github.com/apache/airflow/pull/74812"><img src="https://img.shields.io/badge/PR-74812-blue" alt="PR Link"></a></td>
</tr>
</table>
--
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] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb merged PR #74803:
URL: https://github.com/apache/airflow/pull/74803
--
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] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #74803:
URL: https://github.com/apache/airflow/pull/74803#discussion_r4285404855
##########
scripts/tools/setup_breeze:
##########
@@ -84,7 +84,8 @@ else
echo "breeze: not inside an Airflow worktree, AIRFLOW_REPO_ROOT is unset or not an Airflow worktree, and the install-time fallback '\${fallback_root}/dev/breeze' is missing — re-run scripts/tools/setup_breeze" >&2
exit 1
fi
-exec env AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
+# '--locked' already guarantees no rewrite; an inherited UV_FROZEN conflicts with it on older uv.
+exec env -u UV_FROZEN AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
Review Comment:
Breeze already warns about shim behing out of date I thought.
--
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] Stop prek hooks changing uv.lock and fail CI when it is stale [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #74803:
URL: https://github.com/apache/airflow/pull/74803#discussion_r4285868195
##########
scripts/tools/setup_breeze:
##########
@@ -84,7 +84,8 @@ else
echo "breeze: not inside an Airflow worktree, AIRFLOW_REPO_ROOT is unset or not an Airflow worktree, and the install-time fallback '\${fallback_root}/dev/breeze' is missing — re-run scripts/tools/setup_breeze" >&2
exit 1
fi
-exec env AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
+# '--locked' already guarantees no rewrite; an inherited UV_FROZEN conflicts with it on older uv.
+exec env -u UV_FROZEN AIRFLOW_ROOT_PATH="\${breeze_root}" SKIP_BREEZE_SELF_UPGRADE_CHECK=1 \\
Review Comment:
Fixed
--
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