-
Notifications
You must be signed in to change notification settings - Fork 212
Refactor CrateDetails: add yanked field to Release #560
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
Conversation
Merged #559, time for that rebase :) I'm looking in the meantime. |
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 started looking at this, but in the middle I discovered that we in fact show yanked crates as if they were normal crates. With that in mind, I think we should wait to refactor yanked crates until that's fixed: #561
This avoids doing an additional query to determine the last successful build.
This PR doesn't change the behavior of The current implementation will not show a |
Hmm, I suppose as long as there's no change in behavior it doesn't hurt to go ahead. Please do update the tests.
I think I got yanked versions mixed up with blacklisted versions before: yanked is by the user, blacklisted is by the infra team (docs.rs or crates.io). Sorry about that. |
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.
Once you add the new test cases, this looks good to me :) It's great how easy this is after all your other refactoring work.
When a crate is yanked from crates.io, its documentation might not yet be removed from docs.rs. So it is possible to create CrateDetails of a release that was build successfully but yanked afterwards. Since this release was built successfully, it will not have a reference to a last successful build. But since it was yanked, other release will not point to this release as last successful build.
I have added the asserts for yanked releases now. The test expose that the behavior is a bit funky right now... in this test But this seems like a fairly infrequent edge-case anyway. I assume when a crate is yanked, the library author would pretty quickly want to push an updated version.
No worries, it is pretty confusing 😅 |
That seems like the right behavior to me. Is there something you think we should do instead? |
No, I think it's okay for now. It feels inconsistent since we don't mention anything on the yanked release, but we'll address that with #561 :) |
This is another small refactor from working on #516.
Changes should be easier to check looking at them commit-by-commit.
Basically, the previous implementation had to query the database to determine the last successful build.
But most of the information needed is already present in
releases
. By also fetching theyanked
data intoRelease
we avoid doing an extra query.Additionally, the
yanked
field will be useful later to improvelatest_version()
, see the issues mentioned by #559 (comment).I will have to merge / rebase these changes on top of #559. But you can already take a look :)