Identity overrides don't work in offline local evaluation mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start in flagsmith/flagsmith.py at the offline-handler loading path around line 117 and the API-update path around line 273; trace how identity_overrides are represented in the local file. Verify that offline local evaluation applies the override for identifier 146433 while preserving normal feature-state behavior, and add or run regression coverage for the case.
Written by the indexing model from the issue text.
Description
I'm using version 3.8.0 and have identity overrides enabled for my environment.
I'm using a copy of a config for local development and initialize Flagsmith as follows:
local_file_handler = LocalFileHandler(
environment_document_path=f"./feature_flags_configuration.local.json"
)
flagsmith = Flagsmith(
environment_key=settings.FLAGSMITH_API_KEY,
enable_local_evaluation=True,
offline_handler=local_file_handler,
offline_mode=True,
)
I have following settings on my config:
"feature_states": [
{
"feature": {
"id": 103972,
"name": "ipqs_geo_ip",
"type": "STANDARD"
},
"enabled": true,
"django_id": 576867,
"feature_segment": null,
"featurestate_uuid": "04dcc7d5-b387-4668-8264-d30a2da2e111",
"feature_state_value": null,
"multivariate_feature_state_values": []
}
],
"identity_overrides": [
{
"identifier": "146433",
"environment_api_key": ...,
"created_date": "2024-08-26T17:45:31.959128Z",
"identity_features": [
{
"feature": {
"id": 103972,
"name": "ipqs_geo_ip",
"type": "STANDARD"
},
"enabled": false,
"django_id": null,
"feature_segment": null,
"featurestate_uuid": "964dd1e9-b34a-4bf7-9984-937abbba3f0e",
"feature_state_value": null,
"multivariate_feature_state_values": []
}
],
"identity_traits": [],
"identity_uuid": "8fd6de03-b834-41d2-b5ec-7076d00e6cd3",
"django_id": null,
"composite_key": "cfWNJQwEQkcAiKxSPFL2rv_146433"
}
],
However, identity overrides are ignored unless I disable offline mode.
The root cause must be that it is updated only here when API request is made and are not loaded from offline handler here.
In production, I'm also using the local file as a fallback for the case when Flagsmith is unavailable during app start, so it might become a problem in production in rare cases.
- Dominant language
- Python
- Stars
- 24
- Forks
- 12
- Avg merge
- 15h 43m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Flagsmith/flagsmith-python-client
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Dependency Dashboard Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Flagsmith/flagsmith-python-client#198 · 1 comment · 2 assignees ·
All issues in Flagsmith/flagsmith-python-client
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100