@@ -94,11 +94,14 @@ pub async fn delete_crate(
9494 let msg = format ! ( "only crates with less than {DOWNLOADS_PER_MONTH_LIMIT} downloads per month can be deleted after 72 hours" ) ;
9595 return Err ( custom ( StatusCode :: UNPROCESSABLE_ENTITY , msg) ) ;
9696 }
97+ }
9798
98- if has_rev_dep ( & mut conn, krate. id ) . await ? {
99- let msg = "only crates without reverse dependencies can be deleted after 72 hours" ;
100- return Err ( custom ( StatusCode :: UNPROCESSABLE_ENTITY , msg) ) ;
101- }
99+ // Temporary hack to mitigate https://github.com/rust-lang/crates.io/issues/10538: all crates
100+ // with reverse dependencies are currently blocked from being deleted to avoid unexpected
101+ // historical index changes.
102+ if has_rev_dep ( & mut conn, krate. id ) . await ? {
103+ let msg = "only crates without reverse dependencies can be deleted" ;
104+ return Err ( custom ( StatusCode :: UNPROCESSABLE_ENTITY , msg) ) ;
102105 }
103106
104107 let crate_name = krate. name . clone ( ) ;
@@ -491,11 +494,9 @@ mod tests {
491494
492495 #[ tokio:: test( flavor = "multi_thread" ) ]
493496 async fn test_rev_deps ( ) -> anyhow:: Result < ( ) > {
494- let ( app, anon, user) = TestApp :: full ( ) . with_user ( ) . await ;
495- let mut conn = app. db_conn ( ) . await ;
497+ let ( _app, anon, user) = TestApp :: full ( ) . with_user ( ) . await ;
496498
497499 publish_crate ( & user, "foo" ) . await ;
498- adjust_creation_date ( & mut conn, "foo" , 73 ) . await ?;
499500
500501 // Publish another crate
501502 let pb = PublishBuilder :: new ( "bar" , "1.0.0" ) . dependency ( DependencyBuilder :: new ( "foo" ) ) ;
@@ -504,7 +505,7 @@ mod tests {
504505
505506 let response = delete_crate ( & user, "foo" ) . await ;
506507 assert_eq ! ( response. status( ) , StatusCode :: UNPROCESSABLE_ENTITY ) ;
507- assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"only crates without reverse dependencies can be deleted after 72 hours "}]}"# ) ;
508+ assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"only crates without reverse dependencies can be deleted"}]}"# ) ;
508509
509510 assert_crate_exists ( & anon, "foo" , true ) . await ;
510511
0 commit comments