What you will do
Turn ordered requirements into a nested conditional expression. You will trace branch order and verify that every path returns a meaningful result of the same type.
How it works
request.blocked
? 'blocked'
: request.score >= 90.0
? 'priority'
: request.score >= 70.0
? 'standard'
: 'review'CEL evaluates the conditions from top to bottom. When it finds a true condition, it evaluates only that result branch. Later branches cannot change the outcome.
Decision table
| Order | Condition | Result |
|---|---|---|
| 1 | request.blocked | 'blocked' |
| 2 | request.score >= 90.0 | 'priority' |
| 3 | request.score >= 70.0 | 'standard' |
| 4 | no preceding match | 'review' |
With a score of 82.0 and blocked: false, the result is 'standard'.
Your task
- Run the prepared expression.
- Set
blockedtotrueand the score to95. - Swap the
90.0and70.0thresholds and explain the incorrect result.
Expected observation: Blocking always takes priority. If the lower threshold is checked first, the higher branch is never reached for a score of 95.
Common mistake
Nested conditions are not a set of independent rules. Their order is part of the expression's meaning.
Show the explanation
A value can satisfy several conditions at once. The first true condition determines the result, so more specific or more important rules belong earlier.
Knowledge check
Why does request.score >= 90.0 come before request.score >= 70.0?
Key takeaway
Treat a nested conditional expression as a prioritized decision tree, and document its order with a table or clear formatting.
Sources
CEL-DEV— official overview of CEL conditional expressions.CEL-LANG— official definition of the conditional operator and short-circuit evaluation.CEL-GO-BIND— official documentation for the optionalcel.bind()extension used by the self-contained tab.