flagsmith
flagsmith copied to clipboard
Possible to create multiple environments with the same name in a project
How are you running Flagsmith
- [ ] Self Hosted with Docker
- [ ] Self Hosted with Kubernetes
- [X] SaaS at flagsmith.com
- [ ] Some other way (add details in description below)
Describe the bug
Two environments with the same name in the same project can only be distinguished by their ID, which is not human-readable. This is error-prone and can lead to data loss by accidentally deleting the wrong environment.
For example, it's impossible to tell these environments apart:
When deleting an environment, we make users type the target environment name to confirm they are deleting the correct one, but this is not enough to identify it:
Steps To Reproduce
- Create a new environment within a project
- Give the environment the same name as the one you are cloning from
- You now have two environments with the same name
Expected behavior
Trying to create an environment with the same name within a project should fail with a 400 error.
I see two possible solutions:
- Deduplicate environment names within projects by renaming them, e.g. add
(1),(2), etc suffixes to duplicates based on when they were created, and then enforce this unique constraint at the model/database level - Keep all environment names as they are, and only prevent new duplicates from being created
Screenshots
No response