-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require Cargo.lock matches Cargo.toml in CI #153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. So I guess it will fail if the lock is out of date?
What workflow leads to this state? It's fine to guard against of course, but I've also not encountered the state ever on scie-pants, jump or ptex and it's been a while and alot of commits. |
Yeah, I'd like to understand what this solves a bit better. Here I update
So it appears all |
Ok, maybe cargo is just buggy or I don't understand version numbers. Although my example above fails to fail - which seems wrong to me, simpler examples, like adding a new dep to |
Yeah, this mistaken workflow is what it's catching. It happened in practice for me in pantsbuild/scie-pants#290 with bumping the package version (yes, I know scie-pants the release procedure says do a
I believe cargo only checks the lockfile versions match the input ranges, and this is all that it can do, given what's in the lockfile. In this case, (The lockfiles are moderately carefully optimised to reduce merge conflicts (rust-lang/cargo#7070), and in particular try not to have a central listing of info. E.g. they don't record the input requirements, only the resolved result.) |
Hrm, OK. I think if you have a situation where 2 humans make a mistake and it still gets by, that's again a reason to seriously pause. Both you and the reviewer missed this. That, in my mind, puts alot in question that the automation will just paper over. SGTM though, but be careful out there in scie-pants land! |
This passes
--locked
to the first interesting cargo invocation, to ensure that theCargo.lock
file is up to date withCargo.toml
. Without this, if there's been changes toCargo.toml
and the user hasn't run a cargo command locally afterwards, the invocation might change theCargo.lock
file (e.g. bump versions, add packages) and thus CI runs with an unexpected configuration, that's not recorded in the repo.(This came up in pantsbuild/scie-pants#290 and I thought to check other Rust repos that are tangentially related.)