fix(api): the feature-flag list has no defined order across pages

Aperta Adatta ai principianti
#1,612 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@amarkanday ci sta già lavorando.

Dal 4/11/2026.

  • #1732 di @amarkanday — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, python
Ambito
api, backend, database

Direzione di ricerca

Inizia da get_multi in backend/app/crud/base.py, che costruisce la query paginata con offset senza ORDER BY, e segui il percorso a partire dall'handler GET /api/v1/feature-flags/. Aggiungi un ordinamento deterministico, ad esempio created_at e poi id, e verifica che la lista dei feature flag restituisca ancora lo stesso totale. È completato quando pagine consecutive skip/limit suddividono i flag senza sovrapposizioni, verificato da un test di paginazione. Se esiste sdk/mcp/tools.json, aggiorna la descrizione di list_feature_flags in modo che corrisponda.

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

Descrizione

bug

GET /api/v1/feature-flags/ pages with skip and limit, but the query behind it has no ORDER BY (backend/app/crud/base.py, get_multi: offset paging with no order). PostgreSQL then returns rows in whatever order the plan produces, which can change between two requests.

What goes wrong: a client that pages through the list (the dashboard, a script, an SDK helper, the planned MCP server's list_feature_flags) can see a flag on two pages, or on none, when the order shifts between page requests. total is still right; only the page contents are unstable.

Expected: a defined, stable order for the list (for example created_at then id), so that consecutive pages partition the flags.

When it is fixed: the fix also updates the description of list_feature_flags in sdk/mcp/tools.json (if sdk/mcp exists by then), which today says the list has no defined order, and restores the paging half of that tool's contract test.

Found while planning the MCP server (#1607). Priority is set in the pre-launch bug triage.

Lingua principale
Python
Stelle
0
Fork
4
Merge medio
5h 19m
PR unite (30g)
503

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 Controlvar/controlvar

Tutte le issue di Controlvar/controlvar

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.