-
Notifications
You must be signed in to change notification settings - Fork 212
Trivial consistency check #898
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.
Overall this looks great :D Since we're using crates_index anyway it would also be nice to redo
docs.rs/src/docbuilder/crates.rs
Line 64 in d40fb2c
pub fn crates_from_path<F>(path: &PathBuf, func: &mut F) -> Result<()> |
src/utils/consistency/data.rs
Outdated
impl std::fmt::Display for CrateId { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
std::fmt::Display::fmt(&self.0, f) |
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.
Maybe use std::fmt::{self, Display};
?
if !dry_run { | ||
failure::bail!("TODO: only a --dry-run synchronization is supported currently"); | ||
} |
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'm not sure we'd want to ever automate fixing this. Deleting documentation is hard to undo (we can rerun the build, but we'd have to notice and it would be broken 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.
A quick check against the prod-dump from april (with my index force reset back to then) shows 4159 releases of 1477 crates in the index that are not in the db, and 1482 releases of 1438 crates in the db that are not in the index. There's definitely more work to do before this could be run to fix stuff (mostly around improving queueing behaviour), but I think we can get to a point where it's safe enough to have a non dry-run version of this, and manually fixing the issues seems like it's too large.
log::info!("Loading data from database..."); | ||
let timer = std::time::Instant::now(); | ||
let db_data = | ||
self::db::load(conn).context("Loading crate data from database for consistency check")?; | ||
log::info!("...loaded in {:?}", timer.elapsed()); |
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, maybe we should add a context.time()
like rustc has ... https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/struct.Session.html#method.time
You had a couple |
90131d3
to
5c60883
Compare
Removed the |
5c60883
to
29f7e91
Compare
Checks just whether any crates/versions don't exist, but can easily be expanded with validation of other details.
29f7e91
to
306d1ed
Compare
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.
Looks good to me, since it only reports the changes we can fix any bugs in a follow-up PR.
Co-authored-by: Joshua Nelson <[email protected]>
part of #766