PERCENTAGE_SPLIT: implement engine's 1-in-9999 recursion edge case in SQL

Aperta
#4 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python, sql
Ambito
databases

Direzione di ricerca

Individua l’implementazione SQL inline di PERCENTAGE_SPLIT e confronta la sua gestione di bare-hash con la semantica del motore descritta nell’issue. Implementa e verifica la ricorsione dell’input raddoppiato per bare_hash_mod = 9998, limitata a 2-3 iterazioni, e conferma che gli input ordinari mantengano i risultati esistenti.

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

Descrizione

The pure-SQL PERCENTAGE_SPLIT hash diverges from the engine on the ~1/9999 inputs where the bare hash mod 9999 == 9998 (the engine recurses with doubled input; this implementation skips).

Real-world impact at typical thresholds: ~0.005% false-negative rate on the count of identities matching a percentage-split segment. At 870M with threshold 50, that's ~22k false-negatives across the env — a rounding error on a count-badge UI but a measurable bias if anyone uses the count for billing or contract decisions.

What to ship

Implement the recursion as a CASE WHEN bare_hash_mod = 9998 THEN <recursive hash> ELSE <main hash> END wrapper in the inline SQL. The recursive hash uses doubled input: seg_key || ',' || value || ',' || seg_key || ',' || value. Cap at 2-3 iterations (engine recurses arbitrarily but in practice the second iteration almost always lands at non-9998).

Why deferred

Sub-0.005% bias on a UI count is below the threshold that customers care about. Defer until a customer reports a discrepancy or until the engine's bucketing semantics change.

Lingua principale
Python
Stelle
1
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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-sql-flag-engine

Tutte le issue di Flagsmith/flagsmith-sql-flag-engine

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.