Release v0.11.0
Breaking Changes
This release includes significant breaking changes, notably switching the underlying protobuf definitions from google.api.expr to the canonical dev.cel protos. Additionally, the Reserve() method has been removed from MutableRepeatedFieldRef in the reflection utilities.
- #1019: Breaking change: Use dev.cel (canonical) protos instead of google.api.expr
- #1112: Breaking change: Remove MutableRepeatedFieldRef::Reserve() in reflection
Core Value System, Memory Management, and Internals Refactoring
A major focus was on refactoring the core value types, memory management, and internal representations. This involved removing the ValueManager, consolidating type providers, overhauling arena and message factory propagation, removing legacy type reflectors and builders, introducing hand-rolled variants for cel::Value, ListValue, MapValue, and StructValue for better performance and control, refining the ByteString implementation, adding ZeroCopyInputStream/OutputStream, devirtualizing cel::Data, finalizing parts of the Value API, and cleaning up legacy value handling. Dispatch tables were added for custom value types to improve extensibility.
- #1014: Remove dependency on getting list/map value builders from factory/managers
- #1023: Overhaul propagation of arenas and message factories
- #1025: Remove TypeFactory from TypeIntrospector
- #1027: Consolidate type providers into two: one for legacy and one for modern
- #1028: Remove the usage of type reflectors for optional types
- #1065: Reject legacy runtime type values with empty typenames when converting to
- #1076: Improve error messages for Value type casting errors.
- #1157: Remove references to now unused option use_legacy_container_builders.
- #1174: Remove usages of native JSON and Any representations
- #1177: Rename Parsed{List,Map,Struct}Value to Custom{List,Map,Struct}Value
- #1186: Migrate includes from base/kind.h to common/kind.h
- #1196: Remove now unused native JSON types
- #1236: Remove ValueManager& from NewIterator()
- #1251: Remove ValueManager 1
- #1254: Remove ValueManager from Activation
- #1255: Remove ValueManager from TraceableProgram::Trace.
- #1258: Remove ValueManager
- #1263: Delete cel::common_internal::DataInterface
- #1269: Add ZeroCopyInputStream and ZeroCopyOutputStream for BytesValue
- #1274: Update common_internal::ByteString
- #1275: Add debug checks for valid duration and timestamp
- #1280: Add missing common_internal::ByteString::Clone
- #1281: Migrate from common_internal::SharedByteString to common_internal::ByteString
- #1295: Do not clear the constant folding arena
- #1296: Finalize more parts of the Value API
- #1297: Cleanup Legacy values
- #1298: Cleanup Legacy values
- #1299: Cleanup Legacy values
- #1302: Finalize TypeValue
- #1303: absl::Cord& -> absl::Nonnull<absl::Cord*>
- #1306: Drop cel::Value back down to 32 bytes
- #1307: Devirtualize cel::Data
- #1308: cel::Value::Clone(Allocator<>) -> cel::Value::Clone(absl::Nonnull<google::protobuf::Arena*>)
- #1311: Switch from cel::Shared<T> to cel::Owned<T>
- #1312: Delete Shared and SharedView
- #1323: Fix handling of invalid values with optional elements/entries/fields
- #1325: Fix error value handling in create map/struct
- #1327: Add dispatch table support for CustomStructValue
- #1334: Add dispatch table support for CustomListValue
- #1335: Add dispatch table support for OpaqueValue
- #1340: Add dispatch table support for CustomMapValue
- #1349: Drop reference counting support from protobuf related values
- #1350: Remove assignment operators
- #1352: Implement hand-rolled variant for cel::Value
- #1354: Implement hand-rolled variant for cel::ListValue
- #1355: Implement hand-rolled variant for cel::MapValue
- #1356: Implement hand-rolled variant for cel::StructValue
- #1364: Remove manual construction workaround from TypeValue
- #1375: Redo ArenaString
- #1376: Remove common_internal::ByteStringView
- #1377: Value::SerializeTo(..., absl::Cord*) -> Value::SerializeTo(..., ZeroCopyOutputStream*)
- #1382: Lock down custom value interfaces
- #1400: Check for in-range timestamp and duration values in Value conversion.
Type Checker Enhancements & Fixes
The type checker received several updates, including support for declaring an overall expected expression type, improved type widening logic to align with Go/Java, better handling of function declarations in conformance tests, support for iter_var2 in comprehensions, options for input size limits, filtering of bad line information, improved error reporting for type deduction failures, support for declaring context messages, and integration with an optional protobuf Arena instance. The builder pattern was also refined.
- #1009: Add support for declaring an overall expected type to the type checker.
- #1020: Fix forwarding checker options from CreateTypeCheckerBuilder overload.
- #1031: Update type assignment widening behavior to more closely follow the 'MoreGeneral' check in the Go and Java implementations.
- #1032: Update conformance to correctly handle applying function declarations from the test file to the TypeCheckerBuilder.
- #1046: Update type checker to handle iter_var2
- #1069: Add option to set input expression size limit in type checker.
- #1072: TypeChecker updates to filter bad line information.
- #1073: Refactor factory functions for TypeCheckerBuilders.
- #1074: Make TypeCheckerBuilder class abstract.
- #1075: Update type checker to fail (return a status) if it fails to deduce the type of subexpression.
- #1077: Checker support for declaring context messages.
- #1081: Add support for type checker type deduction conformance tests.
- #1309: Add an optional protobuf Arena tied to TypeCheckerBuilder instances.
Compiler, Planner & Execution Optimizations
New cel::Compiler interfaces were introduced, along with initial implementations and support for optionals. Performance was improved through specialized implementations for common operators (!_, @not_strictly_false, ==, !=, @in), optimized string/bytes operations (concatenation, startsWith, endsWith, contains), optimized evaluator stack access, memoized enum lookups, reduced temporary allocations in the planner, optimized program builder bookkeeping, and direct visitor calls instead of std::invoke. Fixes were made for slot calculations and error handling in the planner.
- #1042: Add interfaces and initial implementation for cel::Compiler.
- #1057: Add compiler library for optionals.
- #1059: Fix for slot calculation for block expressions.
- #1068: Update helper class for managing AST traversal.
- #1071: Add missing return statements after errors in C++ planner.
- #1170: Add specialized implementations for ==/!=/@in.
- #1171: Default to using specialized implementation for some builtins.
- #1176: Add specialized impls for !_ and @not_strictly_false
- #1216: Add recursive implementation for cel.@block.
- #1358: Make <string>.startsWith, <string>.endsWith, and <string>.contains cheap again
- #1359: Implement optimized string and bytes concatenation
- #1365: Avoid std::invoke and just directly call visitors to avoid ugly frames in pprof
- #1373: Memoize enum lookup table in FlatExprBuilder. Switch to using fully qualified name only instead of precomputing all possible ways to reference.
- #1374: Add benchmarks for enum resolution for the expression builder.
- #1385: Optimize EvaluatorStack
- #1386: Remove temporary vectors in resolver logic for the planner.
- #1388: Avoid pointer indirection to access stacks
- #1390: Validate that select expression specifies an operand in FlatExprBuilder.
- #1391: Add additional test case for constant folding.
- #1392: Optimize bookkeeping in the program builder:
- #1393: Add accessors for underlying parser / type checker on cel::Compiler interface.
- #1398: Inline Value::GetBool and Value::AsBool
Parser & AST Handling
The parser implementation was refactored to build a non-protobuf SourceInfo first before converting. AST conversion logic was updated for iter_var2, moved into the common directory, and cleaned up. Support for quoted field selectors was added.
- #1039: Refactor parser implementation to build non-proto version of SourceInfo then convert to proto.
- #1044: Update AST conversion to support iter_var2
- #1150: Add support for quoted field selectors.
- #1324: Move base/ast_internal definitions to common/ast
- #1326: Cleanup references to ast_internal:: aliases to cel::Expr and related types.
- #1328: Remove declarations for internal functions exposed for testing in ext/protobuf/ast_converters.
- #1329: Move CEL-C++ sourceinfo to proto conversion to common/ast.
- #1330: Move ast conversion from extensions/protobuf to common. Update signature to match other protobuf utilities ToProto(const T&, U out);
- #1331: Remove references to old ast_conversion utilities.
Comprehensions & Macros
Significant work was done on comprehensions and macros, including an initial implementation of Comprehensions V2, hardening against __result__ usage, adding an option to configure the accumulator variable name (and defaulting to the new variable), fixing bugs related to recursive comprehensions, updating macros to use iterators and respect the configured accumulator variable name, improving list append optimization checks, and providing configuration examples. The older three-argument filter macro was removed.
- #1047: Harden builtin macros against usages of __result__
- #1051: Initial minimal implementation of Comprehensions V2
- #1085: Fix bug when accessing iterator variables when using recursive comprehensions
- #1086: Make check for optimizeable list append more strict.
- #1113: Add option for changing the comprehension accumulator variable used by standard macros.
- #1118: Opt parser tests into new accumulator var ahead of default enabling.
- #1119: Default enable new accumulator variable.
- #1125: Update comprehension v2 macros to follow the accu var name option.
- #1126: Update internal tests to opt in to new accumulator variable ahead of default enabling.
- #1214: Update standard macro expanders to give a more stable numbering across compilers/compiler options.
- #1222: Update extension sortBy macro to use the configured name for accumulator variable instead of a constant 'result'.
- #1313: Add example for configuring macros with cel::CompilerBuilder.
- #1353: Use return-by-address overload in comprehension next
- #1387: Update comprehensions to use iterators
- #1389: Reimplement ComprehensionSlots to preserve pointer stability
- #1399: Remove <map_or_list>.filter(<iter>, <iter2>, <expr>)
Extension Functions
New extension functions were added, including upperAscii() for strings and the 'lists' extension library. Existing extensions (math, encoder, JSON-related) were refactored, and type checker declarations were added. Optional unwrap functions were implemented. Handling for special-cased functions was standardized.
- #1055: Refactor JSON-related well known types
- #1058: Add declarations for string extension functions.
- #1060: Introduce upperAscii() string extension function
- #1061: Refactor extensions/math_ext to use register helpers for function bindings.
- #1062: Add type checker declarations for the math extension library.
- #1063: Add checker declarations for encoder extensions.
- #1115: Implement the 'lists' extension for the C++ runtime.
- #1158: Refactor and standardize handling for special cased functions.
- #1211: Implement optional.unwrap() and .unwrapOpt() functions.
Protobuf & Descriptor Handling
Improvements were made to descriptor pool management, including ensuring mandatory messages are linked, making the minimal pool public, adding helpers for consistent pool building, and exposing the minimal set as a DescriptorDatabase. Proto conversion utilities were consolidated.
- #1024: Ensure mandatory messages are linked with the generated descriptor pool
- #1026: Make the minimal descriptor pool public
- #1305: Consolidate conversion code from proto messages to cel::Type and cel::VariableDecl into common/decl_proto* and common/type_proto*.
- #1337: Expose minimal descriptor set as google::protobuf::DescriptorDatabase
- #1338: Remove unnecessary dependency on cel_proto_wrap_util.
- #1351: Add helper for building consistent descriptor pool.
General Refactoring, Fixes & Cleanups
This category includes various smaller fixes, cleanups, and refactoring efforts such as adding annotations, removing dead code and cruft, renaming functions, fixing compiler warnings, improving error messages, adding comparison operators for sorting, moving files and updating includes, adjusting code visibility, cleaning up comments, updating internal codelabs, fixing sync issues, and updating to a newer cel-spec version. A helper for formatting validation errors was also added.
- #1029: Add a [[maybe_unused]] annotation
- #1040: Remove deadcode
- #1049: Rename StandardLibrary() to StandardCheckerLibrary().
- #1050: Fix gcc warning about shadowing base class virtual overload.
- #1066: Fix misleading error on string -> uint conversion.
- #1078: internal codelab updates
- #1116: Add operator<() for timestamp, duration and bytes to enable sorting.
- #1208: Update includes to refer to new locations /common/function_descriptor.h and /runtime/function.h.
- #1304: Check for timestamp out of range for timestamp(int) function.
- #1310: Add a helper for formatting errors in a ValidationResult.
- #1405: Update to cel-spec 0.23.0
New Contributors
- @jchadwick-buf made their first contribution in #834
Full Changelog: v0.10.0...v0.11.0