On this page

Managing Feature Gate lifecycles

Learn how to manage feature gates through different phases of their lifecycle - from testing to full rollout to cleanup and archival.

A feature can go through different phases throughout its lifecycle: it may be tested by a few users, recently rolled out to everyone, or stable enough that the toggle is no longer needed.

A feature gate should clearly reflect the phase the feature is in, for a few important reasons:

  • Prevent incidents: Avoid scenarios where old code for a deprecated feature is accidentally touched or repurposed. This has had real business consequences, as in how Knight Capital lost half a billion dollars.
  • Maintain a healthy codebase: Dead references to flags increase the volume of code your team navigates daily and can slow down new developer onboarding.
  • Reduce mental load: The feature gate catalog shows the status of every feature, so you can see at a glance what next steps are needed (for example, launch or end a feature) without tracking everything manually.

Managing feature gate lifecycles

Statsig makes it easy for your feature gates to reflect the phase your feature is in by using status. A gate can be in one of four statuses:

Feature gate status options interface

When to update feature gate lifecycles

There are 3 points throughout the gate's lifecycle when you should take action, either in the console or in your codebase:

Feature gate lifecycle workflow diagram

1) The gate has been fully rolled out or rolled back, and you are ready to skip rule evaluation and assign a default value

  • Go to the feature gate page and click the "..." menu in the upper right corner to select Launch or Disable:

    • In Progress → Launch: when the gate has been rolled out to 100% for a period of time (recommended: more than 30 days) and you are comfortable with the gate always returning TRUE.
    • In Progress → Disable: when the gate has been rolled back to 0% for a period of time (recommended: more than 30 days) and you are comfortable with the gate always returning FALSE.
  • To find all gates that are good candidates to be Launched or Disabled (rolled out to 100% or rolled back to 0% more than 30 days ago):

    • Go to Feature Gates catalog

      • Click on filter icon:
        • Status = In Progress
        • Pass Rate = 100% AND 0%
    • In the search bar: "Modified: <YYYY/MM-DD;" (update the date to be 30 days ago)

      Feature gates catalog filter interface

2) You are ready to clean up the gate reference from your codebase

Confirm that the gate has been set to either Launched or Disabled for a period of time (recommended: more than 60 days) to avoid unintentionally breaking rule evaluation and to confirm no negative impact on your metrics. After confirming:

  • Go to your codebase and:
    • For Launched gates: remove the gate reference, but keep the feature code as a permanent part of the codebase.
    • For Disabled gates: remove the gate reference and all code related to the feature.

Confirm that these gates aren't included in any active Holdouts before removing reference.

  • To find all gates that are good candidates to be removed from your codebase (Launched or Disabled more than 60 days ago):
    • Go to Feature Gates catalog

      • Click on filter icon: Status = Launched AND Disabled
      • In search bar: "Modified: <YYYY/MM-DD;" (update the date to be 60 days ago)

      Feature gates catalog with launched and disabled filter

3) After you have cleaned up the gate reference from your codebase

  • Launched or Disabled → Archived: Update the status to mark that the gate has been removed from your codebase. This filters the gate out of future cleanup candidate lists (step 2).

    • Go to the feature gate page and click the "..." menu in the upper right corner to select "Archive".
  • To find all gates that should be marked as Archived:

    • Go to Feature Gates catalog

      • Click the filter icon:
        • Status = Launched or Disabled
        • Checks = 0 checks in last 7 days or 30 days, depending on your comfort level

      Feature gates catalog with zero checks filter

Feature gate lifecycles FAQs

Was this helpful?