Project deletion failed due to ForeignKeyViolation 'Key (author_id)=(10668043) is not present in table "users"'

An incident was raised because of errors caused by a couple of failing QA tests.

The errors were due to the tests trying to push to a project that didn't have a repository. The project should have been deleted previously and then recreated with a repository, but deletion of the project failed (after the repo was successfully deleted): https://log.gprd.gitlab.net/app/discover#/doc/AWNABDRwNDuQHTm2tH6l/pubsub-sidekiq-inf-gprd-002133?id=FqWncX4BQmwFm0mNCqmV

Deletion failed on gitlab-qa-sandbox-group/reusable_group/reusable_project with the following message: PG::ForeignKeyViolation: ERROR:  insert or update on table "events" violates foreign key constraint "fk_edfd187b6f"
DETAIL:  Key (author_id)=(10668043) is not present in table "users".

I don't know what could have caused that. The test attempted to delete the project via an API call DELETE /api/:version/projects/:id

Edited by Mark Lapierre