Skip to content
Merged
Changes from 2 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 builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func (bldr *builder) processStandardRules(
}
}
// Try native Go evaluators for known simple rules before falling back to CEL.
if !fdesc.IsMap() && !fdesc.IsList() {
if !fdesc.IsMap() && (!fdesc.IsList() || valEval.NestedRule != nil) {

@jonbodner-buf jonbodner-buf Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's already a case on lines 481-485 to handle repeated rules when there are no nested rules. Should the fix be to eliminate the check for nested rules in the earlier code? I haven't looked at this code in a while, I might be missing a detail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not quite. Those lines are to figure out when to evaluate rules related to list-level rules. However, you do have a point that this code is confusingly organized here. I switched this to use a much more understandable switch statement.

To be clear, the logic error is that this section REQUIRES NestedRules to be set, aka != nil, so it's different than the case above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The switch isn't quite the same logic as before. The default case used to only process scalar values. Now it will process fdesc.IsList() and feds.IsMap() when valEval.NestedRule != nil . If that works correctly, great.

if native := bldr.tryNativeRules(fdesc, rules, valEval); native != nil {
valEval.Append(native)
}
Expand Down
Loading