Routes are not properly deleted when a user or group is deleted
We've seen at least 2 reports of this on GitLab.com
- Group deletion: https://gitlab.zendesk.com/agent/tickets/70731
- User deletion: https://gitlab.zendesk.com/agent/tickets/70705
In both cases the user removed the user or group with the intention of recreating it. On recreation they got errors that the route conflicted. I was able to see that the route was orphaned by finding the route in the Rails console and seeing that the source
relationship was nil, when it should have been pointing to the namespace object (which no longer existed). A quick destroy of the route enabled the users to recreate their user/group.
I see a dependent destroy for the route on the namespace model so I'm not sure how we're getting in this state. Something must be going wrong during the deletion of the namespace.