Skip to content

Commit 9691157

Browse files
committed
docs(flags): clarify empty flag key scope
1 parent 6a76463 commit 9691157

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

posthog/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,9 +1077,10 @@ def evaluate_flags(
10771077
only_evaluate_locally: If ``True``, never fall back to remote evaluation and
10781078
omit flags that cannot be evaluated locally.
10791079
disable_geoip: Whether to disable GeoIP lookup.
1080-
flag_keys: Optional list that scopes local evaluation, the underlying ``/flags``
1081-
request, and the returned snapshot. A requested key absent from loaded local
1082-
definitions is included in one remote fallback per ``evaluate_flags`` call unless
1080+
flag_keys: Optional non-empty list that scopes local evaluation, the underlying
1081+
``/flags`` request, and the returned snapshot. An empty list is treated like ``None``
1082+
and evaluates all flags. A requested key absent from loaded local definitions is
1083+
included in one remote fallback per ``evaluate_flags`` call unless
10831084
``only_evaluate_locally`` is ``True``. If the server also does not know the key, it is
10841085
omitted from the snapshot.
10851086
device_id: Optional device ID override. If not provided, falls back to the

posthog/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4044,8 +4044,9 @@ def evaluate_flags(
40444044
only_evaluate_locally: If True, never fall back to remote evaluation —
40454045
flags that can't be evaluated locally are simply omitted from the snapshot.
40464046
disable_geoip: Whether to disable GeoIP lookup.
4047-
flag_keys: Optional list that scopes local evaluation, the underlying ``/flags``
4048-
request, and the returned snapshot. A requested key absent from loaded local
4047+
flag_keys: Optional non-empty list that scopes local evaluation, the underlying
4048+
``/flags`` request, and the returned snapshot. An empty list is treated like
4049+
``None`` and evaluates all flags. A requested key absent from loaded local
40494050
definitions is included in one remote fallback per ``evaluate_flags`` call unless
40504051
``only_evaluate_locally`` is True. If the server also does not know the key, it is
40514052
omitted from the snapshot.
@@ -4095,6 +4096,7 @@ def evaluate_flags(
40954096
)
40964097
)
40974098
groups = groups or {}
4099+
# Keep the existing API convention that an empty list means no scope.
40984100
requested_keys = set(flag_keys) if flag_keys else None
40994101

41004102
records: Dict[str, _EvaluatedFlagRecord] = {}

0 commit comments

Comments
 (0)