Skip to content

Bound uv required-version so Renovate stops silently changing the lockfile format - #243

Closed
rhysyngsun wants to merge 1 commit into
mainfrom
nl/bound-uv-required-version
Closed

rhysyngsun wants to merge 1 commit into
mainfrom
nl/bound-uv-required-version

Conversation

@rhysyngsun

Copy link
Copy Markdown
Contributor

Sets [tool.uv].required-version to >=0.9.17,<0.12.22 — the range of uv versions that write uv.lock revision = 3, which is the revision this repo is on.

Why

Renovate reads [tool.uv].required-version and uses it to pick which uv binary to run (pep621/processors/uv.ts). With no upper bound it resolves to the newest uv available on the runner, so a dependency bump can move the lockfile to a newer format as a side effect — no mention of it in the title, no package entries changed.

That happened in mit-learn#4070: one line of pyproject.toml, zero package changes, and uv.lock moved from revision = 3 to revision = 5. Anyone on an older uv who runs uv lock afterwards silently reverts it, and the existing gates cannot see it:

Check Against a downgraded lockfile
uv lock --check passes
uv sync --locked passes

A newer uv accepts an older-revision lockfile as valid, so only reading the uv.lock diff catches the regression.

Renovate never writes required-version, so it will not propose raising this bound itself. Moving to a new lockfile format becomes a deliberate, reviewable change.

Verification

  • uv.lock is untouched — this PR changes pyproject.toml only. If a lockfile moves, the constraint is wrong.
  • Every pinned uv version this repo builds or tests with falls inside >=0.9.17,<0.12.22.

Part of mitodl/hq#14344

Renovate chooses which uv binary to run by resolving
`[tool.uv].required-version`. Left open-ended, that resolves to
whatever uv its runner happens to ship, so a routine dependency bump
can rewrite `uv.lock` in a newer format with nothing in the PR title
or diff summary to say so. Anyone on an older uv who then runs
`uv lock` reverts the format and drops fields, and both
`uv lock --check` and `uv sync --locked` pass against the result.

An upper bound makes a lockfile format change something a person
chooses rather than something a bot's runner decides.

This repo's lockfile is `revision = 3`, written by uv 0.9.17 through 0.12.21.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZvmEumrfZcNJ8DcaT5gEg

@agent-optibot agent-optibot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Bounds uv versions to keep Renovate on the current lockfile format.

Dependencies changed: pyproject.toml


Summary of dd88e56 · React 👍 or 👎 on my comments to tune what I raise · Commands · Review config

@agent-optibot agent-optibot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Status: Code Looks Good 👍

No blocking issues found.

📌 Reviewed up to the latest commit · ⏱️ Review completed in 4 minutes

  • 🔄 re-review this PR

@rhysyngsun

Copy link
Copy Markdown
Contributor Author

Closing: the required-version bound this PR adds does not deliver what it was meant to.

uv has only ever changed the uv.lock format revision mid-minor (0.6.10 → 0.6.17, 0.8.0 → 0.8.4, 0.12.21 → 0.12.22) and never at a minor boundary, so an upper bound at the next minor permits exactly the kind of change it is supposed to prevent — while breaking image builds and release jobs that only read the lockfile, after merge rather than on a PR.

Replaced by a check that asserts the lockfile revision directly: mitodl/ol-github-workflows#18. It is version-number independent, catches downgrades as well as upgrades, fails on the pull request, and cannot break a build. A follow-up PR will add it here.

Full reasoning and evidence: https://github.com/mitodl/hq/issues/14344#issuecomment-6855508426

@rhysyngsun rhysyngsun closed this Nov 13, 2026
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.

1 participant