Skip to content

Commit 2c0971d

Browse files
committed
[FSSDK-12760] Tighten holdout scope docstrings/comments
Condense the spec §5 cleanup comments to one-line/short-docstring form per updated spec guidance. Same content, more compact.
1 parent 3754fcd commit 2c0971d

2 files changed

Lines changed: 8 additions & 25 deletions

File tree

optimizely/entities.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,8 @@ def __init__(
233233
self.trafficAllocation = trafficAllocation
234234
self.audienceIds = audienceIds
235235
self.audienceConditions = audienceConditions
236-
# Per-rule targeting list for local holdouts. Scope is NOT determined by this
237-
# field — it is determined by which datafile section the entity was parsed
238-
# from ('holdouts' = global, 'localHoldouts' = local). ProjectConfig strips
239-
# this field on entries parsed from the 'holdouts' section so that entities
240-
# built from that section always satisfy is_global. See FSSDK-12760.
236+
# Per-rule targeting for local holdouts. Scope comes from the datafile
237+
# section, not this field; ProjectConfig strips it on 'holdouts' entries.
241238
self.included_rules: Optional[list[str]] = includedRules
242239

243240
def get_audience_conditions_or_ids(self) -> Sequence[str | list[str]]:
@@ -250,22 +247,11 @@ def get_audience_conditions_or_ids(self) -> Sequence[str | list[str]]:
250247

251248
@property
252249
def is_global(self) -> bool:
253-
"""Check if this is a global holdout (applies to all rules across all flags).
250+
"""True if this is a global holdout.
254251
255-
Authoritative scope is the datafile section the entity came from:
256-
the top-level 'holdouts' section is global, 'localHoldouts' is local.
257-
ProjectConfig enforces this by stripping 'includedRules' from entries
258-
parsed out of the 'holdouts' section before constructing the entity,
259-
so for entities built via ProjectConfig this property is consistent
260-
with section membership.
261-
262-
At the entity level the property is still computed from
263-
``included_rules`` for code holding entity references directly:
264-
None → global, [] or non-empty list → local. An empty list is a
265-
local holdout that targets no rules (distinct from None/global).
266-
267-
Returns:
268-
True if included_rules is None (global), False otherwise (local).
252+
Scope is set by the datafile section ('holdouts' vs 'localHoldouts').
253+
ProjectConfig strips 'includedRules' on 'holdouts' entries, so this
254+
property stays consistent with section membership.
269255
"""
270256
return self.included_rules is None
271257

optimizely/helpers/types.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ class HoldoutDict(ExperimentDict):
130130
Extends ExperimentDict with holdout-specific properties.
131131
"""
132132
holdoutStatus: HoldoutStatus
133-
# Per-rule targeting list for local holdouts. Holdout scope is determined by which
134-
# top-level datafile section the entry appears in ('holdouts' vs 'localHoldouts'),
135-
# NOT by this field. On 'holdouts'-section entries this field is ignored and
136-
# stripped at parse time (see ProjectConfig). On 'localHoldouts'-section entries
137-
# the field is required; missing or None is an error and the entry is excluded.
133+
# Per-rule targeting for local holdouts. Scope comes from the datafile section,
134+
# not this field; required on 'localHoldouts' entries, stripped on 'holdouts'.
138135
includedRules: Optional[list[str]]

0 commit comments

Comments
 (0)