Experimentation: `srm_p_value` is null when default variant weights are 0, including on every final result after completion

オープン
#9,128 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
postgresql, python
領域
backend, databases

調査の方向性

Start by tracing how experiment result refreshes calculate srm_p_value while an experiment is running and after completion; the issue names no source files or tests. Compare both results against the split the experiment ran with, using the reproduction steps and arm counts as a guide. Done means the running and final results retain the SRM value for that split, or explain why it cannot be calculated.

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

説明

Describe the bug

This looks related to draft PR #8798 ("Parked: fix(experimentation): test SRM against the rollout override's split"), which describes srm_p_value being null while an experiment runs. I could not find an issue for it, so I am filing one, and adding a second case that the approach in #8798 would not seem to cover.

  1. While running. Creating an experiment sets the flag's environment-default variant weights to 0. With those defaults, results.payload.srm_p_value is null, with no warning, even with several hundred identities per variation. If the defaults are written back to the experiment's split after start, a value is returned.
  2. After completion. Completing with a rollout decision rewrites the defaults (100/0 for a variant, 0/0 for control) and removes the experiment's rollout override. The final results then always have srm_p_value: null, even when the defaults had been restored during the run and the running results had a value. The arm counts and chance-to-win values are otherwise unchanged between the last running snapshot and the final one.

Observed on self-hosted v2.295.2 (CI_COMMIT_SHA 5369ece3ff3aefbd021d2496f82a7ce0e9cd04d6), Postgres warehouse ({"warehouse_type": "postgres", "config": {"source": "flagsmith_database"}}).

Steps To Reproduce

All calls with an Organisation API key. One multivariate flag with control plus two variants (blue, green), one occurrence metric, events sent with the Python SDK 6.5.1 (get_identity_flags, track_exposure_event, track_event).

Case 1 (while running):

  1. Create the feature and its two mv-options, then PUT /api/v1/environments/{env}/featurestates/{id}/ with both variants at percentage_allocation: 33. Reading the feature state back gives 33 / 33.
  2. POST /api/v1/environments/{env}/experiments/ with experiment_rollout 33 / 33 at rollout_percentage: 100. Reading the feature state back gives 0 / 0.
  3. POST .../experiments/{id}/start/. Still 0 / 0.
  4. Send exposures for 300 identities, refresh results, read them: srm_p_value: null (arm counts 117 / 99 / 84).
  5. Repeat on a second experiment, but after step 3 PUT the defaults back to 33 / 33: srm_p_value 0.107 (arm counts 91 / 93 / 116).

Case 2 (after completion):

  1. As case 1 with the defaults restored to 33 / 33 after start, 300 identities, refresh: srm_p_value 0.933.
  2. POST .../experiments/{id}/complete/ with {"rollout_decision": "variant", "rollout_variant": <blue option id>}. The defaults now read 100 / 0, and experiment_rollout is null.
  3. After the refresh limit, POST .../results/refresh/, then read the results: is_final: true, srm_p_value: null.
  4. The same with {"rollout_decision": "control"} (defaults 0 / 0): running 0.812, final null.

I have a script that runs both cases end to end and can attach its output.

Expected behavior

srm_p_value is computed against the split the experiment actually ran with, both while running and on the final results. When it cannot be computed, the response or the UI says why, rather than returning null with no explanation. The docs describe the sample ratio mismatch warning as live, so a silent null reads as "no mismatch".

How are you running Flagsmith
  • Self-hosted with Docker
主要言語
Python
スター
9.9k
フォーク
658
平均マージ
1日 15時間
マージ済み PR(30日)
168

環境構築

はじめの一歩

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

Flagsmith/flagsmith のほかの issue

Flagsmith/flagsmith の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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