LaunchDarkly importer sets 0% for every variation on multivariate rule overrides

Đang mở
#9,033 1 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 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
28/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, databases

Hướng nghiên cứu

Read api/integrations/launch_darkly/services.py around the rule variation handling at lines 675 and 749, then inspect the LaunchDarkly tests using TEST_TARGETED_CONTEXT. Confirm that a fixed variation is imported at 100% and the other variations at 0%, and run the LaunchDarkly test suite. The issue says a fix and regression tests already exist on a contributor's branch, so check that work before starting.

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

Mô tả

How are you running Flagsmith

Some other way: local development from main (6e0f9da)

Context

We came across this while using the LaunchDarkly importer in a project of ours, while building an end-to-end check for #8721. Since we had already traced the cause, we are reporting it here together with a fix, rather than just flagging the problem.

Describe the bug

For a multivariate flag, a LaunchDarkly rule that serves a fixed variation (e.g. "beta testers get new") is imported as a segment override with 0% for every variation, so matching users get the control value instead of new.

LaunchDarkly gives the rule's variation as an integer ("variation": 0). services.py#L749 passes it unchanged, with a # type: ignore[arg-type] that hides the mismatch, and L675 compares it with string keys (0 == "0"), which is never true. Individual targets already convert it with str() (L575).

Steps To Reproduce
  1. Import a multivariate LaunchDarkly flag with a rule that serves a fixed variation.
  2. Open the resulting segment override.
  3. Every variation shows 0%.

With the existing test data, TEST_TARGETED_CONTEXT's rule overrides (Regular And, Reverted And, Just Not) are all 0% / 0% / 0% / 0%.

Expected behavior

The rule's variation gets 100% and the others 0%, as for individual targets.

Fix

We have already fixed this, with regression tests (all LaunchDarkly tests pass, 100% diff coverage, mypy clean):

If it helps, please feel free to assign this issue to me and I will open a PR from that branch.

Ngôn ngữ chính
Python
Star
9.9k
Fork
658
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
168

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

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

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

Issue tương tự

Thêm issue về Python

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.