`feature variant update` fails with a 500: the API needs `feature` and `default_percentage_allocation` in the PATCH

Đang mở
#125 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@Anuragkumar-687 đang làm issue này rồi.

Từ ngày 28/11/2026.

  • #127 của @Anuragkumar-687 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Start with internal/api/client.go and trace the feature variant update command to the UpdateMVOption request. The API requires feature, default_percentage_allocation, and the value fields in the PATCH body; read the option first and include those fields when sending the update. Reproduce with the documented flagsmith feature variant update command and verify that the request no longer returns a 500.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

flagsmith feature variant update sends a PATCH with only the changed fields (UpdateMVOption in internal/api/client.go). Flagsmith's API doesn't support partial updates of multivariate options: MultivariateFeatureOptionSerializer.validate() reads attrs["feature"]. That was reported in Flagsmith/flagsmith#8073, which was closed with "I don't think we properly support partial PATCH requests anywhere in our API". So the command fails with a 500 every time.

Tested with CLI v2.0.0 against self-hosted Flagsmith 2.295.2.

Steps to reproduce

flagsmith feature create button-colour --value blue --enabled
flagsmith feature variant add button-colour --value red --weight 50 --yes
flagsmith feature variant update button-colour <variant-id> --key red --yes
# Error: PATCH …/features/<id>/mv-options/<variant-id>/ returned 500 Internal Server Error

What the API accepts (checked against 2.295.2):

PATCH body Result
{"key": "red"} 500
{"feature": 46, "key": "red"} 500
{"feature": 46, "key": "red", "default_percentage_allocation": 50} 200

Suggested fix: read the option first, then send feature and default_percentage_allocation (and the value fields) along with the change.

Found while building flagsmith-toolbar, whose demo is set up with the CLI.

Ngôn ngữ chính
Go
Star
14
Fork
4
Merge trung bình
3 ngày 7 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Flagsmith/flagsmith-cli

Tất cả issue của Flagsmith/flagsmith-cli

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.