Skip to content

Start requiring a reason for all yanks #2608

Open
@alexcrichton

Description

@alexcrichton

@wycats, @nikomatsakis and I have discussed recently the ability to yank a crate with a reason, and then whenever that yanked crate is compiled locally it will present the reason as a warning.

The intended use cases for this would be:

  • When a crate is fixed because it will be broken in the next version of the compiler (e.g. a soundness fix or bug fix) then the previous versions can be yanked and nudge users forward.
  • If a crate is fixed for a security reason, the old versions can be yanked and the new version can be suggested
  • If a crate is renamed (or perhaps deprecated) to another then the yank message can indicate what to do in that situation.

Technically, I believe this should be implemented through:

  1. Update crates.io to accept an optional message for yanks. Store it in the database.
  2. Update cargo yank to require a message indicating why the crate is being yanked.
  3. Change the logic for when a yanked crate is compiled to something like:
    • Use whatever state the registry is currently in, do not update it.
    • Only issue a warning if the crate is compiled, not if it is "fresh" (e.g. has already been compiled).
    • When compilation starts, fire off an asynchronous HTTP request to crates.io to fetch the yank message.
    • Print out the warning whenever the HTTP request finishes or block the build finishing on these HTTP requests to return.
    • Ignore any errors that happen fetching the yank message, they should not fail the build.

I think this should suffice as an "opportunistic nudge" for these situations where possible, although it's certainly no form of ironclad guarantee.

Thoughts @wycats, @nikomatsakis?

Metadata

Metadata

Assignees

Labels

A-interacts-with-crates.ioArea: interaction with registriesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-yankS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions