`feature create --variants` ignores each variant's `key`
維護者通常 2 天內回覆
評估
研究方向
從 internal/cmd/feature.go 開始,檢查 variantInput 和 variantsForWrite,然後將它們的處理方式與 feature variant add --key 進行比較。完成的標準是:--variants 的 JSON 在建立時保留每個變體的 key,並且 --variants 的說明資訊列出可接受的欄位。
由索引模型根據 Issue 內容生成。
描述
variantInput in internal/cmd/feature.go only has value and weight, so a key in the --variants JSON is silently dropped (json.Unmarshal ignores unknown fields).
The key matters for Experimentation: exposures are recorded under the variant's key, so a variant without one can't be told apart in an experiment's results. And setting the key afterwards with feature variant update --key fails (https://github.com/Flagsmith/flagsmith-cli/issues/125).
Steps to reproduce (CLI v2.0.0, self-hosted Flagsmith 2.295.2)
flagsmith feature create pricing_layout --value monthly_first --enabled \
--variants '[{"key":"annual_first","value":"annual_first","weight":50}]'
flagsmith feature get pricing_layout --json --jq .variants
# [{"id":2,"value":"annual_first","weight":50}] <- no key
Expected: the variant keeps "key": "annual_first", the way feature variant add --key does.
Suggested fix: add Key string `json:"key"` to variantInput, and set it on the MultivariateOption in variantsForWrite. It could help to list the accepted fields in the --variants help too.
Workaround: create the feature first, then add each variant with flagsmith feature variant add <feature> --value … --key … --weight ….
- 主要語言
- Go
- 星號
- 14
- 分支
- 4
- 平均合併
- 3 天 7 小時
- 30 天內合併 PR
- 4
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Flagsmith/flagsmith-cli 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
Flagsmith/flagsmith-cli#128 ·
維護者通常 2 天內回覆
-
`feature variant update` fails with a 500: the API needs `feature` and `default_percentage_allocation` in the PATCH可能已有人在做 @Anuragkumar-687 今天認領。 未關閉
難度 3/5 半天 新手友好度 45/100
Flagsmith/flagsmith-cli#125 ·
維護者通常 2 天內回覆
-
難度 3/5 1-2 天 新手友好度 68/100
Flagsmith/flagsmith-cli#107 · 1 則留言 ·
維護者通常 2 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
Flagsmith/flagsmith-cli#93 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 25/100
Flagsmith/flagsmith-cli#90 ·
維護者通常 2 天內回覆
查看 Flagsmith/flagsmith-cli 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
provider-key submission
難度 1/5 1 小時以內 新手友好度 85/100
opentofu/registry#6740 · 1 則留言 ·
維護者通常 1 天內回覆
-
type:bug
難度 2/5 1-3 小時 新手友好度 68/100
nightgauge/nightgauge#3713 ·
維護者通常 1 天內回覆
-
fix: restore GitHub issue templates and check their license headers可能已有人在做 @slievrly 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 2 天內回覆