@@ -94,11 +94,14 @@ pub async fn delete_crate(
94
94
let msg = format ! ( "only crates with less than {DOWNLOADS_PER_MONTH_LIMIT} downloads per month can be deleted after 72 hours" ) ;
95
95
return Err ( custom ( StatusCode :: UNPROCESSABLE_ENTITY , msg) ) ;
96
96
}
97
+ }
97
98
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) ) ;
102
105
}
103
106
104
107
let crate_name = krate. name . clone ( ) ;
@@ -491,11 +494,9 @@ mod tests {
491
494
492
495
#[ tokio:: test( flavor = "multi_thread" ) ]
493
496
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 ;
496
498
497
499
publish_crate ( & user, "foo" ) . await ;
498
- adjust_creation_date ( & mut conn, "foo" , 73 ) . await ?;
499
500
500
501
// Publish another crate
501
502
let pb = PublishBuilder :: new ( "bar" , "1.0.0" ) . dependency ( DependencyBuilder :: new ( "foo" ) ) ;
@@ -504,7 +505,7 @@ mod tests {
504
505
505
506
let response = delete_crate ( & user, "foo" ) . await ;
506
507
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"}]}"# ) ;
508
509
509
510
assert_crate_exists ( & anon, "foo" , true ) . await ;
510
511
0 commit comments