Skip to content

Conversation

@Vicentecorrea
Copy link

@Vicentecorrea Vicentecorrea commented Nov 13, 2025

Hello everyone! 👋

I want to present a possible solution to the issue #514: a good way of explicitly enabling a feature with exceptions.

(It's just a draft PR to show my idea; it doesn't have any tests or documentation yet. If we decide to go ahead with this implementation, I'll do those stuff.)

Idea

My idea is to create blocking gates, and to check if a feature is enabled, there must be at least one open gate (as usual) AND no blocking gates.

  • This implementation is backward compatible: is independent of 'disable' actions, and if you don't block things, Flipper keeps working just like always.
  • No adapter changes are needed.

Example

We have four users: two men Pepe and Juan, aged 15 and 79, and two women Mari and Cata, aged 18 and 22.

user_struct = Struct.new(:age, :sex, :flipper_id)

pepe = user_struct.new(15, 'M', 'pepe')
mari = user_struct.new(18, 'F', 'mari')
cata = user_struct.new(22, 'F', 'cata')
juan = user_struct.new(79, 'M', 'juan')

@users = [pepe, mari, cata, juan]

In our config/initializers/flipper.rb we have this:

Flipper.register(:teenagers) do |actor|
  actor.age.between?(13, 19)
end

Flipper.register(:women) do |actor|
  actor.sex == 'F'
end

We will enable and block actors and groups, and after each action, we will execute this method to check whether the :test feature is enabled or not for each user:

def check_users
  @users.map do |user|
    Flipper.enabled?(:test, user)
  end
end
blocking_ff3 drawio

At time 0, the feature is not enabled for any user. Then, at time 1, we enable the feature for the :teenagers group, and now the :test feature is enabled for Pepe and Mari. And so on.

It also works after fully enable a feature

Flipper.enable(:feat)
Flipper.block_actor(:feat, some_user)

Flipper.enabled?(:feat, some_user) # false
Flipper.enabled?(:feat, other_user) # true

User interface

I imagine the UI to be something like this:
Captura de pantalla 2025-11-14 a la(s) 11 59 30

@Vicentecorrea Vicentecorrea marked this pull request as draft November 13, 2025 03:52
@Vicentecorrea Vicentecorrea marked this pull request as ready for review November 17, 2025 11:43
@Vicentecorrea
Copy link
Author

hi @jnunemaker! can you review this? 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant