Skip to content

Conversation

@zachaysan
Copy link
Contributor

@zachaysan zachaysan commented Oct 28, 2024

Changes

Fixes Flagsmith/flagsmith#4399

Presently the rules and conditions associated with a segment are not enforced to match the segment that they're included in. This PR enforces that the segments match by throwing a validation error.

Testing

Tests were done in the main repo in this PR.

Copy link
Member

@khvn26 khvn26 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, with one minor typing comment.

Comment on lines +260 to +261
rule: models.Model,
segment: models.Model | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

This is clearly out of the scope of this PR, but maybe we should define common abstract models in the flagsmith-common package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be in favour of this.

@zachaysan zachaysan merged commit d36be97 into main Dec 3, 2024
1 check 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.

Update requests to segments should not modify other segments

3 participants