الانتقال إلى المحتوى
DevOps والـ CloudCI/CD· 7 دقائق للقراءة

Deploying Isn't Releasing: Feature Flags, Dark Launches and Their Hidden Debt

Flags let you ship code dark and release it to users later, to a few first. Each one also needs a stable cohort, an owner and an end date.

ReadIn

مقال كل يوم يفرق معاك

22 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A team merges a redesigned checkout on Thursday afternoon, the pipeline deploys it, and every customer gets it at once. An hour later, support reports that customers paying with one card provider can't finish their orders. The only way back is another deploy of the old version, and the email announcing the redesign has already gone out. In the retrospective, someone says: next time, put it behind a flag. A year later, the codebase has so many flags that nobody remembers which ones are still read, or what turning one off would do.

The common misconception

The belief: deploying and releasing are the same event. When the pipeline turns green, users have the feature. To hold a feature back, you hold back the deploy, on a branch, until the feature is ready.

It's a reasonable belief because for years it was literally true. A release meant scheduling a deployment, often in a maintenance window, and the version number on the release notes was the version on the servers. Pipelines still show a single "deploy to production" step, and for a bug fix, deploying really is releasing: you want every user to get it now.

The half-truth: new code reaches users at deploy time only if nothing else decides. Pete Hodgson's article on Martin Fowler's site calls release toggles "the most common way to implement the Continuous Delivery principle of 'separating [feature] release from [code] deployment.'" keeps the two apart on purpose.

What actually happens

Deployment moves code; release exposes behavior

A lets a team "modify system behavior without changing code." The article describes release toggles this way: they "allow incomplete and un-tested codepaths to be shipped to production as latent code which may never be turned on." Microsoft's Azure App Configuration docs say the same in product terms: it "decouples feature release from code deployment and enables quick changes to feature availability on demand." Deploying becomes a routine technical event; releasing becomes a decision you can make, reverse or make for some users only.

A flag is a toggle point plus a toggle router

The if in your code is the toggle point. What decides the answer is the toggle router, which may read a config value, a user's group or a percentage. Hodgson calls coupling the two "one common mistake", and recommends putting each decision behind a named method, so "whenever we want to modify the logic of that specific toggling decision we have a single place to go."

Dark launches and canaries release in slices

A , in Fowler's definition, means "taking a new or changed back-end behavior and calling it from existing users without the users being able to tell it's being called", to measure the load before anyone sees the feature. A then turns the feature on "for a small percentage of their total userbase". The key detail is consistency: a canary cohort is a group of users "who consistently experience a feature as always being On or Off", for example by "using a modulo of user ID".

Every flag is debt with interest

"Toggles introduce complexity," the article warns. They "require you to introduce new abstractions or conditional logic into your code" and "introduce a significant testing burden." It cites "Knight Capital Group's $460 million dollar mistake" as "a cautionary tale on what can go wrong when you don't manage your feature flags correctly". Release toggles "should generally not stick around much longer than a week or two."

A rollout flag, done twice

Both tabs decide whether a user gets the new checkout. The toggle point is the same one-line call to UseNewCheckout(userId); what changes is the router behind it.

C# FeatureDecisions.cs
public class FeatureDecisions{    // Release the new checkout to 10% of users    public bool UseNewCheckout(string userId) =>        (userId.GetHashCode() & 0x7FFFFFFF) % 100 < 10;}// Same build, same user, two runs on .NET 10:// run 1: "u-00042".GetHashCode() = 1047013002   -> new checkout// run 2: "u-00042".GetHashCode() = -1043018878  -> old checkout

We ran both over 10,000 made-up user IDs in a .NET 10 console app, twice, as two separate processes. The first tab put 1,022 users in the rollout on the first run and 997 on the second, and they weren't the same users: u-00042 got the new checkout, then the old one. That's documented behavior. .NET's docs say string hash codes are "not guaranteed to be stable" and that "two subsequent runs of the same program may return different hash codes." Behind a load balancer, every Pod and every restart would deal users a new hand. The 10 is also a constant, so widening the rollout means another deploy, the coupling the flag was supposed to remove.

The second tab put the same 963 users in on both runs. Hashing the flag's name with the user ID keeps each user in one bucket everywhere, and gives each flag its own cohort. Percent comes from configuration, so going from 10 to 50 is a config change, and the owner and removal date sit next to it, where a reviewer or a test can see them.

Toggle categoryWhat it's forHow long it lives
ReleaseShip unfinished or held-back code paths as latent code"a week or two", longer for product launches
ExperimentA/B tests that send each cohort down one pathHours or weeks, until results are significant
OpsDisable or degrade a feature in production quicklyShort, except a few long-lived kill switches
PermissioningFeatures for some users, such as premium or betaCan be years

How to apply it in your project

  1. Give every flag a category, an owner and a datePut them where the flag is defined, as in the Flag record. Some teams add a removal task to the backlog the day a release toggle is created; Hodgson also mentions "expiration dates" on the toggles themselves.
  2. Route decisions through named methodsToggle points call features.UseNewCheckout(user), never a raw config key. When the rule changes from a percentage to a user group, you edit one method.
  3. Bucket users with a stable hashHash the flag name and a stable user ID with a fixed algorithm. Never use GetHashCode or Random for anything that must give the same answer on every Pod and after every restart.
  4. Add a time bombWrite a test that fails once a flag's RemoveBy date has passed. Hodgson describes "time bombs" that fail a test, "or even refuse to start an application", when a flag outlives its date.

Key takeaways

  • Deploying puts code on servers; releasing decides who can use it. Feature flags let you do them at different times.
  • Dark launches measure a feature's load with real traffic, and canary releases expose it to a small cohort first.
  • A percentage rollout needs a stable hash of flag and user; GetHashCode changes between processes.
  • Keep the toggle point dumb: one named decision method per feature, with the rule in one place.
  • Treat flags as inventory: give each an owner and a removal date, and remove release flags within weeks.

📚 المصادر

  1. Feature Toggles (aka Feature Flags) — Pete Hodgson, martinfowler.com
  2. Dark Launching — Martin Fowler
  3. Understand feature management using Azure App Configuration — Microsoft Learn
  4. String.GetHashCode Method — .NET API reference, Microsoft Learn

التعليقات (1)