Evaluation
Rule Ordering
How targeting rules are evaluated in order with first-match-wins semantics.
First match wins
Rules are evaluated in the order they appear. The first rule that matches determines the result — subsequent rules are skipped.
Rule 1: email contains "@acme.com" → return true
Rule 2: country in ["US", "CA"] → return true
Rule 3: percent at 10 → return true
(no match) → return default valueIf a user matches Rule 1 and Rule 2, only Rule 1's return value is used.
Why order matters
Consider two rules on a boolean flag:
| # | Rule | Return Value |
|---|---|---|
| 1 | percent at 50 | true |
| 2 | email contains @acme.com | true |
With this ordering, internal users (@acme.com) are subject to the 50% rollout — they may or may not see the feature.
Swap the order:
| # | Rule | Return Value |
|---|---|---|
| 1 | email contains @acme.com | true |
| 2 | percent at 50 | true |
Now internal users always see the feature (Rule 1 matches first), and everyone else is in the 50% rollout.
Best practices
- Put specific rules before broad rules — target known users/groups first, then use percentage rollouts for everyone else
- Put deny rules early — if you want to exclude certain users, place those rules first with a
falsereturn value - Use percentage rules last — they're typically the catch-all for gradual rollouts
Example: staged rollout with internal access
| # | Attribute | Operator | Value | Return Value |
|---|---|---|---|---|
| 1 | email | endsWith | @yourcompany.com | true |
| 2 | country | notIn | ["US", "CA"] | false |
| 3 | — | percent | 25 | true |
This gives:
- All internal users see the feature
- Users outside US/CA are excluded
- 25% of remaining US/CA users see the feature