All work

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.

Ziax · CubeCraft and Rocket · 2021 – present

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

  1. Check runsflag + player
  2. Mode?off, shadow or enforce
  3. Shadowrecord what it would have done
  4. Enforceact on it

Shadow mode, as a sketch

A sketch of the idea, not the production code.

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.

Stack