-
-
Notifications
You must be signed in to change notification settings - Fork 725
Feature toggles
Feature Toggles enable new and experimental features for only a few users or one server at a time. It’s a technique in software development that attempts to provide an alternative to maintaining multiple branches in source code (known as feature branches), such that a software feature can be tested on production even before it is completed and ready for release. It also means that code can be merged faster on bigger features without impacting existing users.
Flipper is a small tool with its own UI that we use to manage feature toggling and that can be configured at instance level. The UI is enabled for admin users and can be seen at /admin/feature-toggle
. Examples:
- https://staging.openfoodnetwork.org.au/admin/feature-toggle/features
- https://staging.coopcircuits.fr/admin/feature-toggle/features
- https://openfoodnetwork.org.uk/admin/feature-toggle/features
-
Feature: A feature is a new behavior inside our application that is not totally released to all users. It is defined inside the OFN application. You can view all current features in the Flipper UI for admins (see above).
-
Group: A group is defined inside the OFN application: it is strictly linked to our code base. This can be seen as certain set of users that can share same characteristics. You can activate a feature to a group inside the Flipper UI. View the list of groups here.
-
Actor: An actor is usually the logged in user but it can also be an enterprise or something else. It depends on the feature what it defines as actor. It can also be activated for several types of actors so that you can first test it for a user, then an enterprise and finally for the whole instance. The feature description within the Flipper admin UI should tell you how it works.
A feature toggle can be enabled at three levels: actor, group and fully enabled.
NB: this document doesn't address the configuration by percentage, which is possible with Flipper.
It is possible to enable a feature for one (or many) actor inside the Flipper UI.
An actor is linked by its flipper id
. You need to know the type of actor and the actor's id
inside the database and join the two with a semicolon. For example, for a user with id 1 the flipper id is Spree::User;1
. And for an enterprise with id 3, the flipper id is Enterprise;3
. To activate a feature for a specific actor, go to the Flipper UI, select the feature and add add an actor by entering its flipper id
.
To find the id of a user, find it in the admin interface, click edit and view the URL. An enterprise's id is in the admin interface under Primary Details and called OFN UID.
You can add as many actors as you want to activate them the feature.
You can also enable a feature for a group of users. Simply select the group and add it.
You can fully enable a feature by simply clicking the "Fully Enable" green button. It resets the previous configurations (actor, group) you've made.
You can fully disable a feature by simply clicking the "Disable" green button. It resets the previous configurations (actor, group) you've made.
-
admins
: all the users that are admin (ie. have access to the admin backoffice)
Notes of the retro we did on 2021-03-29 about the use of toggles while implementing Unit Prices.
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
Instance-specific configuration
External services
Design