-
Notifications
You must be signed in to change notification settings - Fork 212
Update owner details more fully during build and add CLI command to trigger it #917
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
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.
The 'accidentally delete owners' issue should be fixed before merging. The rest are just nits.
Thanks so much for working on this!
@@ -167,6 +167,11 @@ impl<'a> FakeRelease<'a> { | |||
self.source_file("README.md", content.as_bytes()) | |||
} | |||
|
|||
pub(crate) fn add_owner(mut self, owner: CrateOwner) -> Self { | |||
self.registry_crate_data.owners.push(owner); |
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.
Hmm ... now I wonder if owners
should be a set instead. I guess it doesn't really matter either way since we're using UPSERT.
src/bin/cratesfyi.rs
Outdated
db::update_crate_data_in_database( | ||
&*ctx.conn()?, | ||
&name, | ||
&index.api().get_crate_data(&name), | ||
)?; |
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.
So, this is ok for now because it's just one or two crates. But when we automate this for the full consistency check, it should use the database dump to avoid spamming the crates.io API. @pietroalbini will not be happy if we make 300k requests in a day 😆
First two commits improve handling of owner details during a build, if an owners mutable details have been changed since the last time we got them they will be updated in the database, and if an owner has been removed from a crate the relationship will be removed.
Next three commits are cherry-picked from #898, they standardise the prefix handling into the config so that it's easier to correctly load the registry details outside of the
DocBuilder
.Final commit adds a CLI command to update the details for a specific crate from the registry API, so that we can solve requests like #158/#837 directly. New (renewed) and existing crates will be fixed automatically when they publish a new version, and doing a mass update of existing bad data should be part of #766, so this should be a temporary command just to solve the problem for users that request it.
fixes #900