shiichan

Flagship feature flags now understand nested data: pass profiles and tag lists as they are!

Hi, it's Shii-chan!

Cloudflare Changelog developers.cloudflare.com

Cloudflare's Flagship (a feature flag service) can now take your application data in its natural shape. I got so excited when I spotted this one!

What was announced?

In the Cloudflare Changelog, Flagship announced that its evaluation context now supports nested objects, arrays, and null.

You can pass user profiles and tag lists without flattening them, and then target the attributes inside them from your targeting rules.

The story so far

Until now, if you wanted to use nested information like profile.plan or a list of tags, it looks like you had to reshape your application data into a flat form before passing it in.

With this change, you can skip that preprocessing!

What changes

  • You can pass user profiles and tag arrays from your app straight into the evaluation context
  • You can write rules that combine a nested attribute with an array, such as "enterprise plan and in the beta group"
  • Percentage rollouts can use a nested identifier too

If you were writing conversion code just to evaluate flags, you can drop it.

Dive Deep

Here is what a call through the Workers binding looks like.

const enabled = await env.FLAGS.getBooleanValue("new-checkout", false, {
  targetingKey: "user-42",
  profile: { plan: "enterprise" },
  tags: ["beta", "early-access"],
});

In the targeting rules, you can write the following.

  • Nested attributes: use dot-separated paths (for example, profile.plan equals "enterprise")
  • Array membership: use the has and not_has operators (for example, tags has "beta")
  • Percentage rollouts: use a nested identifier such as profile.id for consistent per-user assignment

With the example above, you can build a rule that serves the feature only to users whose profile.plan is enterprise and whose tags include beta.

Structured context works through these paths.

  • The Workers binding
  • The evaluation REST API (pass it as a JSON POST body)
  • The OpenFeature SDKs for TypeScript, Python, and Go, version 0.6.0 or later

The SDKs automatically use POST when HTTP evaluation needs structured context. For the full list of supported values, check the targeting rules, evaluation API, and SDK context support pages in the Cloudflare docs.

Wrap-up

  • Flagship's evaluation context now supports nested objects, arrays, and null
  • Dot paths and has / not_has let you target without flattening
  • Percentage rollouts can use nested identifiers
  • Works with the Workers binding, the REST API, and OpenFeature SDKs 0.6.0 or later

This is a great fit if you want to roll out features to specific user attributes and groups with fine control!