Repository navigation
Add support for declared opaque and abstract types in CEL env config - #2501
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
Adds `types` declarations (`opaque` and `abstract`) to `cel::Env` config, YAML serialization/deserialization, type checking, and `EnvRuntime` evaluation. Type checking: - Declared types are resolved in dependency order with cycle detection, conflict checks (against protobuf, custom, built-in, well-known, variable, and container-qualified names), and an expanded type node limit to prevent exponential expansion. - Declared types are registered with the type checker so they can be used as type literals and resolved in variable and function declarations. Name segments may be CEL reserved words, which must be backtick-escaped in expressions. - Extracts `ValidateTypeForDeclaration` into `checker/internal/type_validation` so checker and env share the same validation logic. Runtime: - `EnvRuntime` registers declared types as type-erased opaque types (owned by the runtime) and enables qualified type identifiers so expressions such as `type(x) == foo.Bar` evaluate. PiperOrigin-RevId: 1030307027
copybara-service
Bot
force-pushed
the
test_1030307027
branch
from
December 2, 2026 05:00
c1ee69c to
82d23c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for declared opaque and abstract types in CEL env config
Adds
typesdeclarations (opaqueandabstract) tocel::Envconfig, YAMLserialization/deserialization, type checking, and
EnvRuntimeevaluation.Type checking:
conflict checks (against protobuf, custom, built-in, well-known, variable,
and container-qualified names), and an expanded type node limit to prevent
exponential expansion.
type literals and resolved in variable and function declarations. Name
segments may be CEL reserved words, which must be backtick-escaped in
expressions.
ValidateTypeForDeclarationintochecker/internal/type_validationso checker and env share the same validation logic.
Runtime:
EnvRuntimeregisters declared types as type-erased opaque types (owned bythe runtime) and enables qualified type identifiers so expressions such as
type(x) == foo.Barevaluate.