Skip to content
Maikel edited this page Aug 30, 2023 · 12 revisions

What are 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.

How to use OFN Feature Toggles

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:

Definitions

  • 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.

Configure toggling policies for a feature

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.

Enable a feature for an actor

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.

Enable a feature for a group

You can also enable a feature for a group of users. Simply select the group and add it.

Fully enable a feature

You can fully enable a feature by simply clicking the "Fully Enable" green button. It resets the previous configurations (actor, group) you've made.

Fully disable a feature

You can fully disable a feature by simply clicking the "Disable" green button. It resets the previous configurations (actor, group) you've made.

List of groups that can be assigned to a feature

  • admins: all the users that are admin (ie. have access to the admin backoffice)

Other useful bits

Notes of the retro we did on 2021-03-29 about the use of toggles while implementing Unit Prices.

Clone this wiki locally