LaunchDarkly importer links segment overrides to another environment's segment
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start with _create_segments_from_ld in api/integrations/launch_darkly/services.py and trace how imported segments are associated with environment-specific flag overrides. Review the existing LaunchDarkly tests, especially the TEST_SEGMENT_TARGET case, and add regression coverage showing that each environment’s override uses its own imported segment. The issue reports that a fix and regression tests already exist on the reporter’s branch, so coordinate before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
The importer creates one segment per LaunchDarkly segment and environment, e.g. Beta testers (Override for test) and Beta testers (Override for production). However, _create_segments_from_ld stores them keyed by segment key only (services.py#L1112), so each environment overwrites the previous one. Flag rules using segmentMatch then link every environment's override to the last environment's segment.
As a result, if a segment has different members per environment, users in one environment are targeted using another environment's members, and editing the Test segment has no effect on Test.
Steps To Reproduce
- Import a LaunchDarkly project with two environments, a segment whose members differ per environment, and a flag with a
segmentMatchrule on that segment. - Open the flag's segment overrides in the Test environment.
- The override uses
… (Override for production).
This also reproduces with the existing test data: for TEST_SEGMENT_TARGET, the Test environment's overrides are User List, Dynamic List and Dynamic List 2 (Override for production).
Expected behavior
Each environment's override uses the segment imported for that environment.
Related: #7332 would avoid this by design. This is a smaller fix for the current structure.
Fix
We have already fixed this, with regression tests (all LaunchDarkly tests pass, 100% diff coverage, mypy clean):
- Fix branch: https://github.com/Ayush-e4/flagsmith/tree/fix/ld-importer-env-segments-and-mv-rules
- Sample app, root cause and before/after results: https://github.com/Ayush-e4/flagsmith/tree/sample-apps/sample-apps/launchdarkly-import-bugs
If it helps, please feel free to assign this issue to me and I will open a PR from that branch.
- Lingua principale
- Python
- Stelle
- 9.9k
- Fork
- 658
- Merge medio
- 1g 15h
- PR unite (30g)
- 168
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Flagsmith/flagsmith
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Flagsmith/flagsmith#9119 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Fix Button Alignment in SDK Installation SectionForse già presa @manueldezman l’ha presa 3 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Flagsmith/flagsmith#9056 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Cloud Python warehouse snippet omits the import needed by its short-lived-job guidanceForse già presa @jcd1991 l’ha presa 4 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
Flagsmith/flagsmith#9045 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Expose whether an organisation is blocked for API usageForse già presa @PiUnknown l’ha presa 38 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Flagsmith/flagsmith#8773 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
influx_query_manager doesn't catch ApiException, so Influx error responses 500Forse già presa @SAY-5 l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Flagsmith/flagsmith#8510 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Flagsmith/flagsmith
Issue simili
-
ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
I maintainer di solito rispondono entro 1 giorno
-
CI: MSYS2 jobs fail — mingw python3 package renamed upstream to pythonForse già presa @ronaldtse l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pydantic/pytest-examples#102 · 1 commento ·