flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Possible to create multiple environments with the same name in a project

Open rolodato opened this issue 1 year ago • 0 comments

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:

image

image

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:

image

Steps To Reproduce

  1. Create a new environment within a project
  2. Give the environment the same name as the one you are cloning from
  3. 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:

  1. 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
  2. Keep all environment names as they are, and only prevent new duplicates from being created

Screenshots

No response

rolodato avatar May 27 '24 13:05 rolodato