Comments (9)
Hi @bkeepers, I agree there's not much we can do for flipper to work around this issue. I don't have any suggestions.
For others that may see this problem, I worked around this issue by setting require: false
in the Gemfile for json_expressions
:
group :test do
gem 'json_expressions', require: false
end
And instead manually load it in the rails_helper.rb
AFTER rails is loaded:
require 'json_expressions/rspec'
from flipper.
Hi @dannyy83, you're actually running into an issue with the strict adapter, introduced in #763. I'm guessing you're running Flipper 1.1? In 1.2 we disabled the strict adapter in tests because people were running into this issue. So you can either upgrade to 1.2 or manually disable it per the directions in the 1.1 release notes (see https://github.com/flippercloud/flipper/releases).
Let me know if that doesn't fix it for you.
from flipper.
Hi @bkeepers, I'm seeing this with the following environment:
flipper v1.2.2
flipper-redis v1.2.2
rails v7.1.3
rspec v3.13.0
ruby v3.3.0
My configuration for flipper is:
require 'flipper'
require 'flipper/adapters/redis'
Flipper.configure do |config|
config.default do
client = Redis.new(url: 'some_url')
adapter = Flipper::Adapters::Redis.new(client)
Flipper.new(adapter)
end
end
I have no explicit flipper configuration in rspec, except for what's being automatically pulled in from https://github.com/flippercloud/flipper/blob/main/lib/flipper/test_help.rb
from flipper.
@bkeepers I've also tried to configure flipper as follows (as here https://www.flippercloud.io/docs/adapters/redis)
require 'flipper/adapters/redis'
And I still have the same issue.
from flipper.
I've also tried to disable the strict adapter as suggested:
Rails.application.configure do
config.flipper.strict = false
end
And this has no effect.
from flipper.
Also, here is the stack trace of the error being raised:
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/adapters/strict.rb:44:in `assert_feature_exists'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/adapters/strict.rb:24:in `get'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/adapters/memoizable.rb:58:in `get'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/feature.rb:279:in `gate_values'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/feature.rb:110:in `block in enabled?'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/feature.rb:436:in `block in instrument'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/instrumenters/noop.rb:5:in `instrument'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/feature.rb:433:in `instrument'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/feature.rb:107:in `enabled?'
# /usr/local/bundle/gems/flipper-1.2.2/lib/flipper/dsl.rb:36:in `enabled?'
from flipper.
Hi @bkeepers. I've done some more investigation on this, and tracked down the root cause of this problem to https://github.com/flippercloud/flipper/blob/main/lib/flipper/engine.rb#L71
I'm not sure why, but the call to flipper.strict
returns the ActiveSupport::OrderedOptions
instance, instead of the value of the :strict
key (which is false
). So, the Strict adapter is being used.
To be more explicit, If I set a breakpoint on the above line, you can see:
> flipper.strict
=> {:env_key=>"flipper", :memoize=>true, :preload=>true, :instrumenter=>ActiveSupport::Notifications, :log=>true, :cloud_path=>"_flipper", :strict=>false, :test_help=>true}
> flipper.strict.class
=> ActiveSupport::OrderedOptions
# But, interestingly
> flipper.dig(:strict)
=> false
from flipper.
I've finally tracked down this problem...
In our test env, we also use the json_expressions
gem (https://github.com/chancancode/json_expressions).
This gem adds a strict
method to Hash
and Array
which returns a clone and unfortunately this method is called when flipper is initializing in our test env, which is truthy, causing strict mode to be enabled.
from flipper.
@dannyy83 wow, that's a fun one. I'm glad you figured it out! I'm not sure there's much we can do in flipper to work around that, but I'm open to suggestions if you have ideas.
from flipper.
Related Issues (20)
- cannot load such file -- flipper/model/active_record (LoadError) HOT 13
- mysql - BLOB/TEXT column 'value' used in key specification without a key length HOT 6
- KeyError: key not found: true in strict mode HOT 2
- Sync error with flipper cloud HOT 9
- Error when running migrations with Flipper and Strong Migrations HOT 1
- Inconsistency - custom description, banner_text uses `Sanitize` but actor names is fully escaped HOT 2
- How to handle strict adapter with test? HOT 1
- (1.2) uninitialized constant Flipper::CLI::IRB (NameError) HOT 5
- (1.2) `Flipper::TestHelp` initializer raises an error if enabled HOT 3
- RSpec/Rails Issues with 1.2.1 HOT 1
- Feature flag not being enabled in RSpec specs on 1.2.1 HOT 7
- Flipper 1.2.2 breaks my CI HOT 7
- Loading all actor identifiers into memory isn't scalable HOT 8
- How to design a request-scoped per-actor flag state table? HOT 5
- Flipper Redis Adapter ignoring configuration block sometimes HOT 5
- Rails credentials read prevents Flipper from working on Rails < 5.2 HOT 2
- Flipper-active_record breaks in 0.26.2+ with Rails 4.2 HOT 2
- missing a template for this request format and variant. request.formats: ["text/css"] request.variant: [] HOT 2
- ActiveRecord adapter: unexpected error when running in a transaction HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flipper.