Features behind flags that default to "on" cannot be disabled
Summary
Features behind feature flags that default to "on" cannot be disabled.
Steps to reproduce
- Choose a feature flag that defaults to "on", like
productivity_analyticsorproductivity_analytics_scatterplot_enabled. - Attempt to disable the feature with
Feature.disable. - See that the feature is still enabled.
Note: This happens whether you have previously run Feature.enable or not.
What is the current bug behavior?
The feature still appears after you call Feature.disable.
What is the expected correct behavior?
The feature disappears after you call Feature.disable
Relevant logs and/or screenshots
The Flipper gem is not compatible with feature flags that default to "on". At least with its ActiveRecord adapter, calling disable destroys the database record. When there is no record, the default applies. And for these features the default is "on". For Flipper to be compatible with feature flags that default to "on", it would need to modify the database record with a value of "false" instead of destroying it.
If you manually update the feature_gates record with a value of "false" (instead of calling Feature.disable) then the feature is hidden as desired.
Possible fixes
- Eliminate feature flags that default to "on" (easier)
- Revert feature flags that default to "on", to default to "off" (easier)
- Customize the Flipper gem, or our usage of it (harder)