The Friday-afternoon deploy
Every team that ships software knows the feeling. It is Friday afternoon, the release is ready, and the change touches checkout. The code has passed its tests and two people have reviewed it, yet it still feels like stepping onto a frozen lake. So the release waits until Monday, and Monday brings its own queue, so the change that was ready on Friday ships on Wednesday, three days stale, merged with three other changes nobody can separate any more.
Feature flags exist to break that pattern. A feature flag, also called a feature toggle, is a switch in the code that decides at run time whether a piece of behaviour is on or off. The code ships to production with the new behaviour switched off. Then, separately from the deploy, someone turns it on: for the team first, then for one percent of users, then ten, then everyone. If something goes wrong, they turn it off again. No new deploy, no rollback, no 2 a.m. rebuild. The deploy and the release become two different events, on two different schedules, and the Friday-afternoon fear mostly goes away.
That separation is the whole idea. Everything else in this article is detail around it, but the detail matters: flags used carelessly create a second codebase inside the first one, a tangle of old switches nobody dares to remove. Used well, flags are the closest thing software teams have to a seatbelt. Used badly, they are duct tape on the dashboard.
Deploy is not release
In most teams, "deploy" and "release" mean the same thing, because they happen at the same moment: the code goes live and users see the change. That coupling is the source of most release anxiety. The deploy is a technical event. The release is a business event. They have different risks, different audiences, and different rollback plans, and tying them together means every technical deploy carries the full weight of a product launch.
A flag breaks the tie. The deploy puts code on the servers. The release flips a switch. Between the two, the code sits dormant: deployed, tested in the real environment, invisible to users. That dormant period is valuable. The team can check that the code runs against real data, real traffic patterns, real database load, without any user ever seeing it. They can turn it on for their own accounts and click through it in production, where the data is real and the edge cases are the ones users actually hit, not the ones the test suite imagined.
It also changes how teams work together. With flags, a developer merges small pieces to the main branch every day, hidden behind a switch, instead of keeping a long-lived branch for weeks and merging it in one painful session. The flag, not the branch, controls who sees the work. The code is in production from day one. The feature is not.
There is a cost, worth naming early. Every flag is a fork in the code: two paths where there used to be one, and both need testing. A system with fifty flags has, in theory, an enormous number of combinations. In practice most flags are independent and nobody tests every combination, but the testing load is real and grows with every flag you add. Flags are a trade: you pay in complexity and testing effort, and you get back control over when users see a change and how fast you can take it away.
Four kinds of flag, four kinds of care
The most common mistake teams make with flags is treating them all the same. A switch that hides unfinished work is not the same kind of thing as a switch that turns off a payment provider during an incident, and managing them the same way causes trouble. Pete Hodgson, writing on Martin Fowler's site in 2016, sorted toggles into four kinds, and the split still holds up. The kinds differ in how long they live and how often the decision changes, and each kind needs different handling.
Release flags hide unfinished or unannounced work. They are short-lived by design: days, or a week or two at most. Once the feature is open to everyone, the flag should be removed. A release flag still in the code six months later is not a flag any more. It is a fossil.
Experiment flags split users into groups for an A/B test, sending each user down the same path every time. They live as long as the experiment needs data — hours or weeks. Change the split halfway through and the results stop meaning anything, so these flags must stay stable while they run, and be removed once the winning variant is made permanent.
Ops flags control how the system behaves in production. They turn off an expensive report, a chatty integration, or a new cache when the system is under strain. Most are short-lived, but a few stay for years as kill switches, which Hodgson described as a manually managed circuit breaker. Whoever is on call flips them, so they must change fast, without a deploy.
Permission flags decide who gets what: a beta group, a premium tier, one large customer. They decide per request, and they can live for years. A flag that gates a premium feature is not technical debt. It is the product, and it needs a product owner who will still be there next year.
The practical rule is simple: when you create a flag, say which kind it is, who owns it, and when it dies. A release flag gets a removal date the day it is created. An experiment flag gets an end date for the test. An ops flag gets an on-call runbook. A permission flag gets a product owner. If a flag has none of those, it will be forgotten, and forgotten flags are how a codebase fills up with switches nobody understands.
How a rollout actually runs
A sensible rollout has a shape, and the shape barely changes from team to team. The flag is created with the feature off. The code is deployed. The team turns the flag on for its own accounts and tests in production with real data. Then the rollout widens in steps: one percent of users, then ten, then twenty-five, then fifty, then everyone. Each step gets time to show its effects. A common rhythm is a day or two at each step for a feature that touches money or personal data, faster for a low-risk change to a settings page. The point of the steps is not caution for its own sake. It is that a problem affecting one percent of users is a bug report, while the same problem affecting everyone is an incident.
Two details make the steps work. The first is stickiness: a user who sees the new checkout on Monday must see the same checkout on Tuesday, so rollouts assign users by a stable hash of their user ID, not a random coin flip on each request. The second is measurement. Each step needs a dashboard and a decision rule written down before it starts: error rate, latency, conversion, whatever the feature is supposed to move. If nobody is watching the numbers, the steps are theatre.
There are two common patterns for choosing who gets the feature. In a ring deployment, named groups go first: staff, then beta users, then a region, then everyone. Rings are good when you want specific people to see the change, or when the feature only makes sense for one group. In a percentage deployment, a random slice of users gets the feature, and the slice grows. Percentages are good when you want an honest read on the effect, because a random slice looks like your whole user base. Many teams combine the two: rings first, then percentages for the rest. The LaunchDarkly release-management guide describes exactly this combination, and it is the default worth copying unless you have a reason not to.
One more habit separates good teams from the rest: they decide the rollback in advance. Before the flag goes to ten percent, someone writes down what would make them turn it off — an error rate, a latency number, a specific complaint — and who is allowed to make that call. In the middle of an incident, nobody wants to debate thresholds.
Testing with flags without lying to yourself
Flags change testing, and teams that ignore that pay for it in production. With a flag in the code, there are two versions of the feature alive at once: on and off. Both need to work. The tests need to cover both paths, and the test data needs to make sense for both. A team that only tests the new path will ship a flag that breaks the old one, and the old one is the path every existing user is on.
The test matrix grows with the number of flags, and there is no honest way around that. In practice teams test each flag on its own, on and off, plus the small number of combinations that actually interact — the new checkout with the new payment provider, say, rather than every possible pairing. They also lean on production itself: the staged rollout is a test with real users and real data, and the first small step is where the surprises show up.
There is a trap here worth naming. A flag can hide a broken feature from users, and that feels like safety, but the broken code is still in production, still running. A database migration behind a flag still runs. A background job behind a flag still consumes resources. The flag controls who sees the result, not whether the code executes. Dark launching — running new back-end behaviour for real users without them knowing — is a powerful technique, but it is a test, not a hiding place.
The other testing habit that matters is the default. Every flag evaluation should have a safe default for when the flag system cannot be reached: usually off, so the feature disappears rather than appearing unexpectedly. SDKs from the major flag platforms return the default when the service is down, and your code should be written to expect that. Test the default path too. Pull the network cable, in a manner of speaking, and check what the user sees. If the answer is a crash, the flag has made the system more fragile, not less.
Kill switches: the part that pays for itself
Every integration with an outside system deserves a kill switch. The payment provider, the recommendation service, the address lookup, the chat widget: each one is a dependency you do not control, and each one can fail in ways you cannot predict. A kill switch wraps that dependency and turns it off instantly, falling back to a simpler path — the old provider, the bestsellers list, or nothing at all.
The value of a kill switch is measured in minutes. Without one, a bad deploy or a failing dependency means a new deploy, a rebuild, a wait for the pipeline, and a nervous watch of the dashboards. With one, it means opening a dashboard, flipping a switch, and watching the error rate fall. One engineer described the moment plainly: she opened the flag dashboard, toggled one kill switch, and the system reverted to the stable path within seconds. The broken migration was still there, still deployed, just no longer live. That is the difference between an incident and a footnote.
Kill switches need practice. A switch nobody has flipped in a year may not work when it is needed: the fallback code may have rotted, the dashboard permission may have changed, the person on call may not know the switch exists. Good teams test their kill switches the way they test their backups — on a schedule, in production, with someone watching. Flip it, confirm the fallback works, flip it back. If the fallback is broken, you have found out on a Tuesday afternoon, not during an outage.
A kill switch should be a separate flag from the release flag for the same feature, even though that feels redundant. The release flag says "this feature is available". The kill switch says "this dependency is healthy". They change for different reasons, owned by different people. Merging them means the product manager launching a feature and the on-call engineer stopping a fire are fighting over the same switch.
Flag debt: the bill always arrives
The cost of flags is not paid when you create them. It is paid later, in the form of flag debt: old switches left in the code long after the feature shipped, each one a fork that future developers must understand before they can change anything nearby. A codebase with two hundred stale flags is a codebase where nobody can say what the software actually does, because the answer depends on a dashboard nobody has opened in months.
The fix is a lifecycle, enforced rather than hoped for. Every release flag gets a removal date when it is created, usually a month after full rollout. A weekly job lists flags past their date, and the list is reviewed like any other work, not left to whoever remembers. Some teams file a ticket automatically for any flag older than ninety days that is not a kill switch or a permission flag. The rule that works is the boring one: the flag is removed in the same sprint the feature ships, or it gets a ticket with an owner and a date. "Later" is not a date.
Removing a flag is a small, careful job: delete the switch, delete the dead path, keep the live one, and run the tests. It is also the job most often skipped, because it feels like tidying up. The teams that do it treat flag removal as part of shipping, not cleanup afterwards: the feature is not done until the flag is gone.
Choosing the tooling
A team starting out has three honest options, and the right one depends on size. The simplest is a configuration file or environment variable: a list of flag names and values, read at startup. It costs nothing, needs no service, and works for a small team with a handful of flags. Its limits are real — changing a value needs a restart or a redeploy, and there is no targeting by user — but for a side project or a small service, it is often enough. Do not buy a platform to manage three switches.
The second option is a self-hosted flag server. Unleash and Flagsmith are the two most widely used open-source choices, both with a dashboard, targeting rules, and SDKs for the common languages, including JavaScript. You run the server, you own the data, and you pay in operations time.
The third option is a managed platform such as LaunchDarkly, Split, Statsig or ConfigCat. You pay per seat or per usage, and in return you get targeting, percentage rollouts, experiment analysis, audit logs and integrations, without running anything. This fits a larger team, or one where product managers and non-engineers need to flip flags themselves.
Whichever you choose, write your code against OpenFeature, the vendor-neutral API that became a CNCF incubating project in December 2023. Your code calls OpenFeature, a provider connects it to your flag system, and switching systems later means changing the provider, not every flag check in the codebase. It is a small amount of discipline up front that buys you the freedom to change your mind.
When a flag is the wrong tool
Flags are not the answer to every problem, and using them as one creates messes that are hard to undo. A flag should not be a permanent setting: if a value never changes, it belongs in configuration, not in a flag system. A flag should not hide a broken feature that was never going to work; the fix for broken code is to fix it or remove it, not to switch it off and forget it. A flag should not paper over a bad deploy process. If deploys are slow and frightening, the answer is faster, safer deploys, not a flag in front of every change.
Flags are also a poor way to manage secrets: a flag value containing a password or a key will end up in dashboards, logs and audit trails, so keep secrets in a secrets manager. And a flag is the wrong tool for anything that must be consistent for everyone at the same moment, like a pricing change — a staged rollout showing two prices to two users is a customer support problem waiting to happen.
The test is simple. If the switch will be removed within weeks, it is a flag. If it will live for years, it is either a permission flag with a product owner, or it is configuration wearing a flag's clothes. Name it correctly and manage it accordingly.
Questions teams ask before they start
Do flags slow the code down?
Barely, if they are done right. A flag check is a lookup, usually against values cached in memory by the SDK. The cost that matters is not the lookup. It is the extra code path, the extra tests, and the extra thinking. Measure that cost honestly when you decide how many flags to carry.
Should the flag live in the front end or the back end?
Both, for different reasons. Back-end flags control what the server does and are safe to evaluate with full user context. Front-end flags control what the user sees, and they need care: a flag shipped to the browser can be seen and tampered with, so never gate anything security-sensitive on a client-side flag alone. The server should always re-check.
What happens if the flag service goes down?
The SDK should fall back to a default value, usually off, and keep serving from its local cache. That is why you test the default path, and why the default should always be the safe one. A flag system outage should degrade the product, not break it.
A rollout checklist you can steal
- Name the flag's kind, its owner, and its removal date on the day you create it.
- Deploy with the flag off. Turn it on for the team first and test in production.
- Roll out in steps — 1%, 10%, 25%, 50%, 100% — with a dashboard and a stop rule for each step.
- Make rollouts sticky: the same user always sees the same variant.
- Test both paths, on and off, and test the default when the flag service is unreachable.
- Give every outside dependency its own kill switch, separate from the release flag.
- Practise the kill switch on a schedule, in production, before you need it.
- Remove the release flag in the same sprint the feature ships, or file a ticket with an owner and a date.
- Write the code against OpenFeature, so the flag system can change without rewriting every check.
Ship the code when it is ready. Release the feature when the users are ready. Those are two different decisions, and a flag is what lets you make them separately. Teams that learn that distinction stop fearing Fridays, and start shipping on them.
Sources: Pete Hodgson, "Feature Toggles (aka Feature Flags)", martinfowler.com, 2016, via https://www.devopstraininginstitute.com/blog/how-are-feature-toggles-used-to-enable-continuous-deployment-with-minimal-risk. LaunchDarkly, "9 best practices for release management" — https://go.launchdarkly.com/rs/850-KKH-319/images/9%20best-practice-for-release-management.pdf?version=0. OpenFeature, CNCF incubating project, December 2023 — https://www.cncf.io/blog/2023/12/19/openfeature-becomes-a-cncf-incubating-project/ and Unleash OpenFeature docs — https://docs.getunleash.io/sdks/openfeature. Feature flag tooling comparison, November 2026 — https://www.devopstraininginstitute.com/blog/10-best-feature-flags-tools-for-devops-rollouts.
Comments
Post a Comment