Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 4 tasks
rolodato opened this issue May 27, 2024 · 2 comments
Closed
1 of 4 tasks
Assignees
Labels
api Issue related to the REST API bug Something isn't working

Comments

@rolodato
Copy link
Member

How are you running Flagsmith

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • 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

@matthewelwell
Copy link
Contributor

As per the solution in #5038 , I think we should go with option 2 (at least for now) from the above since environment names are also used to e.g. tag data entities in other platforms that we integrate with.

@matthewelwell
Copy link
Contributor

Resolved in #5058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants