Flipper 1.3.0

Hello, fabulous feature aficionado. A new release of your favorite flipping gem is out. Grab the latest release by adding ~>1.3.0 to any flipper dependencies in your Gemfile:

gem "flipper", "~>1.3.0"
gem "flipper-active_record", "~>1.3.0" 
gem "flipper-ui", "~>1.3.0"
gem "flipper-active_support_cache_store", "~>1.3.0"
gem "flipper-api", "~>1.3.0"
gem "flipper-dalli", "~>1.3.0"
gem "flipper-moneta", "~>1.3.0"
gem "flipper-mongo", "~>1.3.0"
gem "flipper-redis", "~>1.3.0"
gem "flipper-rollout", "~>1.3.0"
gem "flipper-sequel", "~>1.3.0"

Explicit Actor Limit

The enable_actor  method was never designed to handle hundreds or thousands of actors. This is an explicit choice to make it easier to batch load data instead of performing individual checks for actors over and over.

We have always advised to avoid using enable_actor for more than 100 actors per feature, and now Flipper offers an explicit option to help prevent unexpected performance impacts (#847).

101.times { |i| Flipper.enable :some_feature Flipper::Actor.new(i) }
# LimitError: Actor limit of 100 exceeded for feature some_feature.
# See https://www.flippercloud.io/docs/features/actors#limitations

Enabling a feature for more than 100 actors will now raise an error

We don't advise it, but if needed, you can change this default by setting the actor_limit option:

Rails.application.configure do
  # Increase the actor limit (not recommended)
  config.flipper.actor_limit = 1000

  # or disable this check entirely (not recommended)
  config.flipper.actor_limit = false
end

Change actor_limit default

If you need support for large actor sets, ask us about the upcoming Flipper Pro gem.

UI updates

The flipper-ui gem got a minor makeover with an update to Bootstrap 5 and some changes to the navigation (#851, #853).

Before

After

You can also add your own nav items to the Flipper UI:

Flipper::UI.configure do |config|
  config.nav_items.insert 1, { title: "Custom", href: "/my/custom/path" }
end

Easier Adapter wrapping

Flipper is designed from the ground up to use adapters. Not only is feature flag data stored using adapters—such as the ActiveRecord adapter—you can also wrap the storage adapter to add caching, failover, or make your Flipper data read-only. Even the new actor limits are implemented as an adapter.

To make this pattern of wrapping other adapters easier, Flipper 1.3 adds  Flipper::Adapters::Wrapper, which can be used as a base class for an adapter that just wraps another adapter (#846). By default, all methods delegate to the wrapped adapter. Implement #wrap to customize the behavior of all delegated methods, or override individual methods as needed.

class MyNewAdapter < Flipper::Adapters::Wrapper
  # Override a speciific method to change its behavior
  def enable(feature, gate, resource)
    # custom behavior
    super # invoke wrapped adapter
  end

  # Override this method to customize the behavior of all delegated methods,
  # and just yield to the block to call the wrapped adapter.
  def wrap(method, *args, **kwargs)
     if some_condition?(method)
       yield # call original adapter method
    else
       # do something else
    end
  end
end

And then you can configure Flipper to use the new adapter:

# config/initializers/flipper.rb
Flipper.configure do |config|
  config.use MyNewAdapter
end

Read more about creating a new adapter.

Coming soon to a Flipper Cloud near you

Telemetry is now enabled by default (#836), so everyone using Flipper Cloud will start populating telemetry data for their feature flags. You know what that means? We're getting ready to release some of the new analytics features we've been working on.

Miscellany

As with every minor release of Flipper, there are a handful of other tweaks and improvments that don't make headlines.

  • Support Rack 3 by @danielmorrison in #828
  • Add ActiveRecord validations to mirror table NOT NULL constraint by @tmaier in #859
  • CLI: Use provided stdout/stderr streams by @bkeepers in #838
  • API Perf - Features#get by @jnunemaker in #843
  • Micro optimization for `#features` on ActiveRecord adapter by @bkeepers in #844
  • Cache Improvements by @jnunemaker in #848
  • Refactor shared adapter test by @bkeepers in #854
  • Fix tests by @pbstriker38 in #833
  • Fail specs if any output by @bkeepers in #834

View Full Changelog

New contributors

Thanks to @danielmorrison (#828), @pbstriker38 (#833), and @tmaier (#859), who all made their first contribution to Flipper in this release.

Sponsors

A big thanks to @PagerTree and @kdaigle for being monthly sponsors.

If your company uses Flipper, and Flipper Cloud is not a good fit, consider becoming a sponsor to invest in the software your business depends on and to help us make Flipper sustainable.