-
Notifications
You must be signed in to change notification settings - Fork 8
fix rule eval #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix rule eval #712
Conversation
Signed-off-by: Yakir Oren <yakiroren@gmail.com>
📝 WalkthroughWalkthroughModified EvaluateRule function in the CEL rule manager to return immediately (false, nil) when encountering a nil compiled program from prior compilation failure, replacing the previous continue behavior that would skip to the next expression check. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pkg/rulemanager/cel/cel.go`:
- Around line 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.
| // Skip if program compilation failed (cached as nil) | ||
| if out == nil { | ||
| continue | ||
| return false, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| // 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.
Summary by CodeRabbit
Release Notes