Feature flags are often sold as experimentation. In production backend systems their highest value is a kill switch: turn off a dangerous path without rebuilding binaries under stress. That only works if evaluation order is correct, defaults are safe, and someone owns cleanup.

When a flag is justified

Use a flag when:

  • You need instant disable independent of deploy cadence
  • Rollout should be percentage or allowlist based
  • Two implementations must coexist briefly

Skip a flag when:

  • The change is a pure bugfix with no new path
  • You will not remove it within a sprint (it will become permanent architecture by accident)

Evaluation order (hard rule)

1) killSwitch / hard off
2) explicit allowlist (canary tenants)
3) percentage rollout
4) defaultEnabled

Never let a percentage rollout override a kill switch. The lab encodes that order.

node content/labs/feature-flags-kill-switches/demo.mjs

Sample behavior:

  • t_canary allowed even at low percentage
  • other tenants follow percentage hashing
  • after killSwitch=true, everyone is false—including canary

That last line is the point of a kill switch.

Safe defaults

Flag typeDefault in prodWhy
New risky pathofffail closed
Removing old pathold path on until verifiedavoid forced new code
Kill switchoff (meaning “not killing”)do not ship already-killed features silently

Document fail open vs fail closed when the flag service itself is down. Many outages come from “flag lookup timeout ⇒ enable new code.”

Operational controls

  • Who can toggle prod? break-glass role, not every engineer in the org chat
  • Audit: who flipped what, when, previous value
  • Change windows: percentage ramps with observation time
  • Dashboards: error rate by flag_on dimension when possible

If flags live only in a JSON file in the repo, you do not have a kill switch—you have another deploy.

Lifecycle and debt

  1. Create with owner + removal date
  2. Roll out allowlist → % → default on
  3. Remove old code path
  4. Delete flag config

Track open flags like production debt. A quarterly “flag inventory” that never deletes anything is theater.

Case study (lab narrative)

checkout_v2 rolls to 20% + canary tenant. Latency regresses. Operator sets killSwitch=true. All tenants immediately leave v2 without waiting for CI. Later the percentage is irrelevant until the switch is cleared and a fix ships.

Summary

PracticeReason
Kill switch first in evaluationAbort beats experiment
Safe defaultsOutages love fail-open flags
Auth + audit on togglesFlags are production control plane
Delete flagsPrevent permanent branching

Flags are operational controls. Treat them with the same seriousness as deploy credentials.