Repository navigation
Conversation
Pull Request Test Coverage Report for Build 14503841131Details
💛 - Coveralls |
|
Regarding serde, we should just set it (in the lockfiles) to the minimal version that works at all. That might be 1.0.156. |
Are you proposing to use some From what I can tell, the failures for A third more drastic option given these are just lints is to bump the minimum version to something like |
I'm saying we should update all our .toml and .lock files to use 1.0.156 as the minimum. I'm not sure what you mean by "the minimum version wouldn't be tested". 1.0.156 is the minimum version. Versions before that don't compile.
I don't think this is so drastic. serde is really not a first-class citizen here and we shouldn't bend over backward to try to get their broken code to work. |
Ah, I misinterpreted as only change the lockfile. Thanks for the clarification.
And yea, related, been trying to make |
0772e46 to
c4f36e0
Compare
05dc80f to
51fd4e8
Compare
|
Tweaked the first patch to bump |
|
I didn't put too many clock cycles into reviewing this because it looks to me like @nyonson has had a good long think about it and it all seems reasonably sane. |
|
@nyonson my intention for In practice this is basically impossible to maintain (other than by just letting the file rot) because upgrading it requires noticing and manually trying every update and then trial-and-erroring what combination of upgraded deps it needs and then testing with the MSRV compiler and I'm just never gonna do that. In theory this also seems like it hasn't worked because everybody assumes that "recent" means "most recent available" rather than "most recent that Andrew bothered testing". So maybe we should change to just always be the output of |
| [[package]] | ||
| name = "proc-macro2" | ||
| version = "1.0.63" | ||
| version = "1.0.94" |
There was a problem hiding this comment.
In 51fd4e8:
When I run the command locally I get 1.0.95, even with the same nightly version as used by CI. I worry that the -Z direct-minimal-versions flag is unstable somehow.
There was a problem hiding this comment.
I think in this case, there was a patch release for the proc-macro2 crate in the time since I generated the lockfile.
There was a problem hiding this comment.
Oh, lol, ok.
But then the question becomes -- why does cargo update want to use this version? In general is it going to keep bumping versions of non-direct dependencies like this?
There was a problem hiding this comment.
I think this is an example of the crux of the trade off with direct-minimal-versions. It uses the minimal version for any direct dep, which I am pretty sure in a workspace just means anything in the [dependencies] section of each crate's manifest, but for transitive dependencies it uses the default policy for the constraint. Usually "update to highest minor and patch". The idea being that they might not have minimal versions specified correctly, so not testing their constraints. Looks like proc-macro2 is a transitive dep?
There was a problem hiding this comment.
Ok, we definitely do not want "update to highest minor and patch". This will result in dependency choices that don't even compile on our MSRV.
There was a problem hiding this comment.
Thanks for all the work you put into this! But it seems like this cargo flag is yet another "do something weirdly specifically wrong" flag.
There was a problem hiding this comment.
Oof, good point. I'll put this back into draft and see if I can salvage anything from it, but seems like a big hole. I'll run an experiment or two with the new v3 resolver which respects MSRV settings.
Fwiw it looks like all transitive dep versions work with the MSRV which is nice. But agree that it would be a confusing failure when that breaking upgrade arrived.
| [[package]] | ||
| name = "arrayvec" | ||
| version = "0.7.4" | ||
| version = "0.7.6" |
There was a problem hiding this comment.
In 51fd4e8:
I'm struggling to understand this change. cargo update -Z direct-minimal-versions consistently makes it, but the actual version of arrayvec that we depend on is 0.7.2 (defined by hex-conservative --- this is not even a direct dependency!). I'm not sure why this was at 0.7.4 instead of 0.7.2 and I really don't understand why it's now 0.7.6.
There was a problem hiding this comment.
I believe another example of a transitive dep version bump since arrayvec is transitive for this workspace. hex-conservative sets arrayvec = { version = "0.7.2", default-features = false }. I'll double check when using this syntax, but I think this is equivalent to the ^0.7.2 notation, so minor and patch versions will be updated.
I am not sure why the 0.7.4 version was set before, but looks like 0.7.6 is the highest version which fits the constraints.
51fd4e8 to
098541f
Compare
|
@apoelstra feel free to toss this on the back burner, but I made a small tweak in 098541f to address the MSRV leak. The cargo command to generate I added the CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS which enables the MSRV-aware resolver (aka V3). It is yet another flag, but this is the default resolver for the 2024 edition and is already stable, so not super risky. It "fallsback" to the max version of a dependency which still fits the MSRV of the workspace. Now, the big assumption here is that dependencies will correctly add their MSRV in their manifest. This is the risk, but given the relatively small amount of dependencies of the workspace, and the fact that they are currently working, maybe worth considering? |
|
I think we should consider the risk. I also don't like the idea that versions in |
That's my feeling too. I am also hoping that the ecosystem will move towards more MSRV-aware manifests given its the new default, so lowering this new MSRV risk in the long run (:crossed_fingers:). Whereas the upward creep risk will still remain unless checked with something like this patch. |
I'm confused -- this patch seems to introduce a bunch of upward creep, which otherwise wouldn't happen. |
Upward creep on the transitive dependencies, but not the direct dependencies. So the issue this patch is fixing is like how |
This will constantly increase as the deps release new versions, until finally they lie about their MSRV and our build breaks. I don't want them to change. |
* Standardizing the minimal versions of `serde_json` and `serde_test` in the workspace. This allows the unstable "direct-minimal-versions" flag of cargo to be used since it requires one minimal version in a workspace. Since these are all dev dependencies (including the fuzz crate) there shouldn't be any change for external consumers. * Update serde's contraint to the minimum version which the workspace has been using due to implicit upgrades. Attempts were first made to see if 1.0.103 could be used, but at the very least, would require a fair amount of lint settings to be overridden due to the old code. * Arbitrary 1.4.0 does not work with the current 1.63.0 MSRV due to some core::error usage.
Adding the unstable direct-minimal-versions flag insteaf of relying on just "cargo check" to conservatively upgrade the minimal versions lockfile. The issue with "cargo check" by itselft is that any version downgrades of direct dependencies are not automatically reflected in the lockfile. They would have to be hand set by developers. The direct-minimal-versions flag of cargo does this for us, overriding just that aspect of the conservative resolver of check.
098541f to
346a472
Compare
Heh, you have me beat on the ecosystem pessimism (for now), but I get it. Unfortunately I think I have exhausted cargo flag combinations. I momentarily had myself convinced I could combo I have arrived at your conclusion that each flag is a little off in its own special way. Maybe there is a more complex approach to analyze the lockfile itself, but not sure if worth it at that point. |
|
Have run out of ideas on this one for now, here is a summary of the attempts and why they don't satisfy. The goal is to (1) enforce that minimal versions of direct dependencies constraints are exercised in CI, but (2) without allowing transitive dependencies to upgrade automatically which introduces breaking risks to the workflow.
|
|
Lol that they're going to remove the old broken flag and the new one is just as bad. The existing lockfiles originally I created manually by downgrading everything by hand, fwiw. |
I'm curious about this. I thought the most important thing is that we ensure that this builds for the stated MSRV. I'm missing some piece of information I think since it seems like there is a stricter constraint then just testing for MSRV here. |
|
"Does it compile" is table stakes. The point of Cargo-minimal.lock is that it's minimal. |
Is it not enough to try to compile with CI using the MSRV? If it fails to compile, maybe some crate made a mistake in the MSRV and then it would require intervention to downgrade. Is that why you are interested in keeping the "minimal" version numbers locked? |
FTR This is effectively correct, because there can only be one version of a dependency with the same major version. Annoyingly, if a dependency is mentioned at all it has to be in the lock file, so we can't have a lock file for each optional dependency. Thus if, e.g. |
…ency changes d39a8ac fix: add all optional feature dependencies (Nick Johnson) 328937a fix: build Cargo-minimal.lock with min deps (Nick Johnson) b75fa0b fix: upgrade deps for min version checks (Nick Johnson) Pull request description: Attempt two to close #4313 I first attempted to iron out dependency drift in #4330, but wasn't quite able to check all the boxes. I think I might have now though by just running the two cargo flags, `direct-minimal-versions` and `minimal-versions`, one after the other in the update lock file script. Running `direct` first checks for the issue where direct dependencies might be lying. And running `minimal-versions` after that forces all transitive versions down to their minimums, fixing any drift (can see this in the lock file change). We can trust that `minimal-versions` won't bump our own direct deps because we just checked them. The first commit is ironing out little issues required to use `direct-minimal-versions`. Essentially fixing manifests which are out of date and lying about the required version. The `serde` bump might be a large one, but I was running into an issue where it was pulling in an old `proc-macro2` which required a rust compiler option, `proc_macro_span_shrink`, that is no longer available. The second commit updates the lock file script to use the new flags and generates the new lock files. The third commit might be drop-able, but I found it kinda of strange that only the default features where being used to generate the dependency lock files. Now, granted, the rust-bitcoin dependency tree is so lean that it appears enabling all features doesn't add any new dependencies, but still makes me feel better for the future. ACKs for top commit: tcharding: ACK d39a8ac apoelstra: ACK d39a8ac; successfully ran local tests Tree-SHA512: 3f7f5dde71902ee55e1afd5d95c5d350de95ccbb145350efdaa5b940c3d17aed240f39fc77cb9de46fe98a04fd040c4e87f8d2ba2d602d415ad27720c4a0ff04
Strategy to close #4313.
The first patch has a handful of necessary dependency upgrades in order to use the
direct-minimal-versionsflag.serde_jsonandserde_testdev dependencies. Thedirect-minimal-versionsflag requires one version for all direct dependencies in a workspace.serde's minimal version explicit with1.0.156. I originally tried to make1.0.103work, but at the very least requires quite a bit of lint config tweaks to build that code. I never got1.0.103to actually work.arbitraryfrom1.4.0to1.4.1,1.4.0does not work with the1.63.0MSRV due tocore::error::Errorusage.The second patch has the tweak for generating
Cargo-minimal.lockwith direct dependency versions. In the linked issue, Kix suggests a CI check to make sure theCargo-minimal.lockfile isn't drifting. I don't think that would play nice with thedirect-minimal-versionsflag since transitive dependency updates would break CI. Another possibility is to just calculateCargo-minimal.lockon the fly in CI, but I assume having a checked in version is still desired by the maintainers.After running
just update-lock-fileswith the new strategy, there are only upgrades inCargo-minimal.lock. The upgrades are due to thedirect-minimal-versionsflag allowing transitive dependency versions to update like normal so that this workspace is not blocked from testing its minimal versions just because the minimal versions of a dependency are broken. No downgrades are listed becauseserdeandarbitrary, the two drifters, required upgrades to actually build addressed in the first patch.Calling out one potential pain-point to this strategy, as seen with the
serde_jsonandserde_testdev dependencies in patch 1,direct-minimal-versionsrequires just one minimum constraint definition per-dependency in a workspace. So all the crates in rust-bitcoin need to move in lockstep for each dep. This is more strict than it has been, but I think if a crate needs a dramatically different version of a dep, it might just be a good sign it should be moved outside of the workspace.Maximums?
Cargo-recent.lockcould be resolved with a more aggressivecargo update, where everything goes to its "max" version (minor and patch updates) given the constraints. This would test a wider window of direct dependency versions, but I do not know if it is in the original spirit of whatCargo-recent.lockwas meant to capture. Here are the changes if updated withcargo update.