Skip to content
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

Yanked versions shown as top choice by other sites #6946

Closed
nyurik opened this issue Aug 8, 2023 · 2 comments
Closed

Yanked versions shown as top choice by other sites #6946

nyurik opened this issue Aug 8, 2023 · 2 comments

Comments

@nyurik
Copy link

nyurik commented Aug 8, 2023

Current Behavior

The martin crate, currently at v0.8.7, at one point published a v1.0.0-alpha version that was later yanked. The crates.io web UI correctly shows the latest version, but other sites incorrectly use the versions[0] - first entry in the API response, which is still showing yanked alpha version. For example, popular shield.io site uses versions[0].license (see code) for detecting latest version.

I believe it would be better to sort versions array first by yanked status and then by version.

Relevant portion of the API response for https://crates.io/api/v1/crates/martin

{
  "versions": [
    {
      "created_at": "2021-10-18T13:32:02.600041+00:00",
      "num": "1.0.0-alpha.0",
      "updated_at": "2022-11-21T03:56:25.244956+00:00",
      "yanked": true
    },
    {
      "created_at": "2023-06-23T04:05:38.815265+00:00",
      "num": "0.8.7",
      "updated_at": "2023-06-23T04:05:38.815265+00:00",
      "yanked": false
    }
  ]
}

Expected Behavior

Sort versions first by yanked (ASC), and then by semver (DESC)

Steps To Reproduce

No response

Environment

No response

Anything else?

No response

@nyurik
Copy link
Author

nyurik commented Aug 8, 2023

See also badges/shields#9453

@Turbo87
Copy link
Member

Turbo87 commented Aug 9, 2023

we are sorting them by publish date. whether yanking matters or not is up for the client to decide but it should not be based only on the default sorting.

@Turbo87 Turbo87 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants