Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,18 +1425,21 @@
"FEATURE_VALUE_LIMIT must be between 0 and 2,000,000 (2MB)."
)

# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
SEGMENT_RULES_CONDITIONS_LIMIT = env.int("SEGMENT_RULES_CONDITIONS_LIMIT", 100)

# These settings are to handle large datasets / odd behaviour where rules and conditions
# often aren't returned in the order that they were created in, which the code implicitly
# expects.
# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED = env.bool(
"SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED", default=False
)

# In SaaS, we need to be able to split out rules and conditions
# (since the ordering issue has been evident on rules for longer, and
# only recently happened to conditions).
# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED = env.bool(
"SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED",
default=SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED,
Expand Down
2 changes: 2 additions & 0 deletions api/tests/unit/segments/test_unit_segments_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1997,8 +1997,10 @@ def test_update_segment__whitelisted_segment_exceeds_max_conditions__returns_200
mocker: MockerFixture,
project: Project,
segment: Segment,
settings: SettingsWrapper,
) -> None:
# Given
settings.SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED = True
WhitelistedSegment.objects.create(segment=segment)
timestamp = "2099-01-01T00:00:00Z"
over_limit_rule: SegmentRuleType = {
Expand Down
Loading