feat: allow computed fractional bucket variants

未关闭 适合新手
#482 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
json, python
领域
backend, testing

调研方向

在 Python SDK 贡献中找到 fractional bucket 的评估及其测试。阅读 bucketing 前如何评估和检查变体,然后添加一个测试,其中某个变体是类似 cat 的 JSON Logic 表达式。确认该表达式只评估一次、其结果会针对选定的 bucket 返回,并且 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 分钟
30 天内合并 PR
11

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-feature/python-sdk-contrib 的其他 Issue

查看 open-feature/python-sdk-contrib 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。