There's a draft that can't be deleted as a result of a SerialWork where the series was somehow deleted. It's not clear what caused this (possibly a race condition?), but it would be good to make sure that the SerialWork destroy callbacks can handle this case without throwing an error.
In order to test this, you need to delete a SerialWork with a missing series. The only way I know to do that is as follows:
Create a work.
Add a new series to that work.
Find the ID for that series.
Go into the rails console and call Series.find(id).delete.
View the work, press the "Edit" button, and then press "Delete Work."
Delete the series from the console:
ao3app@test-app12:~/app/current$ bundle exec rails c
Loading staging environment (Rails 126.96.36.199)
2.3.4 :001 > Series.find(63526).delete
=> #<Series id: 63526, created_at: "2019-01-01 08:49:25", updated_at: "2019-01-01 08:49:26", title: "AO3-5580 Test Series", summary: nil, series_notes: nil, hidden_by_admin: false, restricted: false, complete: false, summary_sanitizer_version: 0, series_notes_sanitizer_version: 0>
2.3.4 :002 > Series.find(63526)
ActiveRecord::RecordNotFound: Couldn't find Series with 'id'=63526
Pressed Edit on the work and got a 500 error loading https://test.archiveofourown.org/works/1068667/edit. /o\
I think the problem is calling delete on the series (thus leaving the Serial Work) means it’s still trying to load the series info for the form.
Back in the console, if I call destroy on the work, it works:
2.3.4 :003 > Work.find(1068667).destroy
UserMailer#delete_work_notification: processed outbound mail in 572.6ms
Sent mail to firstname.lastname@example.org (63.7ms)
I got the email and could open the attachment and everything.
I’d say this solves the issue of drafts not being deletable when the series is missing from the SerialWork, but the steps to reproduce have brought to our attention a different problem with the work form. I’m not sure the 500 error is something we need to spend out time fixing, though: afaik, we’ve never had a work that couldn’t be edited due to a SerialWork with a missing Series. (Seems plausible given we only ran into one draft with the problem.)
If we make a new issue for that, I’d suggest marking it lowest priority.
If the editing error hasn't come up for real users by now (and I'm sure if someone had a work that was stuck like that we'd hear about it), it seems like we can probably leave it be.