bug: project name conflict is possible when user deletes their account and re-registers
This is an edge case.
Describe the bug
When a user deletes their account using the browser (ie not using the minder CLI) and a few minutes later re-registers using the minder cli, then their registration will fail because a project with the same name already exists.
Why does this happen? When a user deletes their account using the browser, mediator is not immediately notified of these changes. Mediator check for new deletion events every 24 hours, so it may take up to 24 hours for the user deletion to propagate to mediator data. If a user creates a new account before the deletion is propagated, then their project (named after their username) will still exist and cause a conflict when attempting to create it again. Note that the user will not inherit their old projects (or any other data) after their account has been deleted, because Keycloak creates a new user identified on every registration (even if it's the same user re-registering).
To Reproduce Steps to reproduce the behavior:
- Register a new user account using
minder auth login - Delete account page from the browser, either by navigating to the account page, or by using one of the browser based apps
- Re-register the user using
minder auth login - There will be an error because the project with user's username already exists
Expected behavior The user should be allowed to re-register immediately after deleting their account.
@eleftherias I think this can be closed now, can't it? I haven't seen this issue for quite some time and we did a bunch of fixes in the area.
This issue is specifically when someone deleted their account outside of Minder, e.g. from Trusty. Minder has a chron job that queries Keycloak for deletion events, but the chron runs once a day, so it can take Minder a full day before it cleans up the deleted users project.
@rdimitrov -- did you just fix this?
@rdimitrov -- did you just fix this?
Accidentally, yes 😃
I mean with the fix in https://github.com/stacklok/minder/pull/3815 this shouldn't happen since in case of a conflict we'll try with another unique project name.
So even though the reason for this conflict is different than what motivated my fix, I think we can consider this issue fixed by https://github.com/stacklok/minder/pull/3815.
Fixed by https://github.com/stacklok/minder/pull/3815