Identity overrides don't work in offline local evaluation mode

オープン
#109 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

flagsmith/flagsmith.py の 117 行付近にあるオフラインハンドラーの読み込みパスと、273 行付近にある API 更新パスから開始し、ローカルファイル内で identity_overrides がどのように表現されているかを追跡します。オフラインのローカル評価で識別子 146433 に対する override が適用され、通常の feature-state の動作が維持されることを確認し、このケースのリグレッションテストカバレッジを追加または実行します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
24
フォーク
12
平均マージ
15時間 43分
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Flagsmith/flagsmith-python-client のほかの issue

Flagsmith/flagsmith-python-client の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。