feat: allow computed fractional bucket variants

Aperta Adatta ai principianti
#482 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
json, python
Ambito
backend, testing

Direzione di ricerca

Individua la valutazione di fractional bucket e i relativi test nel contributo all’SDK Python. Leggi come vengono valutate e verificate le varianti prima del bucketing, poi aggiungi un test in cui una variante è un’espressione JSON Logic come cat. Conferma che l’espressione venga valutata una sola volta, che il suo risultato venga restituito per il bucket selezionato e che il bucketing dipenda ancora solo dal valore di bucketing e dai pesi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A fractional bucket variant can be any JSON Logic expression, not only a literal:

{
  "state": "ENABLED",
  "defaultVariant": "blue",
  "variants": {
    "red": "#FF0000",
    "blue": "#0000FF"
  },
  "targeting": {
    "fractional": [
      [{ "cat": ["r", "ed"] }, 50],
      ["blue", 50]
    ]
  }
}
  • Evaluate each variant expression once, before bucketing, and return the result for the selected bucket.
  • Don't reject a variant based on its result type. Pass the result through, and let the resolver handle it like any other targeting result.
  • Bucketing doesn't change; it depends only on the bucketing value and the weights.

This may already work, or only need a variant type check relaxed. Either way, please add a test.

Why: this allows the new resolve operator as a bucket variant (e.g. [{ "resolve": ["red", "SPLIT"] }, 50]), so each bucket can set its own reason and metadata.

References:

  • Go implementation: open-feature/flagd#2127 (the fractional.go change and the "fractional bucket variant is terminal" test in resolve_test.go)
  • Gherkin scenarios: open-feature/flagd-testbed#448
Lingua principale
Python
Stelle
27
Fork
36
Merge medio
4h 22m
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-feature/python-sdk-contrib

Tutte le issue di open-feature/python-sdk-contrib

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.