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

feat: allows to define rules that are enabled when a given value is a partial match to a target attribute #1187

Merged
merged 3 commits into from
Aug 19, 2024

Conversation

3846masa
Copy link
Contributor

@3846masa 3846masa commented Aug 6, 2024

Fix #1188

This PR is a feature request.

In Bucketeer rules, there are contains (= Clause.Operator.IN), which is essentially the same behavior as Clause.Operator.PARTIALLY_MATCH.

This PR defines an Operator that can specify a condition on whether a user's attribute partially matches a given value.


This pull request introduces a new clause operator, PARTIALLY_EQUALS, and integrates it across the codebase. The changes span multiple files, including Go source files, protocol buffer definitions, and UI components.

New Clause Operator Implementation:

  • evaluation/clause_evaluator.go: Added a new case featureproto.Clause_PARTIALLY_EQUALS in the Evaluate method and implemented the partiallyEquals function to check if the target value contains any of the specified values. [1] [2]

Protocol Buffer Updates:

UI Integration:

@@ -32,6 +32,7 @@ message Clause {
AFTER = 10;
// Attribute is feature ID, and value is variation ID.
FEATURE_FLAG = 11;
PARTIALLY_EQUALS = 12;
Copy link
Member

Choose a reason for hiding this comment

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

Thank you so much for your contribution!

The PARTIALLY_MATCH is a better fit for this case.
Could you update the other places?

Suggested change
PARTIALLY_EQUALS = 12;
PARTIALLY_MATCH = 12;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cre8ivejp
I recreated the commit to have PARTIALLY_MATCH.

@cre8ivejp
Copy link
Member

@3846masa, to fix the CI issues, you must update the generated proto files using the command make proto-all at the project's root and push the changes.
Are you working in the GitHub Dev Container? If so, you just need to run the command above because the container already contains all the necessary tools. Otherwise, you will need to install the tools on your local machine.

@3846masa
Copy link
Contributor Author

3846masa commented Aug 6, 2024

@cre8ivejp
I executed make proto-all in VSCode Dev Container.

kentakozuka
kentakozuka previously approved these changes Aug 6, 2024
Copy link
Contributor

@kentakozuka kentakozuka left a comment

Choose a reason for hiding this comment

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

Thanks! Amazing improvement 🎉

@cre8ivejp
Copy link
Member

@3846masa, please rebase your branch to fix the conflict, so we can merge it.

@3846masa
Copy link
Contributor Author

@cre8ivejp I was rebased and fixed conflict.

Copy link
Member

@cre8ivejp cre8ivejp left a comment

Choose a reason for hiding this comment

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

Thank you!

@cre8ivejp cre8ivejp merged commit fe4b9c8 into bucketeer-io:main Aug 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: allows to define rules that are enabled when a given value is a partial match to a target attribute
3 participants