Skip to content
Gates

explain()

gates.explain("checkout-v2");
// {
//   flagKey: "checkout-v2",
//   value: true,
//   reason: "rollout_match",
//   ruleId: "rule_…",
//   bucket: 1873,
//   revision: 42,
//   source: "cache",
//   context: { platform: "ios", appVersion: "2.4.1", …, installationId: "inst_…", user: { id: "u_1" } },
//   audiences: { "pro-ios": [ … ] }
// }

explain() is synchronous and local, like flag(). It does not record exposure.

Fields

FieldMeaning
valueWhat flag() returns (without a fallback).
reasonOne of the reasons below.
ruleIdThe rule that decided, for rule_match, rollout_match and rollout_miss.
bucketThis identity’s bucket, 0…9999, for rollout_match and rollout_miss.
revisionThe snapshot revision the decision used.
source"none", "cache" or "remote".
contextThe runtime context the rules were matched against, or null before the local read finished.
audiencesThe audiences the decision could reference, from the same snapshot.

Reasons

Evaluation runs in this order and stops at the first answer:

ReasonWhen
flag_missingThe snapshot has no such flag, or the client has not finished its local read (context is null). Value false.
disabledThe flag is disabled. Value false, whatever the rules say.
rule_matchThe first rule whose conditions all match has no percentage (or 100%). Value is the rule’s value.
rollout_matchThat rule has a percentage and this identity’s bucket is below it. Value is the rule’s value.
rollout_missThat rule has a percentage and the bucket is not below it. Value is the flag’s default.
defaultNo rule matched. Value is the flag’s default.

A rollout miss does not fall through to the next rule: “you are not in the 25%” is an answer, not an absence of one.