Backend
A/B testing and feature flags for CubeCraft and Rocket
The experimentation and feature-flag system CubeCraft's games and Rocket's services run on, and the rollout patterns I use it for.
- Millionsof players a month behind these flags
The problem
With millions of players a month, a bad change reaches a lot of people very quickly. The team needed a way to turn a feature on for part of the network, test ideas against each other, and switch something off without a deploy.
What I built
- The A/B testing and feature-flag system CubeCraft and Rocket both run on
- Rollouts with a flag and a fallback: new paths sit behind a flag and the old path takes over if the new one is cold or erroring
- Shadow mode, where a new check runs and reports what it would have done before it’s allowed to enforce
- Per-check flags for CubeCraft’s anticheat, so each detection is tuned on its own on Java and Bedrock
- Check runsflag + player
- Mode?off, shadow or enforce
- Shadowrecord what it would have done
- Enforceact on it
Shadow mode, as a sketch
fn run_check(check, player, input):
mode = flags.mode(check.flag, player) // off | shadow | enforce
if mode == "off": return
verdict = check.evaluate(input)
if verdict.flagged:
metrics.would_have_acted(check, player.edition)
if mode == "enforce":
act(verdict)
Why it matters
A lot of the riskier changes I’ve shipped went out behind a flag first. If something’s wrong, a few players see it and I turn it off, instead of everyone seeing it until the next deploy.