-
Notifications
You must be signed in to change notification settings - Fork 600
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
Add rust-version
field to the database and index
#6267
Conversation
Few things that need to be done that I forgot about:
|
Fixed the tests. Did not end up storing |
since this is a significant change to the index and to the publish metadata I'm wondering if an RFC for this would be useful. once it's added to the index it would be hard to remove again so it might be valuable to get some up-front thoughts on this change before we implement it. /cc @epage |
While I've not followed past index changes, I'm a bit surprised by this. In part its because somehow I got the impression that adding manifest fields to the index was a more straightforward thing and was more driven by the cargo team than crates.io. Granted, showing this field in the frontend would be great! Also in part its not clear to me what this would gain from the RFC process. The field for I could see feeling this should be bundled in the RFC that will use this field but I feel this change would be valuable to have before then to experiment with what behavior we want to put through RFCs and change proposals. This would be similar to how the compiler team implements some unstable features before writing an RFC. While this subset of the work would be insta-stable, I feel like we are confident enough in the value and design to go forward with that. We also wanted this done ahead of that RFC / change-proposal work so the Index would start to have some real world data for us to use in evaluating the designs. I can definitely see doing either a T-cargo or T-crates.io (or both) FCP on this PR as a check on all of this of course. |
sounds like a reasonable proposal. I just felt a bit uneasy about just merging this without the relevant teams being aware and agreeing to the change :) |
@cassaundra Turbo87 and I hashed this out in DMs. We'll be running informal FCPs among both T-cargo and T-crates.io. We'll get back to you with the results. |
one thing that came to my mind today is whether we can mark this new field as experimental for now in:
that way we can clearly communicate that this field might be removed again if it turns out that it isn't useful after all. once the resolver is successfully using it we can still stabilize it together with the stabilization of the resolver feature. |
Once cargo starts publishing to this field, we won't be able to remove it. |
why not? |
also, now that I think about it, why don't we read the |
We can remove the field from the index itself but we will always have to deal with old cargo versions posting the rust-version. I also see this unlikely.
Also, as an update, the cargo team is at 5 yes and 2 who haven't responded yet (one is on vacation) |
That would require us to download all |
sorry, I meant: why don't we (the crates.io server) read the rust-version field directly from the Cargo.toml file in the .crate file instead of relying on the metadata that cargo sends to crates.io? we would still save the field in the index, but we wouldn't need to change cargo to send us the value in the publish metadata. |
The main advantage I see to extracting it directly is we'd immediately get support for cargo 1.54+ rather than 1.72+. imo while this means we don't have any compatibility issues for considering this field experimental, I see that as an aside as I don't think the cargo team is treating it as such. We'd likely still need to validate the field (while cargo verified it, do we trust that the uploader was cargo?). This means we'd need to do it synchronously rather than asynchronously so we can report the error to the user. What is the limit on how much synchronous processing crates.io should do before pushing this off into the queue? This also runs into the tech debt issue of "which change has to pay for it". The first time we do this, it will be a larger effort that each individual request seems too trivial to justify it. Something that limits the pay off of doing this work is that not all fields can be trivially understood from the manifest. For example, cargo does not auto-populate the various inferred |
absolutely, though in the long-term I'd like to completely get rid of the metadata and rely only on the data in the
not just that, but if we can read it from the
if we can limit it to just reading the
yeah, that part is definitely a bit more tricky. how do you infer those fields? just by looking if a |
427d874
to
4039572
Compare
I am in support of reading the data from the |
4039572
to
5525fc1
Compare
Finished rewriting the first implementation so that it now extracts the information from the tarball. I find it a bit weird having a single exception for the field, but I'll leave that to others to decide. (edit: not complaining though, would be happy to migrate the rest of them after this!) |
ee48fda
to
523c14d
Compare
523c14d
to
ef88249
Compare
You have to start somewhere when transitioning designs / tackling tech debt. Its easy to say "it should be clean; let's do it all at once" but that makes the upfront cost extremely high, making it more likely to be pushed off. Each time it gets pushed off, the amount of code using the old design grows, increasing the cost. By doing this small amount, we are opening the door for new work to use this design and for us to retrofit old work to it as well. |
To back up @epage's point above, I'm literally prototyping some security-oriented work this week that is also going to have to extract information from the tarball, so this probably won't be a single exception for very long. |
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.
That ended up being fairly small of a change (once its all figured out)
rust-version
field to the database and index
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.
I've split up the single commit into a couple more to make the review a bit more straight-forward, but overall this looks good to me. nice work! :)
docs(ref): Specify 'rust_version' in Index format See rust-lang/crates.io#6267
This was added to the index in rust-lang/crates.io#6267. crates.io is automatically injecting it into the index, even without using the nightly cargo that supports it. My plan is to use this to make cargo-upgrade more MSRV aware (in version reqs despite the resolver not yet being MSRV aware).
Add
rust-version
to the index to open the way for experimenting with MSRV policies like an MSRV-aware resolvers (see rust-lang/cargo#9930 ).I have also prepared a patch for
cargo publish
which includes this metadata in publish requests.This change is fully backwards compatible with existing metadata in the index as well as older
cargo
clients which do not have the publish patch applied.CC @epage