feat: allow computed fractional bucket variants

オープン 初心者向け
#482 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
json, python
領域
backend, testing

調査の方向性

Python SDKへのコントリビューションで、fractional bucketの評価とそのテストを見つけてください。bucketingの前にバリアントがどのように評価、確認されるかを読み、バリアントがcatのようなJSON Logic式である場合のテストを追加してください。式が一度だけ評価され、選択されたバケットに対してその結果が返され、bucketingが引き続きbucketing値と重みだけに依存することを確認してください。

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

説明

A fractional bucket variant can be any JSON Logic expression, not only a literal:

{
  "state": "ENABLED",
  "defaultVariant": "blue",
  "variants": {
    "red": "#FF0000",
    "blue": "#0000FF"
  },
  "targeting": {
    "fractional": [
      [{ "cat": ["r", "ed"] }, 50],
      ["blue", 50]
    ]
  }
}
  • Evaluate each variant expression once, before bucketing, and return the result for the selected bucket.
  • Don't reject a variant based on its result type. Pass the result through, and let the resolver handle it like any other targeting result.
  • Bucketing doesn't change; it depends only on the bucketing value and the weights.

This may already work, or only need a variant type check relaxed. Either way, please add a test.

Why: this allows the new resolve operator as a bucket variant (e.g. [{ "resolve": ["red", "SPLIT"] }, 50]), so each bucket can set its own reason and metadata.

References:

  • Go implementation: open-feature/flagd#2127 (the fractional.go change and the "fractional bucket variant is terminal" test in resolve_test.go)
  • Gherkin scenarios: open-feature/flagd-testbed#448
主要言語
Python
スター
27
フォーク
36
平均マージ
4時間 22分
マージ済み PR(30日)
11

環境構築

はじめの一歩

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

open-feature/python-sdk-contrib のほかの issue

open-feature/python-sdk-contrib の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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