Repository navigation
Assert uv.lock stays on revision 3 - #244
Merged
Merged
Conversation
uv rewrites the `revision` key in uv.lock on any command that re-resolves -- `uv add`, `uv lock --upgrade`, and so a Renovate dependency bump -- to whatever the running uv natively writes. It moves in both directions: a newer uv raises it, an older uv lowers it and drops fields. Nothing else catches that. uv accepts a lockfile written by a different version, so `uv lock --check` and `uv sync --locked` both pass against one whose format just changed underneath. It is not hypothetical: mitodl/ol-data-platform#3315 changed one pyproject.toml and silently took two lockfiles from revision 5 back to 3. Adopted from mitodl/ol-github-workflows workflow-templates/uv-lock-revision.yml, with the two ADAPT lines set for this repository. Verified passing against this repository's 1 lockfile(s) before opening. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZvmEumrfZcNJ8DcaT5gEg
There was a problem hiding this comment.
Summary
Checks tracked uv.lock files against revision 3.
- Adds: a pull request and
mainbranch check for every trackeduv.lockfile. - Fixes: silent lockfile format changes by failing when a file lacks revision 3.
Details for reviewers
Core files: .github/workflows/uv-lock-revision.yml
Summary of c1d9e45 · React 👍 or 👎 on my comments to tune what I raise · Commands · Review config
The check runs from mitodl/ol-github-workflows/actions/uv-lock-revision, pinned at v1.0.0, rather than from a copy of the script. A fix to it then lands once and arrives here as a Renovate bump of the pin. The job keeps the name `uv.lock revision`, so the check context is unchanged.
The check runs from mitodl/ol-github-workflows/actions/uv-lock-revision, pinned at v1.0.0, rather than from a copy of the script. A fix to it then lands once and arrives here as a Renovate bump of the pin. The job keeps the name `uv.lock revision`, so the check context is unchanged.
The check runs from mitodl/ol-github-workflows/actions/uv-lock-revision, pinned at v1.0.0, rather than from a copy of the script. A fix to it then lands once and arrives here as a Renovate bump of the pin. The job keeps the name `uv.lock revision`, so the check context is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
uv.lockrevision check, which runs from mitodl/ol-github-workflows/actions/uv-lock-revision pinned at v1.1.0. The workflow here is the reference template with its twoADAPTlines set for this repository: default branchmain,expected-revision: "3".The check is a composite action rather than a copy of the script, so a fix to it lands once in
ol-github-workflowsand reaches this repository as a Renovate bump of the pin, like any other action. It is a composite action rather than a reusable workflow so the check context staysuv.lock revisioninstead of becoming<caller job> / <called job>.Why
uv writes a
revisionkey intouv.lockidentifying the lockfile format, and rewrites it on any command that re-resolves -uv add,uv lock --upgrade, and so a Renovate dependency bump. It moves in both directions: a newer uv raises it, an older uv lowers it and drops fields.Nothing else catches it, because uv accepts a lockfile written by a different version:
uv lock --checkuv sync --lockedThis is not hypothetical. mitodl/ol-data-platform#3315 changed one
pyproject.tomland silently took two lockfiles from revision 5 back to 3, with nothing in the PR to say so.A
required-versionrange cannot express the constraint - uv has only ever changed the revision mid-minor (0.6.10->0.6.17,0.8.0->0.8.4,0.12.21->0.12.22), never at a minor boundary - and it fails everywhere uv runs rather than only where a lockfile is written. That approach was tried and withdrawn; see https://github.com/mitodl/hq/issues/14344#issuecomment-6855508426.This repository
Checks 1 lockfile, currently on revision
3. The action globsgit ls-files -z '*uv.lock', so it covers every tracked lockfile with no extra configuration.It needs no toolchain - the only action it uses is
actions/checkout, and no step runsuv- so it cannot relock anything or break a build.expected-revisionis a floor, not an equality. A lockfile at or above it passes, so a newer uv raising the revision annotates the diff rather than failing it; what fails is a lockfile dropping below the floor, or below what the default branch already has. That second rule is the point: an older uv that re-resolves writes the revision it natively emits and silently drops the fields the newer format carried.Part of mitodl/hq#14344. Contract: docs/uv-lock-revision-contract.md