Skip to content

Commit 80837bd

Browse files
Add warning for ignored 'includedRules' in global holdouts
1 parent 5bd0a17 commit 80837bd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

optimizely/project_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,13 @@ def __init__(self, datafile: str | bytes, logger: Logger, error_handler: Any):
103103
# Drop any 'includedRules' field on entries here so the entity is unambiguously
104104
# global (is_global → True), even if the datafile incorrectly includes one.
105105
for holdout_data in global_holdouts_data:
106-
# Copy the typed dict and remove includedRules without losing its shape.
107106
sanitized = cast(types.HoldoutDict, dict(holdout_data))
108-
sanitized.pop('includedRules', None) # type: ignore[misc]
107+
if sanitized.pop('includedRules', None) is not None: # type: ignore[misc]
108+
self.logger.warning(
109+
f'Global holdout "{holdout_data.get("key", "")}" '
110+
f'(id: {holdout_data.get("id", "<unknown>")}) has "includedRules" '
111+
f'which will be ignored; global holdouts apply to all flags.'
112+
)
109113
holdout = entities.Holdout(**sanitized)
110114
self.holdouts.append(holdout)
111115

0 commit comments

Comments
 (0)