Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

SyntaxNode
Copy link
Contributor

Refactor the condition check in preparation to add 3.5 defined clauses.

activityResult: ActivityAbstain,
target: ScopedName{Scope: "bidder", Name: "bidderA"},
activityResult: ActivityAllow,
},
Copy link
Contributor Author

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.

Copy link
Contributor

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
		}
	}

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, this works too.

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a 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.

@SyntaxNode
Copy link
Contributor Author

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).

@SyntaxNode
Copy link
Contributor Author

Closing. @VeronikaSolovei9 is continuing the work in #2989.

@SyntaxNode SyntaxNode closed this Jul 31, 2023
@SyntaxNode SyntaxNode deleted the gpp-phase35 branch August 28, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants