flipt icon indicating copy to clipboard operation
flipt copied to clipboard

[Bug]: UI blocks camelCase

Open snv opened this issue 1 year ago • 3 comments

Bug Description

The UI prevents me from using camelCase for keys or namespaces. When using gitOps i can use those without problems, so it seems like the UI imposes unneeded restrictions.

This prevents me from using the same keys and namespaces in an UI-controlled experimenting/dev-flipt-instance as in the gitOps prod-flipt-instance, or forces me to use the less readable keys in the gitOps-setup too.

Version Info

I'm running flipt in k8s from the helm chart flipt-0.53.1 which installed v1.37.1

Search

  • [X] I searched for other open and closed issues before opening this

Steps to Reproduce

  • Install flipt from helm chart with default settings and
  • try to create a key with camelCase in the 'New Flag'-Dialog

Expected Behavior

The UI should not enforce smallcaps spelling

Additional Context

No response

snv avatar Feb 20 '24 08:02 snv

Thanks for raising this @snv ! Sounds like some over-zealous yup schema in the input there. The server side rule for all backends (declarative and relational) has always been: https://github.com/flipt-io/flipt/blob/main/rpc/flipt/validation.go#L55 So camelCase should be acceptable.

GeorgeMac avatar Feb 20 '24 09:02 GeorgeMac

Not the yup schema but the onChange for this field is rewriting it without uppercase: https://github.com/flipt-io/flipt/blob/f9978cf13f7a1e1cdc1128802a5c7206a9726976/ui/src/components/flags/FlagForm.tsx#L174-L177

Here https://github.com/flipt-io/flipt/blob/main/ui/src/utils/helpers.ts#L26

GeorgeMac avatar Feb 20 '24 09:02 GeorgeMac

We appear to only use this in segment, namespace and flag creation and I believe in all situations upper-case is fine. So I think we can just drop the toLowerCase() call and that should sort it.

GeorgeMac avatar Feb 20 '24 09:02 GeorgeMac