Add feature flag support with flipper #3408
This patch introduces the flipper gem, which satisfies all the requirements listed in #3407. I chose this over alternatives, because it's self-contained (no third party involved), works with ActiveRecord (keeping dev setup consistent), and does exactly what we want.
This will be used to turn on and off experiment features and roll out to a random 50% experiment group described in exercism/discussions#123.
For authentication, I imagine I could hard-code @kytrinyx and myself in production, but is there a more appropriate existing group?
I tested that nil is an acceptable flipper_id. Can't use alias_method for User#username, because it's an ActiveRecord field, and metaprogramming™.
- Refactor the Flipper::UI rack app builder into its own class. - Introduce global $flipper for convenient reference anywhere. This is an appropriate use of a global. It is thread-safe, because it is assigned only once at startup.
@kotp Are you referring to future flipper code for individual features—conditionals that test on feature flags? If so, that could be a reasonable way to keep track of that debt, yes. It's the conditionals for individual features that introduce the real code debt.
Or instead do you mean the flipper gem and code introduced in this PR? Since feature flags can be useful beyond the scope of my experiments (e.g. for future experiments you may want to run, or for frequent integration of long-running branches to reduce conflict), I suggest that we keep Flipper around. It doesn't introduce any complexity on its own.
This issue, as reference in the changes.