Feature Flag
Also known as: feature toggle, flag
A feature flag is a runtime switch that changes behaviour without a deploy, separating release from deployment. Code ships dark, is enabled for a subset of users, and can be turned off in seconds — which makes rollback a configuration change rather than a redeploy.
Last reviewed · Part of the Architecture Glossary
In practice
Flags are not one thing, and conflating the kinds is what makes them rot:
| Kind | Lifetime | Owner |
|---|---|---|
| Release toggle | Days to weeks — delete after rollout | The shipping engineer |
| Experiment flag | The length of the experiment | Product / data |
| Ops toggle (kill switch) | Permanent | On-call |
| Permission / entitlement | Permanent | Product — this is not really a flag, it is a feature of the plan model |
Hygiene that keeps the count sane: an expiry date on every release toggle, a CI check that fails on flags older than 90 days, and removal of the flag in the same pull request that makes the behaviour permanent.
Testing matters more than teams expect. Two flags produce four code paths; ten produce a thousand. Test the combinations that will actually ship — current production state and the target state — and treat the rest as a reason to keep the flag count low.
When it matters
Trunk-based development, incremental migrations, risky changes to a hot path, and anything where the business wants to choose the launch moment.
Common mistake
Leaving them in. A codebase with 200 live flags has 200 untested branches and no one who can say what the production configuration means. Deleting a flag is part of shipping the feature, not a cleanup task for later.
See also
- Canary ReleaseA canary release routes a small fraction of production traffic to a new version, compares its error and latency metrics against the stable version, and promotes or rolls back based on the result.
- Trunk-Based DevelopmentTrunk-based development is the practice of integrating every change into a single shared branch at least daily, with short-lived branches measured in hours.
- Strangler Fig PatternThe strangler fig pattern replaces a legacy system incrementally: a facade routes traffic, new functionality is built alongside the old, and routes are cut over one at a time until the original can be removed.
- Blast RadiusBlast radius is the extent of damage a single failure or change can cause — how many users, tenants, regions or services are affected when one component fails.