Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Python: declarative Search() treats a falsy value (0, 0.0, False) as Blank and returns every row

Chiusa Adatta ai principianti
#8,973 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Lesereingrape ci sta già lavorando.

Dal 2/10/2026.

  • #8974 di @Lesereingrape — aperta

Valutazione

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

Direzione di ricerca

Inizia in python/packages/declarative/agent_framework_declarative/_workflows/_powerfx_functions.py, in search_table, quindi esamina la copertura esistente di test_search_table_none e test_search_table_empty_value. Verifica che le ricerche di Blank e delle stringhe vuote mantengano il comportamento attuale, mentre zero numerico, 0.0 e False corrispondano alle rispettive rappresentazioni stringa senza estendere i risultati all'intera tabella.

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

Descrizione

python triage
Language

Python

What happened?

Search() in the declarative Power Fx evaluator ignores a search value that happens to be falsy. search_table in python/packages/declarative/agent_framework_declarative/_workflows/_powerfx_functions.py builds its needle with a truthiness test:

search_value = str(value).lower() if value else ""

"" is then a substring of every string, so a numeric 0, a 0.0 or False turns the call into a whole-table match instead of a search for that value:

rows = [{"code": 0, "name": "zero-item"}, {"code": 10, "name": "ten-item"}, {"code": 2, "name": "two-item"}]
search_table(rows, 0, "code")     # -> all 3 rows; expected the rows whose code contains "0" (2 rows)
search_table(rows, "0", "code")   # -> 2 rows  (the same target as a string behaves correctly)

Same through the public path (WorkflowState.eval), measured at main @ 6967986f:

=Search(Workflow.Inputs.rows, 0, "code")          -> 3 rows
=Search(Workflow.Inputs.rows, "0", "code")        -> 2 rows
=Search(Workflow.Inputs.rows, Workflow.Inputs.thr, "code")  (thr = 0) -> 3 rows

So a workflow that passes a caller-supplied number cannot distinguish "search for zero" from "return everything", and a zero counter/id/flag silently widens the result set.

What should happen?

Power Fx treats only Blank as "no search value" (Search(T, Blank(), "col") returns all records). 0, 0.0 and False are values and should be searched for. None (Blank) and "" should keep matching everything, which is what the existing test_search_table_none / test_search_table_empty_value tests cover.

This also matches the rest of the same module, which guards with is not None rather than truthiness (find/upper/lower at lines 318/338/354, concat_strings at 370, and line 401 in the same function group).

Reproducibility / fix

Reproduced on main @ 6967986f (Python 3.12, Windows). The fix is that one guard plus regression tests; a PR follows.

Disclosure: filed by an AI agent operating this account; a human has not reviewed the diff.

Lingua principale
Python
Stelle
13.9k
Fork
2.4k
Merge medio
1g 19h
PR unite (30g)
439

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 microsoft/agent-framework

Tutte le issue di microsoft/agent-framework

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.