Fix(cel): bound an expression's evaluation by cost and by its caller's context

BR
14h ago
+92-8

Description of your changes

Bounds a CEL expression's evaluation. Found in the v1.12 release testing.

  • Fix(cel): bound an expression's evaluation by cost and by its caller's context

An expression now stops at a cost limit of 1,000,000 and when its caller's context is cancelled, instead of
running for as long as it takes. kubevela/kubevela picks this up for the 1.12 release.

How has this code been tested

Unit tests for the cost limit and for cancellation, red before the fix and green after; the package suites pass
(envtest 1.37.0).


Summary by cubic

Bounds CEL expression evaluation so expensive expressions stop at a cost limit and respect their caller's context instead of running to completion. Evaluation now fails with "expression exceeds the evaluation cost limit" when it passes 1,000,000 (the per-expression limit Kubernetes sets for CRD validation rules), and Plan.Eval aborts early when its context is cancelled. Adds tests covering the cost limit and cancellation for previously unbounded evaluations.