Shopify2023-10-18Explainer
Using Betas to Deploy New Features Safely
Summary
Continuous deployment makes changing a running system risky, especially for a platform serving more than a million merchants and changing code multiple times daily. The post presents beta flags as a control mechanism: per-Subject BetaFlags support explicit activation, while BetaRollouts use a percentage and a digest-based modulo calculation to assign a stable, growing subset as rollout increases. It then places a higher-level Feature abstraction above those primitives, allowing direct targeting, percentage rollout, per-Subject opt-outs, and a 100% kill switch that can halt a feature without deleting thousands of database records. The guidance also covers testing permutations, notifying owners through BetaIdentifier metadata, and removing stale flags after rollout. These patterns provide operational control and safer deployment, while requiring substantial implementation and ongoing cleanup.
Context
Shopify practices continuous deployment, with code changing multiple times each day, so new features must be de-risked for a platform serving more than a million merchants. Directly applying flags to many Subjects can make rollback difficult during an incident because thousands of database records may not be removable quickly.
Approach / What changed
Use BetaIdentifier, BetaFlag, and BetaRollout primitives for explicit and percentage-based activation, with digest-based stable sampling. Add a higher-level Feature abstraction that supports direct targeting, percentage rollout, per-Subject opt-outs, and a 100% kill switch. Complement the mechanism with metadata-driven notifications, targeted testing, and eventual flag cleanup.
Takeaways
A digest of the Subject and beta identifiers, reduced modulo 100, keeps rollout membership stable as the percentage increases, so previously enabled Subjects remain enabled.
A percentage rollback can set BetaRollout to 0, but explicit BetaFlags remain active; a higher-level opt-out rollout at 100% provides a kill switch when direct records are difficult to remove.
Feature flags add code-path permutations. Teams may run selected test files twice for complex features, audit tests when flags are removed, and clean up stale flags to avoid dead code and technical debt.
Source and freshness
- Source
- shopify.engineering
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.