Feature flags start as a good idea. Ship a feature behind a flag, test it with 5% of users, roll it out gradually. Clean engineering.
Then 6 months pass. The flag is still there. It's fully rolled out to 100% of users. But nobody removed it because "what if we need to roll back?" Now the code has two paths — the flagged path and the unflagged path — and both need to be maintained, tested, and understood.
Multiply by 50 flags across your codebase, and you have an exponential explosion of code paths that nobody fully understands.
The Accumulation Pattern
- Month 1: Flag added for new checkout flow. Clean, temporary.
- Month 3: Checkout flow fully shipped. Flag still active "just in case."
- Month 6: New developer finds the flag. Assumes it's still needed. Adds their feature behind the same flag because "it's the checkout flag."
- Month 9: Now the flag controls the checkout flow AND the payment method selection. Removing it requires understanding two features.
- Month 12: Nobody dares remove it. It's load-bearing.
Why It's Dangerous
Combinatorial Complexity
10 boolean feature flags create 1,024 possible states. Your test suite covers maybe 20 of them. The other 1,004 are untested and potentially broken.
Dead Code That Isn't Dead
The "off" path of a fully-rolled-out flag is dead code. Except it's not dead — it's dormant. Someone might flip the flag during an incident. That dormant code path hasn't been tested in months. Good luck.
Cognitive Overhead
Every feature flag is a branch in the developer's mental model. "Does this function behave differently with the flag on?" is a question they have to ask for every flag-controlled code path they encounter.
Detection
Code intelligence can detect feature flag debt:
- Flags that have been 100% enabled for >30 days (safe to remove)
- Flags that control multiple unrelated features (need decomposition)
- Flags with no associated test for the "off" state (risk if toggled)
- Flags that appear in >10 files (deeply embedded, high removal cost)
The fix is a regular cleanup cadence: every sprint, remove 2-3 fully-shipped flags. But you can't clean up what you can't find — and in a large codebase, flag debt is invisible without analysis.
Originally published on glue.tools. Glue is the pre-code intelligence platform — paste a ticket, get a battle plan.
Top comments (0)