Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: use the expression string as source of truth (#6718)

Danny Xuf9e4ffbd0627
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 5cdf41b706..69da8ebbf9 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -302,10 +302,14 @@ func getApprovalTemplate(approvalSetting *storepb.WorkspaceApprovalSetting, risk
return nil, err
}
for _, rule := range approvalSetting.Rules {
- if rule.Expression == nil || rule.Expression.Expr == nil {
+ if rule.Condition == nil || rule.Condition.Expression == "" {
continue
}
- ast := cel.ParsedExprToAst(rule.Expression)
+ ast, issues := e.Compile(rule.Condition.Expression)
+ if issues != nil && issues.Err() != nil {
+ return nil, issues.Err()
+ }
+
prg, err := e.Program(ast)
if err != nil {
return nil, errors.Wrap(err, "failed to compile expression")