Produce a three-level result with a nested conditional operator.
Practical CEL4 test casesDocumented
What will I practise?
You can order conditions by priority and explain why only one branch is selected.
How is it checked?
Your one expression must produce the expected result for all four JSON inputs.
When am I done?
When all tests pass and you can explain every condition in your expression.
Word problem
A blocking request is critical. A non-blocking request that is at least 24 hours old is high priority. Every other request is normal.
Exact requirements
Security of ordering matters: blocking is checked first.
Age 24 belongs to the high-priority branch.
The result is one string: critical, high, or normal.
Required result
Write one CEL expression. It must return the expected value and type for all four prepared JSON inputs. Do not change the inputs to make an incomplete expression pass.
Recommended procedure
Translate each numbered requirement into one small boolean condition.
Run the starter expression and inspect which cases fail.
Add one condition at a time and run the complete suite again.
Mark the challenge complete only when you can explain every operator and every boundary.
Solve the challenge · browser test suite
Write one expression that passes every case
Edit the CEL expression, then run it against all prepared JSON inputs. A solution is complete only when every case passes.
4 test cases
Hint: Test the strongest condition first; place the second condition in the false branch.
The outer conditional selects critical immediately for a blocking request.
Only its false branch checks ageHours.
The inner conditional separates high from normal.
A request satisfying both conditions remains critical because the first branch wins.
What the test cases prove
Blocking request: expected "critical" (string).
Old request: expected "high" (string).
Normal request: expected "normal" (string).
Blocking and old: expected "critical" (string).
The cases are intentionally different. A solution that passes only the first case has not yet implemented the complete rule.
Common mistake
Do not optimise the expression for the first successful input. A requirement is implemented only when its positive case, negative case, and boundary case all produce the stated result.
Knowledge check
Can you point to the exact part of the solution that makes each false test case fail? If two different failures depend on the same condition, explain why.
Key takeaway
You can order conditions by priority and explain why only one branch is selected.
Sources
CEL-DEV — official CEL overview.
CEL-LANG — official CEL language definition for operators, types, macros, presence, strings, and time values used in this challenge.