Skip to content

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

Merged
merged 9 commits into from
Jul 31, 2020

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Jul 28, 2020

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

Copy link
Member

@jyn514 jyn514 left a 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);
Copy link
Member

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.

Comment on lines 467 to 471
db::update_crate_data_in_database(
&*ctx.conn()?,
&name,
&index.api().get_crate_data(&name),
)?;
Copy link
Member

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 😆

@jyn514 jyn514 merged commit 15e702d into rust-lang:master Jul 31, 2020
@Nemo157 Nemo157 deleted the update-owners branch July 31, 2020 15:58
@Nemo157 Nemo157 mentioned this pull request Aug 8, 2020
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

Successfully merging this pull request may close these issues.

delete version doesn't remove the owner if there are no more releases with that owner
2 participants