feat: allow computed fractional bucket variants

Aberta Para iniciantes
#482 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
77/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
json, python
Domínio
backend, testing

Direção de pesquisa

Encontre a avaliação de fractional bucket e seus testes na contribuição para o SDK Python. Leia como as variantes são avaliadas e verificadas antes do bucketing e, em seguida, adicione um teste em que uma variante seja uma expressão JSON Logic, como cat. Confirme que a expressão é avaliada uma única vez, que o resultado dela é retornado para o bucket selecionado e que o bucketing continua dependendo apenas do valor de bucketing e dos pesos.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
Python
Estrelas
27
Forks
36
Merge médio
4h 22min
PRs com merge (30d)
11

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de open-feature/python-sdk-contrib

Todas as issues de open-feature/python-sdk-contrib

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.