From a65c506672b67dff33ee8f7dd9529ac0b00b11c4 Mon Sep 17 00:00:00 2001 From: Xin Li <137219293+xinlili-statsig@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:19:22 -0700 Subject: [PATCH] reland hash secondary exposures and undelegated secondary exposures (#273) Reverts statsig-io/private-python-sdk#270 Original pr is https://github.com/statsig-io/private-python-sdk/pull/267 --- statsig/client_initialize_formatter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/statsig/client_initialize_formatter.py b/statsig/client_initialize_formatter.py index 02b6e3f..e37f38c 100644 --- a/statsig/client_initialize_formatter.py +++ b/statsig/client_initialize_formatter.py @@ -59,7 +59,7 @@ def config_to_response(config_name, config_spec): result = { "name": hashed_name, "rule_id": eval_result.rule_id, - "secondary_exposures": eval_result.secondary_exposures, + "secondary_exposures": hash_exposures(eval_result.secondary_exposures, hash_algo), "value": False } @@ -134,6 +134,11 @@ def populate_layer_fields(config_spec, eval_result, result, hash_algo): result["undelegated_secondary_exposures"] = eval_result.undelegated_secondary_exposures or [] + def hash_exposures(exposures: list, algo: HashingAlgorithm): + for exposure in exposures: + exposure['gate'] = hash_name(exposure['gate'], algo) + return exposures + def filter_nones(arr): return dict([i for i in arr if i is not None])