Skip to content

Latest Version of Crate Does Not Show For Alpha Versions #1144

Closed
@sunjay

Description

@sunjay

Example: https://crates.io/crates/turtle (example will work until I publish a non-alpha version)

Test case:

  • Have some 0.x.x versions (not sure if they need to be yanked or not to reproduce the problem, but in my case they were)
  • Release a 1.0.0-alpha.0 version (doesn't matter what number you put after the alpha)

Problem:
crates.io does not display the 1.0.0-alpha.0 version. If your 0.x.x versions are yanked, it will actually display:

CrateName 0.x.x

This crate has been yanked, but it is still available for download for other crates that may be depending on it.

You may wish to view all versions to find one that has not been yanked.

Viewing the other versions shows that there is a 1.0.0-alpha.0.

That means that it isn't finding that the latest version of the crate is 1.0.0-alpha.0 (possibly due to the -alpha.0 at the end). It still believes the 0.x.x versions are the latest.

Both cargo itself and docs.rs seem to work. If you use a "*" as your version, cargo will download the alpha correctly. If you just go to the crate URL on docs.rs, it'll redirect you correctly.


Instructions to fix added by carol:

  • This check that tries to find the latest stable version should find the latest stable NON-YANKED version instead. The version has a yanked boolean property accessible via version.get('yanked').
  • Create more tests similar to this test that set up a bunch of different situations:
    • All versions yanked should get the "all versions yanked" page
    • Has larger prerelease versions and non prerelease versions, all NOT yanked, the version recommended on the page should be the largest non prerelease version
    • Has only prerelease versions, the largest prerelease version should be recommended
    • (This issue) Has larger prerelease versions and non prerelease versions, all non prerelease versions yanked, the version recommended on the page should be the largest prerelease version
    • Has larger prerelease versions (say 1.0.0-alpha), a smaller non-yanked non-prerelease version (say 0.8.0), and a yanked non-prerelease version in the middle (say 0.9.0), the recommended version should be the non-yanked non-prerelease version
    • Any other test cases you think of that I haven't!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions