LaunchDarkly importer ANDs all segment rules and included users that LaunchDarkly ORs
I maintainer di solito rispondono entro 1 giorno
@victrvondoom ci sta già lavorando.
Dal 10/11/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read _import_segments in api/integrations/launch_darkly/services.py and the segment depth limit in api/segments/serializers.py; compare the importer test test_process_import_request__valid_segments__creates_segment_per_environment with LaunchDarkly’s _simple_segment_match_context semantics. First check whether the evaluation engine and JSON rules path support the required deeper rule tree. Done means preserving included users, per-rule ANDs, the OR across rules, and exclusions—or reporting an import error when faithful translation is unsupported.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The LaunchDarkly importer merges every rule of a segment, plus its included users, into one ALL root rule. LaunchDarkly evaluates a segment differently, so imported segments match far fewer identities than the source segment.
LaunchDarkly semantics, from its own Python SDK (ldclient/impl/evaluator.py, _simple_segment_match_context):
- Context key in
included-> in the segment. - Context key in
excluded-> not in the segment. - Otherwise in the segment if any rule matches. A rule matches if all of its clauses match.
_import_segments (api/integrations/launch_darkly/services.py, around line 1100) calls _add_clauses_to_segment_rule once per LD rule and _add_users_to_segment_rule for included, all appending to the same root_rule of type ALL. Within a single LD rule, ANDing clauses is correct. Across LD rules and the included list it turns an OR into an AND.
Repro on main at 618f0fbcc, using the existing fixture tests/unit/integrations/launch_darkly/client_responses/get_segments.json, segment dynamic-list-2:
- rule 1:
p1 in [1, 2]ANDp2 semVerGreaterThan 1.0.0 - rule 2:
p3 matches foo[0-9]{0,1} - included:
foo
I ran process_import_request(import_request) (the same call the import task makes), then created identities in the imported Test environment, set traits, and called identity.get_segments():
| identity / traits | LaunchDarkly | Flagsmith segment Dynamic List 2 (Override for test) |
|---|---|---|
foo, no traits (included) |
in segment | not in segment |
p3=foo1 only (rule 2) |
in segment | not in segment |
p1=1, p2=2.0.0 only (rule 1) |
in segment | not in segment |
foo, p1=1, p2=2.0.0, p3=foo1 |
in segment | in segment |
Only an identity that satisfies both rules and is in the included list matches. The existing test test_process_import_request__valid_segments__creates_segment_per_environment asserts this structure (the rule clauses and the included-users subrule as ANY_RULE subrules under one ALL root), so it is tested output rather than a quirk of the fixture.
The excluded handling (a NONE subrule under the ALL root) is correct.
A faithful translation needs ANY( included_key, ALL(rule1 clauses), ALL(rule2 clauses), ... ) combined with NONE(excluded), which is three levels of rule nesting. The segments API limits depth with SEGMENT_RULES_MAX_DEPTH = 2 in api/segments/serializers.py. I haven't checked whether the evaluation engine and the JSON rules path from #8245 accept deeper trees. If they do, the importer could emit that structure. If not, importing multi-rule segments as-is silently narrows targeting, and the importer could at least log an import error for any segment with more than one rule or with included users plus rules, like it already does for unmappable operators.
I can send a PR for whichever direction you prefer.
- 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
-
triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
kornia/kornia-rs#1416 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
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
PolicyEngine/ai-inequality#64 ·
I maintainer di solito rispondono entro 1 giorno
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timeForse già presa @PabloRoque l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
pymc-devs/pymc-extras#839 ·
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