Skip to content

Allow feature flag checks to read default_enabled value from YAML

Fabio Pitino requested to merge read-feature-flag-default-enabled-from-yaml into master

Problem

Today when checking if a Feature Flag is enabled we need to pass the default_enabled: true/false to the enabled? method all the time. When changing the default behavior from default_enabled: false to default_enabled: true we have to change it in every occurrence in the code.

What does this MR do?

Related to #30228 (closed)

When default_enabled: :yaml is passed to the Feature.enabled? method we read the value from the YAML definition.

With this change we can use the YAML definition as a SSOT. Changing the default behavior would simply mean flipping the default_enabled in the YAML file, rather than at every occurrence in the code.

Future steps

This solution allows us to phase out the default_enabled: false parameter in Feature.enabled? method.

Once all new feature flags use default_enabled: :yaml and existing feature flags not passing the default_enabled: explicitly have been removed, we can change the default parameter to default_enabled: :yaml making the check Feature.enabled?(:my_feature_flag) to always read the default value from the YAML definition.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Kamil Trzciński

Merge request reports