Use default_enabled state from YAML in GraphQL feature flag checks
Description
GraphQL queries are currently put behind a feature flag using the feature_flag
property which defaults to false.
Problem
When the default state of the feature flag is set to enabled, this causes an Feature::InvalidFeatureFlagError during the build.
Feature::InvalidFeatureFlagError: The `default_enabled:` of `runner_graphql_query` is not equal to config: false vs true. Ensure to update /builds/gitlab-org/gitlab/config/feature_flags/development/runner_graphql_query.yml
Proposal
Leverage the state defined in the corresponding feature flag's YAML file by passing default_enabled: :yaml
in places like Types::BaseField#visible?.
diff --git a/app/graphql/types/base_field.rb b/app/graphql/types/base_field.rb
index 47caf83eb1c..ce2f184bcb4 100644
--- a/app/graphql/types/base_field.rb
+++ b/app/graphql/types/base_field.rb
@@ -65,7 +65,7 @@ def constant_complexity?
end
def visible?(context)
- return false if feature_flag.present? && !Feature.enabled?(feature_flag)
+ return false if feature_flag.present? && !Feature.enabled?(feature_flag, default_enabled: :yaml)
super
end
the documentation says that Feature.enabled?
return false in production instead of raising an exception. This is also verifiable in the rails console:
Edited by Pedro Pombeiro