OFREP Bulk flag evaluation (Core API)

Aperta
#8,437 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Inizia con l’endpoint esistente per la valutazione degli identity flag e con gli altri endpoint fatturati, quindi confronta il loro comportamento con la specifica OFREP evaluateFlagsBulk. Implementa e testa POST /ofrep/v1/evaluate/flags in modo che copra la valutazione bulk, la persistenza, la fatturazione, ETag e le risposte condizionali, escludendo le ricerche dello stream SSE; il lavoro è completato quando tutti i criteri di accettazione sono soddisfatti.

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

Descrizione

In order to implement the OFREP specification, our Core API needs a new endpoint that evaluates all flags in an environment given a set of identity traits. The Edge API counterpart is Flagsmith/edge-api#711.

An interpretation of the specification to our data model is as the following example:

(request)

POST /ofrep/v1/evaluate/flags HTTP/1.1
Host: {flagsmith_host}
X-API-Key: {client_side_environment_key}
Content-Type: application/json

{
  "context": {
    "targetingKey": "{identity.identifier}",
    "trait1": "value1",
    "trait2": "value2"
  }
}

(response)

HTTP/1.1 200 OK
Content-Type: application/json
ETag: "{etag}"

{
  "flags": [
    {
      "key": "{feature.name}",
      "value": "{feature_state.feature_state_value}",
      "reason": "TARGETING_MATCH"
    },
    {
      "key": "{feature.name}",
      "value": {feature_state.enabled},
      "reason": "STATIC"
    },
    {
      "key": "{feature.name}",
      "value": "{multivariate_feature_option.value}",
      "reason": "SPLIT",
      "variant": "{multivariate_feature_option.key}"
    }
  ],
  "metadata": {
    "version": "{environment.updated_at}"
  }
}

Acceptance criteria

  • Our API exposes a new endpoint POST /ofrep/v1/evaluate/flags compliant to the OFREP specification. As such, the endpoint:
    • Responds with an ETag header derived from the response body.
    • Accepts an If-None-Match header which can lead to a 304 Not Modified response.
    • Serves each flag's value as its remote configuration value, falling back to the flag's enabled state when no value is set.
    • Reports each flag's evaluation reason using the vocabulary OFREP defines.
    • Is billed similarly to other billed endpoints.
    • Persists the identity and its traits on the same terms as identity flag evaluation.

[!IMPORTANT]
Server-Sent Events stream lookups are out of scope for this issue.

Lingua principale
Python
Stelle
7.1k
Fork
603
Merge medio
3g 8h
PR unite (30g)
102

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 Flagsmith/flagsmith

Tutte le issue di Flagsmith/flagsmith

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.