ci: keep Cargo.lock in step with releases and gate CI on --locked - #158
Conversation
release-please bumped every workspace crate's version in Cargo.toml but never touched Cargo.lock, so the lockfile went stale on each release (main carried 0.7.1 entries against a 0.7.2 manifest until the next cargo invocation happened to rewrite it). Nothing caught it because CI ran without --locked. The release PR now also rewrites the lock entries: a TOML extra-file whose JSONPath selects every `[[package]]` without a `source`, which is exactly the set of workspace members (registry and VCS dependencies all carry one). The check job runs `cargo check --locked`, so a stale lockfile fails CI instead of silently regenerating. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Claude finished @alukach's task in 1m 13s —— View job Review complete ✅
✅ No blocking issues — safe to merge. Verified independently: One non-blocking caveat worth noting: the filter's assumption ("only workspace members lack Simplify (ponytail) Nothing to flag — the diff is already minimal (one filter-based lockfile entry instead of per-crate entries, a single-line CI flag, two lines of docs). 💰 Estimated review cost: $0.29 · 1m13s · 16 turns |
|
🚀 Latest commit deployed to https://multistore-proxy-pr-158.development-seed.workers.dev
|
What I'm changing
release-please bumps every workspace crate's version in
Cargo.tomlon each release, but nothing updatesCargo.lock. The lockfile has been going stale on every release:maincarried0.7.1entries against a0.7.2manifest until some later cargo invocation happened to rewrite the file. CI never noticed because no job runs with--locked, so cargo quietly regenerated the lock on each run.This PR makes the release PR update the lock itself and makes CI fail on a stale lock.
How I did it
release-please-config.json: one moretomlextra-file targetingCargo.lockwith JSONPath$.package[?(!@.source)].version. In a lockfile, only workspace members lack asourcefield (registry and VCS dependencies always carry one), so the filter selects exactly the ten workspace crates and nothing else, and a newly added crate is covered without a config change. release-please's TOML updater usesjsonpath-plus, which supports filter expressions, and edits values in place without reformatting the file..github/workflows/ci.yml: the Cargo Check job runscargo check --locked. This is the gate; a stale lockfile, from a release or from a dependency change committed without its lock update, now fails instead of self-healing.CONTRIBUTING.md: notes that the lockfile is committed and checked, and that the release PR maintains the workspace entries.Verified locally by running release-please's actual
GenericTomlupdater (v17.9.0) against this repo'sCargo.lock: it changed the ten workspace entries and no others. Then simulated a release end to end: bumpedCargo.tomlto 0.7.3 the way the release does, confirmedcargo check --lockedfails with the stale lock, ran the updater, and confirmed it passes.Test plan
GenericTomlupdater run againstCargo.lockwith the filter: 10 entries changed, all workspace memberscargo check --lockedonmainas-is: passescargo check --lockedafter a simulated version bump with a stale lock: fails; after the updater rewrites the lock: passes🤖 Generated with Claude Code