Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/rulemanager/cel/cel.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (c *CEL) EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.Ru

// Skip if program compilation failed (cached as nil)
if out == nil {
continue
return false, nil
}
Comment on lines 184 to 187
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update the comment to match the new short-circuit behavior.

The code now returns false, nil rather than skipping, so the comment is misleading.

📝 Suggested update
-		// Skip if program compilation failed (cached as nil)
+		// Short-circuit as false if program compilation failed (cached as nil)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Skip if program compilation failed (cached as nil)
if out == nil {
continue
return false, nil
}
// Short-circuit as false if program compilation failed (cached as nil)
if out == nil {
return false, nil
}
🤖 Prompt for AI Agents
In `@pkg/rulemanager/cel/cel.go` around lines 184 - 187, Update the misleading
comment above the short-circuit that checks the compiled program (the block that
tests "if out == nil { return false, nil }") so it accurately describes the new
behavior: instead of "Skip if program compilation failed (cached as nil)"
explain that the function returns false, nil when the compiled program is nil
(e.g., compilation failed or cached as nil). Locate the check referencing the
variable `out` and the `return false, nil` statement and replace the comment
text to reflect this return behavior.


boolVal, ok := out.Value().(bool)
Expand Down
Loading