Skip to content

v0.15.0

Latest

Choose a tag to compare

@l46kok l46kok released this 27 Oct 02:54
· 59 commits to main since this release

This release introduces non-blocking asynchronous evaluation, an opt-in hand-written Pratt parser, Protobuf wire evaluation without generated descriptors via SelectOptimizer, standard extension support in the Lite Runtime, and official deprecation of the legacy CEL runtime builders.


Warning

Deprecation Notice: The legacy runtime builders (CelFactory.standardCelBuilder(), CelFactory.legacyCelBuilder(), CelRuntimeFactory.standardCelRuntimeBuilder(), and CelRuntimeFactory.legacyCelRuntimeBuilder()) are officially deprecated and will be removed in a future release (#1301, #1311). Callers must migrate to the Program Planner (CelFactory.plannerCelBuilder() and CelRuntimeFactory.plannerRuntimeBuilder())—see the Planner Migration Guide for details.


🚀 Highlights & New Features

  • Asynchronous Evaluation (Program.evalAsync): Custom functions backed by slow I/O (RPCs, database queries, remote lookups) no longer need to block threads or run sequentially in the Program Planner. Returning ListenableFuture via CelAsyncFunctionBinding lets the runtime automatically dispatch independent async calls in parallel across expression branches, deduplicate identical in-flight calls, and short-circuit as soon as a logical branch resolves (#1191, #1234, #1235).
  • Pratt Parser (enablePrattParser): Added an opt-in, hand-written Pratt parser (CelOptions.enablePrattParser(true)) that parses CEL expressions ~6–13x faster with ~5–7x fewer memory allocations in benchmarks than the default ANTLR parser, with zero dependency on the ANTLR runtime (#1197, #1245).
  • Descriptorless Protobuf Evaluation (SelectOptimizer): Evaluating Protobuf messages in constrained environments (like Android / CelLiteRuntime) no longer requires generating CelLiteDescriptor code or deserializing full MessageLite objects. SelectOptimizer embeds field numbers and wire types into the AST at build time to evaluate directly over raw WireMessageLite bytes or MessageLite instances. Because lookups resolve by wire tag rather than field name, Protobuf field renames are safe and additive schema changes between compile time and runtime are naturally tolerated (#1196, #1198, #1304).
  • Standard Extensions in Lite Runtime: math, strings, sets, encoders, lists, regex, and comprehensions are now available in CelLiteRuntime without pulling in full Protobuf dependencies (#1298, #1312).
  • Ergonomics & Tooling:
    • Simplified Functions: Define compile-time declarations and runtime bindings in a single call via CelFunction and CelBuilder.addFunctions with automatic overload ID generation (#1359, #1361), plus human-readable YAML signatures like (string, int) -> bool (#1364).
    • String Formatting: Added strings.format in CelStringExtensions (#1165).
    • Bazel Rules: Added compile_cel_policy to compile YAML policies into CheckedExpr binary protos at build time (#1321, #1328) and cel_verifier_test for declarative formal verification (#1209).

⚡ Performance, Runtime & Optimizer Improvements

  • Subexpression Optimizer (CSE): Significantly sped up producing optimized ASTs during the CSE pass on large expressions by eliminating quadratic subtree copies and repeated ID renumbering (#1340), added deduplication for equivalent commutative (a + b vs b + a) and flipped relational (a > b vs b < a) subexpressions (#1384), and sped up plan-time cel.@block validation (~3.5x faster) (#1339).
  • Program Planner:
    • Replaced map lookups with indexed slot arrays for comprehension variables (up to 42% faster, 90% fewer allocations) (#1354) and eliminated O(N²) list accumulator copies (#1335).
    • Added precompiled constant regexes (#1338), plan-time constant list/map folding (#1407), extension version validation (#1325), and advanceEvaluation for partial evaluation with unknown tracking (reaching feature parity with the legacy runtime) (#1285).
  • Protobuf & Lite Runtime: Direct MessageLite getter reads (50–95% faster), zero intermediate wrapper allocations or byte copies on chained field traversals, and ~23–51% smaller generated CelLiteDescriptor code and DEX footprint (#1341, #1344, #1358).
  • Optimizer Pipeline: Added CelOptimizerListener to inspect intermediate ASTs (#1194) and skipped redundant AST renumbering/re-checking on no-op passes (#1205).

🛡️ Formal Verification (CelVerifier)

  • Well-Known Types: Registered Protobuf WKT descriptors (Value, Struct, ListValue, wrappers, and nanosecond-precise Timestamp/Duration) by default across CelVerifier, the CLI, and the REPL (#1369, #1374).
  • Usability & Soundness: Formatted counterexamples as valid CEL literals instead of raw Z3 expressions (#1399); fixed soundness gaps for comprehensions exceeding loop unroll limits (#1259), dyn values in truncated containers (#1279), and custom/type-conversion functions (#1385, #1388).

🐛 Bug Fixes & API Changes

  • Clearer Diagnostics: Non-bool operands in logical (&&, ||) and ternary (_?_:_) expressions now report explicit type mismatches instead of "no matching overload", improving errors for all, exists, filter, and map predicates (#1382, #1383).
  • Type Checker & AST: Fixed parameterized type unification (#1211), Duration/Timestamp type normalization (#1283), Protobuf type provider priority (#1305), sortBy element type preservation (#1203), AstMutator comprehension variable scoping (#1280, #1408), and two-variable cel.@mapInsert overload IDs (#1356).
  • Runtime Correctness: Fixed nested optional flattening and equality (#1416), planner error propagation (#1248), constant-index unknown matching (#1372), Java null rejection in list/map adaptation (#1242), FIXED32/FIXED64 unsigned decoding (#1302), and unset wrapper map defaults (#1323).
  • API Cleanup: Deprecated setStandardEnvironmentEnabled in favor of environment subsetting (#1190); removed enableHiddenAccumulatorVar (@result is now always enabled) (#1224), resolveTypeDependencies (always enabled) (#1316), and subexpressionMaxRecursionDepth (#1397).

Full Changelog: v0.14.0...v0.15.0