-
Notifications
You must be signed in to change notification settings - Fork 769
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
Activity Control - Refactor Condition Check #2921
Conversation
activityResult: ActivityAbstain, | ||
target: ScopedName{Scope: "bidder", Name: "bidderA"}, | ||
activityResult: ActivityAllow, | ||
}, |
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.
Per the spec:
Note that rules can have no conditions, in which case they automatically match and the "allow" value is utilized.
I don't expect to see this actually used, but this requirement simplifies the evaluation logic.
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.
Ok, but it doesn't really make sense. Should it be a validation error? Should we skip Evaluation to the next rule?
Allow is always true or false which means we will always return without further checking (after first rule without conditions):
for _, rule := range p.rules {
result := rule.Evaluate(target)
if result == ActivityDeny || result == ActivityAllow {
return result
}
}
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.
which means we will always return without further checking (after first rule without conditions)
You're right.
Per the spec, processing will end at the first rule without conditions and that "allow" value will be used. I don't expect any host to actually set a rule without conditions, but if it does happen somehow I'm cool with what the spec defines. I think we can argue either way on that behavior and this way is simpler to code.
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.
Ok, this works too.
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.
Looks good to me, just have one question.
Let's merge your two open PRs first. I rather ship that functionality first and can update this PR to handle the merge conflicts (due to renaming Allow -> Evaluate). |
Closing. @VeronikaSolovei9 is continuing the work in #2989. |
Refactor the condition check in preparation to add 3.5 defined clauses.