-
Notifications
You must be signed in to change notification settings - Fork 6
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: Add segment types, segment metadata, identity override segments support #198
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ class SegmentModel(BaseModel): | |
name: str | ||
rules: typing.List[SegmentRuleModel] = Field(default_factory=list) | ||
feature_states: typing.List[FeatureStateModel] = Field(default_factory=list) | ||
meta: typing.Optional[typing.Dict[str, str]] = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this should be at least a typed dict? Maybe one for a little further down the line when we know exactly what we need in the meta dict? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's two reasons I don't want to impose a typed dict here yet:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
trait_key_3 = "date_joined" | ||
trait_value_3 = "2021-01-01" | ||
|
||
identifier = "identity_1" | ||
|
||
empty_segment = SegmentModel(id=1, name="empty_segment") | ||
segment_single_condition = SegmentModel( | ||
|
@@ -148,3 +149,23 @@ | |
) | ||
], | ||
) | ||
segment_identity_override = SegmentModel( | ||
id=7, | ||
name="segment_identity_override", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We talked about this being unique in someway, right? Should we illustrate that even in this test data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
rules=[ | ||
SegmentRuleModel( | ||
type=constants.ALL_RULE, | ||
conditions=[ | ||
SegmentConditionModel( | ||
operator=constants.EQUAL, | ||
property_=constants.SEGMENT_IDENTIFIER_PROPERTY_NAME, | ||
value=identifier, | ||
) | ||
], | ||
) | ||
], | ||
meta={ | ||
"identity_identifier": identifier, | ||
"type": "IDENTITY_OVERRIDE", | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
) |
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.
I kind of feel like we could generalise this to just the prefix? So e.g.
_$identity.identity_uuid
would also work? Maybe that's a bit YAGNI?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.
In the future, maybe we'll want it to. Maybe we'll have other entities participating in the matching, e.g.
$_contexts.org.location
.