Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Conversation

@pavolum
Copy link
Contributor

@pavolum pavolum commented Oct 19, 2020

Description

This PR adds a feature flag implementation that allows developers to put preview and in development features behind configurable flags.

This PR consists of three groups of changes:

  • Lib workspace: Addition of shared feature flag utilities
  • Server changes: Addition of a controller and service to handle server side feature flag state management where applications featureFlagState is maintained in data.json.
  • Client changes: Addition of feature flag state (initialized on data.json values on app start) and dispatch, UI to toggle feature flags and server calls for maintaining parity with server side data,json feature flag state
  • documentation added to docs/internal directory

Adding a feature Flag

  1. Add a new FeatureFlag object to @bfc/shared: DefaultFeatureFlags.ts and indicate the name, description, default boolean value and type (hidden vs not hidden) of your feature flag
    • hidden attribute is used to indicate whether this feature can be turned on/off by the end user through Composer UI. I feature flag that has hidden: true does not get rendered for front end toggling and are configurable instead through env variables.
  2. Put any server or front end code behind the respective feature flag using provided feature flag utils.
    • For features that are added as front end react components a HOC is available that abstracts feature flag checking and renders children based on the current value of the provided featureFlagName.
      • i.e. <Feature featureFlagMap={featureFlagMap} featureFlagName="Show Tutorial"><NewFeature /> </Feature>
    • For features that are not integrated as react components a checkFeatureFlag util function is available
      • i.e. getFeatureFlagValue(featureFlagName, featureFlagMap)

Feature flag flow

User flow when working with feature flags:

  1. On app start
    • Current applications feature flag configuration is pulled from data.json.
    • Current application feature flag configuration adds and/or removes any feature flags that have been added/removed from defaultFeatureFlags.tsx since last app start
    • Front end feature flag state is initialized from the current applications feature flag configuration
  2. Changing Feature flag value
    • Front end feature flag state drives the UI in the application settings page where users can toggle the values of any given, non hidden, feature flag.
    • When the user toggles a feature flag value through the UI toggle (non hidden feature flags) or env variables (hidden feature flags) it triggers a change to front end and back end feature flag state.

Task Item

Current:
fixes #4291
fixes #4427
fixes #4426
fixes #4425

Screenshots

Electron app settings
image

Web app app settings
image

@pavolum pavolum marked this pull request as ready for review October 20, 2020 17:59
@hatpick
Copy link
Contributor

hatpick commented Oct 20, 2020

Are you planning to allow grouping on the feature flags (according to UX)?

… hook for filtered templates, replaced env variable featue flag with new feature flag
…ture flag hook for reuse, type and name fixes
@pavolum
Copy link
Contributor Author

pavolum commented Oct 23, 2020

Are you planning to allow grouping on the feature flags (according to UX)?

Not for the first implementation and design is okay with that. I will create a task for this in the R12 bucket for tracking

@pavolum pavolum closed this Oct 23, 2020
@pavolum pavolum reopened this Oct 23, 2020
@pavolum pavolum changed the title Pavolum/feature flags [feature] Adding feature flag infrastructure Oct 23, 2020
@pavolum pavolum changed the title [feature] Adding feature flag infrastructure feat: Adding feature flag infrastructure Oct 23, 2020
@coveralls
Copy link

coveralls commented Oct 24, 2020

Coverage Status

Coverage decreased (-0.2%) to 55.01% when pulling 7f5511f on pavolum/featureFlags into ff51727 on main.

@cwhitten cwhitten merged commit b534797 into main Oct 24, 2020
@cwhitten cwhitten deleted the pavolum/featureFlags branch October 24, 2020 16:27
@cwhitten cwhitten mentioned this pull request Nov 13, 2020
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* initial front end feature flag implementation

* Initial server implementation

* Converting state to object over array

* Cleaning up dev test changes

* created HOC to abstract feature flag checking for UI features. Changed feature flag toggle per new designs.

* Added feature flag value population for hidden feature flags via env variables

* Making PR changes: variable and file name changes, general clean up, simplifying types

* adding format message for feature flag strings

* moving ComposerFeature HOC to client workspace so it is implicitly aware of recoil state

* changed default feature flags to function for format message, created hook for filtered templates, replaced env variable featue flag with new feature flag

* adding selector for feature flag filtered template state, created feature flag hook for reuse, type and name fixes

* removing unneeded div

* Adding util functions and reusing hook in HOC

* Updating UI for electron and web view of feature flag toggle per design spec

* Added feature flag documentation

* removing unused imports and variables

* Updated unit tests, added build locale
 autogenerated file updates

Co-authored-by: Patrick Volum <[email protected]>
Co-authored-by: Chris Whitten <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

7 participants