Context
Routing rules in the governance plugin are CEL expressions. When a rule's expression is empty or obviously malformed, the failure today is generic and surfaces late, which makes routing misconfigurations hard to debug. A small, focused validation helper with friendly messages improves the operator experience without changing routing behavior for valid rules.
What to do
- Add a helper in
deepintshield_server/plugins/governance/routing.go:
func validateRoutingExpression(expr string) error
covering:
- Empty or whitespace-only expression ->
"CEL expression cannot be empty or whitespace-only".
- No condition operator present (none of
==, !=, in, contains, etc.) -> "CEL expression must contain at least one condition operator (==, !=, in, contains, etc.)".
- Call it before expression compilation in the evaluation path (e.g. within
EvaluateRoutingRules / before validateCELExpression), so invalid rules fail fast with a clear message.
- Keep existing behavior for valid expressions unchanged.
Acceptance criteria
File pointers
- Routing engine + evaluation:
deepintshield_server/plugins/governance/routing.go (EvaluateRoutingRules:79, extractRoutingVariables:312, validateCELExpression:408)
- Tests:
deepintshield_server/plugins/governance/routing_test.go
Context
Routing rules in the governance plugin are CEL expressions. When a rule's expression is empty or obviously malformed, the failure today is generic and surfaces late, which makes routing misconfigurations hard to debug. A small, focused validation helper with friendly messages improves the operator experience without changing routing behavior for valid rules.
What to do
deepintshield_server/plugins/governance/routing.go:"CEL expression cannot be empty or whitespace-only".==,!=,in,contains, etc.) ->"CEL expression must contain at least one condition operator (==, !=, in, contains, etc.)".EvaluateRoutingRules/ beforevalidateCELExpression), so invalid rules fail fast with a clear message.Acceptance criteria
validateRoutingExpressionadded with the two checks and exact messages above.routing_test.goasserting the error messages and that valid expressions pass.go test ./plugins/governance/...passes.File pointers
deepintshield_server/plugins/governance/routing.go(EvaluateRoutingRules:79, extractRoutingVariables:312, validateCELExpression:408)deepintshield_server/plugins/governance/routing_test.go