Dead Switches, Live Risk: A Retirement Plan for the Flags You Forgot
Photo: Ben Smegelsky, Public domain, via Wikimedia Commons
Feature flags were adopted for a defensible reason: shipping behind a switch reduces the blast radius of a bad release. The reasoning holds. What rarely holds is the second half of the bargain, the part where the switch is removed once the rollout concludes. In most codebases, flags accumulate faster than they retire, and each one is simultaneously a branch in production code, a row in the test matrix, and an unresolved decision with deployment authority.
A flag that nobody can explain is not a safety net. It is an undocumented choice that can change behavior at any hour, including during an incident when the person who created it is unavailable.
How Flags Become Permanent
Three forces drive accumulation. Removing a flag requires a coordinated change across code, tests, dashboards, and runbooks, while adding one requires a single configuration update. Ownership is diffuse: the engineer who added the flag has moved teams, and the product manager who requested it has moved on. And flags quietly acquire defenders, because a switch that has never caused a visible problem is presumed to be providing protection.
The result is a graveyard that looks like diligence.
A Short Inventory Method
Four afternoons of work will surface the bulk of the problem. First, export the complete flag list from the flag service, including dormant entries that no longer appear in code. Second, join that list against recent evaluation telemetry to identify flags with no reads or writes in ninety days. Third, search the codebase, runbooks, and incident postmortems for each remaining flag name. Fourth, assign every flag an owner and classify it as rollout control, entitlement, or operational control.
Anything that cannot be assigned an owner in the fourth step is already a candidate for retirement, regardless of what the first three steps show.
The Seven Archetypes
1. The Zombie Rollout
A flag that reached full exposure and was never removed. It now guards code that has been in production for multiple release cycles.
Retirement test: has the flag been at one hundred percent for more than two release cycles? If yes, the flag is no longer a control. It is a monument.
2. The Executive Override
A switch added so that a senior stakeholder can disable a specific feature without a deployment, usually following a single uncomfortable demo.
Retirement test: does the flag map to a named person rather than a customer segment, region, or plan tier? If yes, retire it or convert it into a documented entitlement with a support process behind it.
3. The Expired Experiment
An A/B test that concluded without a written decision. The losing variant remains reachable, and so does the winning one.
Retirement test: is there a recorded conclusion with a date and an adopted outcome? If the experiment closed without a decision, delete the flag and the losing branch together.
4. The Incident-Era Kill Switch
Created at two in the morning during an outage, referenced in a runbook, never touched again.
Retirement test: has it been exercised in a game day within the last one hundred eighty days? An untested recovery path is not recovery capability; it is an assumption with a name.
5. The Pricing Gate That Never Closed
Package entitlements implemented as flags, duplicating what the billing system already knows.
Retirement test: does the flag restate a fact the billing platform owns? If yes, remove it and read entitlements from the source of truth. Two systems asserting the same commercial rule will eventually disagree in front of a customer.
6. The Environment Shim
Flags that assert region, tenant, or cloud provider, written to bridge a migration that finished long ago.
Retirement test: in any supported topology, would the value ever differ from static configuration? If not, it is configuration wearing a switch's clothing.
7. The Temporary Migration Mirror
Dual-write and dual-read shims kept after the legacy system was decommissioned, retained out of an abundance of caution.
Retirement test: has the legacy path recorded zero traffic for thirty consecutive days? If so, remove the mirror, then remove the legacy code path, then remove the dashboard panel that watches it.
An Expiry Policy That Does Not Slow Delivery
A workable policy fits on one page. Every flag carries an owner, a creation date, an intended lifetime, and a retirement condition. The default lifetime is ninety days, with an automated warning at sixty. Flags intended to outlive the default must be classified as entitlement or operational control and must have a runbook entry describing when and by whom they are toggled.
This preserves the speed that motivated flags in the first place. Nothing about the policy delays a rollout; it only requires that permanence be deliberate.
What Retirement Actually Requires
Removing the flag from the service is the smallest part of the job. Complete retirement means deleting the conditional branch, deleting or rewriting the tests that skip it, deleting the dashboard panel that reports on it, deleting the runbook reference, and removing the flag from any experiment or audit export. Partial retirement is how the graveyard refills within two quarters.
The measure worth tracking is not the number of flags in the system. It is the median age of the flags that remain.