Skip to content

Evaluation explainer: Violations and examples - #1676

Merged
TristonianJones merged 1 commit into
cel-expr:masterfrom
TristonianJones:eval-explainer-violations
Nov 20, 2026
Merged

TristonianJones merged 1 commit into
cel-expr:masterfrom
TristonianJones:eval-explainer-violations

Conversation

@TristonianJones

@TristonianJones TristonianJones commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Adds Explanation.Violations() to pinpoint which sub-expressions and comprehension iterations caused an expression not to evaluate to true:

  exp, _ := cel.ExplainEval(ast, det) // with OptTraceIterations, OptExhaustiveEval
  fmt.Print(exp.String())
  // result: false
  //   object.spec.containers[1]: c.securityContext.privileged == false -> false

Adds Explanation.Violations() to pinpoint which sub-expressions and comprehension iterations caused an expression not to evaluate to true:

  exp, _ := cel.ExplainEval(ast, det) // with OptTraceIterations, OptExhaustiveEval
  fmt.Print(exp.String())
  // result: false
  //   object.spec.containers[1]: c.securityContext.privileged == false -> false
@TristonianJones
TristonianJones merged commit 2c19067 into cel-expr:master Nov 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants