Guides1 min read

Every feature flag is a loan. Here is how we pay them back

A flag is borrowed flexibility: cheap to take out, expensive to carry. Three rules that keep the interest down, and the one report that tells you when to pay up.

Jordan Hale

Jordan Hale

Co-founder & CTO ·

Guides cover: Every feature flag is a loan. Here is how we pay them back

Every feature flag is a branch in production. Two flags are four code paths; ten are a thousand and twenty-four. Most of them are dead, but your tests cannot know which.

Taking out a flag costs one line. Carrying it costs a little every day, forever, until someone pays it back.

Rule one: every flag has an expiry

When you create a flag, say when it should be gone. Driftwire asks for a date and reminds the owner a week before.

terminalShell
// What an edge node receives: a diff against the version it holds.
interface RulesetDiff {
    version: number
    previous: number
    changed: Record<string, FlagRules>
    removed: string[]
}

function apply(diff: RulesetDiff) {
    if (diff.previous !== store.version) return resync() // missed one: fetch a snapshot
    store.merge(diff.changed, diff.removed)
    store.version = diff.version
}

Rule two: release flags and ops flags are different animals

  • Release flags exist to ship one change safely. They should live for days or weeks.
  • Ops flags — kill switches, circuit breakers — live forever, on purpose. Tag them so nobody "cleans them up".

Rule three: removal is part of the feature

A feature is not done when it reaches 100%. It is done when the flag and the losing branch are deleted. Put the removal ticket in the same sprint as the launch.

Driftwire marks a flag stale after 30 days at 0% or 100% and lists every line of code that still reads it. That list is your repayment plan.

Flag hygieneTech debtProcess
Jordan Hale

Written by

Jordan Hale

Co-founder & CTO

Jordan co-founded Driftwire after one too many Friday rollbacks. Writes about release engineering, trunk-based development and paying down flag debt.

More posts by Jordan Hale