Flagsmith/flagsmith-python-client

Identity overrides don't show up when running in local evaluation mode

Closed this issue · 1 comments

I'm running the same snipped of code.
First case: local evaluation turned off.

In [3]: flagsmith.get_identity_flags("91b0797d-a489-478b-9721-53d3913d73ad")
Out[3]: Flags(flags={'shopify2_graphql_fulfillment': Flag(enabled=False, value='TEST', feature_id=99751, feature_name='shopify2_graphql_fulfillment', is_default=False)}, default_flag_handler=<function default_flag_handler at 0x7f5e45f01260>, _analytics_processor=<flagsmith.analytics.AnalyticsProcessor object at 0x7f5e42d94350>)

Notice the flag has enabled=False and value='TEST' which is exactly how it was set in Flagsmith UI.

Second case: local evaluation turned on.

In [3]: flagsmith.get_identity_flags("91b0797d-a489-478b-9721-53d3913d73ad")
Out[3]: Flags(flags={'shopify2_graphql_fulfillment': Flag(enabled=True, value=None, feature_id=99751, feature_name='shopify2_graphql_fulfillment', is_default=False)}, default_flag_handler=<function default_flag_handler at 0x7f26c5451260>, _analytics_processor=<flagsmith.analytics.AnalyticsProcessor object at 0x7f26c272a450>)

Notice the flag has enabled=True and value=None which is the default for the environment. This is not what I expect, because there's an override for this user (as shown above).

Digging a bit further, the background update process still works but Flagsmith._environment always looks like that

{
    'identity_overrides': [],
    ...
}

At the same time, updating the value for the whole environment correctly updates the local client state. Only the per-identity state is not updated.

If it helps:

flagsmith==3.6.0
flagsmith-flag-engine==5.1.1

This is a limitation of local evaluation mode in general, not this specific SDK: https://docs.flagsmith.com/clients#local-evaluation-1

Identity overrides work with self-hosted Flagsmith instances. We're rolling them out gradually for the SaaS version. If you are a SaaS customer, contact to try them out!

I'll close this issue - please reach out to Flagsmith support via the chat bubble in the bottom right or email support@flagsmith.com with details about your project if you'd like to try out identity overrides in local evaluation mode :)