fix(scripts): keep uv.lock in sync and scope the version sed to [project]#802
Merged
Conversation
…ect] Two defects in the ShipIt command updater. uv.lock records the project's own version, but the updater only wrote pyproject.toml and reactivex/_version.py. The lock therefore went stale on every release — it still says 5.0.0rc1 while the project is at 5.0.0rc2 — and any later `uv` invocation silently rewrote it, producing unrelated diffs in otherwise clean working trees. Run `uv lock` after the bump. Only the local package is re-resolved; pinned dependency versions are untouched. The substitution `s/^version = "..."/` was not scoped to a table, so it rewrote every column-0 `version` key in the file. Only [project] has one today, so nothing was silently corrupted, but a top-level `version` in any future [tool.*] section would have been clobbered. Restrict the substitution to the [project] table. The updater runs inside the shipit-pr job, which sets up .NET only, so add setup-uv there; without it `uv lock` would break release PR generation. Verified by running the script: pyproject.toml, reactivex/_version.py and uv.lock all move together, the lock diff contains only the project's own version with no dependency drift, and a [tool.*] version key added for the test survives the anchored sed while the unanchored one overwrote it.
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.
Two defects in
scripts/shipit_bump_version.sh, the command updater ShipIt invokes to write the release version. Both surfaced while working on #798/#800.1.
uv.lockwas never updateduv.lockrecords the project's own version, but the updater only wrotepyproject.tomlandreactivex/_version.py. The lock has been drifting for two releases:Any later
uvcommand silently corrects it, so the drift shows up as an unrelateduv.lockdiff in an otherwise clean working tree — which is exactly how I ran into it.Fixed by running
uv lockafter the bump. Only the local package is re-resolved; pinned dependency versions are left alone (that would be--upgrade).2. The version sed was not scoped to a table
sed -i "s/^version = \".*\"/version = \"$PEP440\"/" pyproject.tomlThis rewrites every column-0
versionkey in the file. Only[project]has one today, so nothing was silently corrupted — but a top-levelversionin any future[tool.*]section would have been clobbered. Now restricted to the[project]table.3.
setup-uvadded to theshipit-prjobThe updater runs inside
shipit-pr, which sets up .NET only — no Python, no uv. Without this stepuv lockwould fail underset -euo pipefailand break release-PR generation. This is a required part of change 1, not an unrelated addition.Verification
Ran the script for real (
5.0.0-rc.9):pyproject.tomlreactivex/_version.pyuv.lockDiffing every
version =line in the lock before/after shows the project's own version as the sole change — no dependency drift.For the sed, I appended a
[tool.faketool]section withversion = "9.9.9"and ran both variants:9.9.9overwritten with5.0.0(the bug)9.9.9preserved,[project]still correctly bumpedAlso:
bash -nclean, workflow YAML parses,pre-commit run --all-filespasses (ruff check, ruff format, pyright, mypy).Note
This adds a new failure mode: if
uv lockfails, the updater now fails and takes the ShipIt run with it. That is intentional — a half-updated version set is worse than a failed release PR — but it does mean release-PR generation now depends on uv being installable and the lock being resolvable.Independent of #800; either can merge first.
🤖 Generated with Claude Code