feat: allows to define rules that are enabled when a given value is a partial match to a target attribute #1187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #1188
This PR is a feature request.
In Bucketeer rules, there are
contains
(=Clause.Operator.IN
), which is essentially the same behavior asClause.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 casefeatureproto.Clause_PARTIALLY_EQUALS
in theEvaluate
method and implemented thepartiallyEquals
function to check if the target value contains any of the specified values. [1] [2]Protocol Buffer Updates:
proto/feature/clause.pb.go
: IntroducedClause_PARTIALLY_EQUALS
with value12
and updated the corresponding maps and descriptors to include this new operator. [1] [2] [3] [4] [5] [6]proto/feature/clause.proto
: AddedPARTIALLY_EQUALS
to theClause
enum.UI Integration:
ui/web-v2/src/assets/lang/en.json
: Added the English translation for thepartiallyEqual
operator.ui/web-v2/src/assets/lang/ja.json
: Added the Japanese translation for thepartiallyEqual
operator.ui/web-v2/src/components/FeatureTargetingForm/index.tsx
: Included thePARTIALLY_EQUALS
operator in the clause comparison operator options.ui/web-v2/src/lang/messages.ts
: Defined the message for thepartiallyEqual
operator.ui/web-v2/src/proto/feature/clause_pb.js
: Updated theClause.Operator
object to includePARTIALLY_EQUALS
.