-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Strict adapter, introduce AdapterBuilder #763
Conversation
* strict: Remove kwarg for Strict handler, use arg or block
* origin/main: (88 commits) Lets see the body Temporarily put a bottom bun on the debug Show funding button Add free tier to UI Update readme Update readme Update readme Update gemspec so summary is up to date Rescue and log in post_to_pool too Minor shuffling of specs Minor reordering Make submitter a one time use thing Remove unused forwardable Move several cloud config bits to telemetry Simplifying cloud configuration options Minor formatting Update changelog Make reset private Remove unnecessary return Remove unused constants ...
* origin/main: protect against nil response
I tested this in an app that uses flipper cloud and here's the console: $ rails console
>> Flipper.enabled?(:nopenope)
Could not find feature "nopenope". Call `Flipper.add("nopenope")` to create it.
=> false
$ FLIPPER_STRICT=true rails console
>> Flipper.enabled?(:nopenope)
/Users/bkeepers/projects/flipper/lib/flipper/adapters/strict.rb:16:in `block in <class:Strict>': Could not find feature "nopenope". Call `Flipper.add("nopenope")` to create it. (Flipper::Adapters::Strict::NotFound) Default is warn, setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great.
My only concern is performance. As long as we doc heavily (add to optimizations) that people will want to use strict = false in production or we default to strict = false in production, it should be ok.
I don't think we want to look up all the features for every enabled? check. People with memoize and/or preloading off would definitely be hurt.
Good call. 443742b changes the default for production to |
What is the expected way to handle this in tests? Should I add all the features in a fixture or in an initializer file for flipper? It mentions this in the docs:
https://www.flippercloud.io/docs/guides/launch#add-feature-flags-to-your-app It makes it seem like just adding the conditionals like Could not find feature "deep_search". Call `Flipper.add("deep_search")` to create it. |
We need more guidance for tests, it's impossible for us to upgrade
Is not working in specs context. |
#760 adds a
Strict
adapter to warn when features don't exist. This configures it by default and sets it to:warn
for now. But we should change it to:raise
in test/development in 2.0.This also adds…
AdapterBuilder
There has never really been a good way to configure the Russian doll structure of adapters. Wrapping an adapter has required re-configuring the entire stack.
This introduces a
#use
method that can be used to configure adapters that wrap the primary storage adapter.TODO: