Skip to content

Expressions #557

Open
Open
@jnunemaker

Description

@jnunemaker

I'll try to communicate more soon. But the tldr is @orderedlist, @bkeepers and I are working on a new feature (for www.flippercloud.io and open source) we're calling "rules" (branch). This issue is just so we can keep track of the work together on the open source side.

ActiveRecord Migration

Those using the flipper-active_record adapter will want to migrate the database so it can store JSON expressions:

$ rails generate migration change_flipper_gates_value_to_text
  def up
    change_column :flipper_gates, :value, :text
  end

  def down
    change_column :flipper_gates, :value, :string
  end

TODO

  • Support single Rule
  • Support multiple rules through And rule
  • Support multiple rules through Any rule
  • Refactor from_hash and other case statements
  • Get all specs and tests passing
  • Add enable_* and disable_* methods to Flipper, Flipper::DSL and Flipper::Feature
  • Add Rule equality like == and eql?
  • Make real ruby classes for types in left, operator and right
  • Add examples for Rule, Any, and And
  • Make all types consistent in capitalization (currently Condition and property, string, etc.)
  • Add rule shortcuts to make it easier to use them
  • Add new shared adapter spec(s) to shared adapter tests
  • Update feature synchronizer to include :json/rules
  • Update api docs
  • Update gate docs
  • Error in AR/Sequel if value column is not text
  • Add Flipper.add_rule and Flipper.remove_rule for easy adding and removing
  • What about floats? Should we use number instead of integer as the type and support floats? Or add float as type?
  • Document AR/Sequel migration to convert value from string to text

After releasing beta

  • Enforce types for operators. in requires array on right. percentage requires string on left and integer/number on right, etc. Make this easy to pass to javascript front end for @orderedlist.
  • Enforce string, number, null, boolean, etc. or array of former for flipper_properties somehow (maybe skip invalid and warn to avoid blowing up? or blow up in dev but skip in prod?)
  • Ensure that time based enablements are easy (enable when now epoch > int or now > date time)
  • Make it possible to enable/disable rules in flipper-ui
  • Make it possible to enable/disable rules in www.flippercloud.io
  • Update readme to include rules

Someday

  • Make it easier to work with date/time for scheduled releases (things like "enabled if Monday-Friday 9am-5pm)", just an and expression with day of week and time of day extraction that do gt, gte, lt, lte comparisions, etc.)
  • Make it possible to do repeating time based enablements (enable if M-F 9a-5pm, etc.)
  • Deprecate all existing gates in favor of rules with examples on how to migrate
  • Add feature type that passes actor and checks enabled? so you can do stuff like feature dependencies

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions