featureflag: Ensure to only contain valid characters
Name of a feature flag must contain at least 2 characters. Can only contain lowercase letters, digits, and '_'. Must start with a letter, and cannot end with '_'.
Feature flag name would be used to construct the corresponding metadata key, so:
- Only characters allowed by grpc metadata keys can be used and uppercase letters would be normalized to lower, see https://pkg.go.dev/google.golang.org/grpc/metadata#New
- It is critical that feature flags don't contain a dash, because we convert dashes to underscores when converting a feature flag's name to the metadata key, and vice versa. The name wouldn't round-trip in case it had underscores and must thus use dashes instead.
The updated rules are inspired by GitLab feature flag naming constraint:
Edited by Xing Xin