Python: declarative Search() treats a falsy value (0, 0.0, False) as Blank and returns every row
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
Línea de trabajo
Comienza en python/packages/declarative/agent_framework_declarative/_workflows/_powerfx_functions.py, en search_table, y después revisa la cobertura existente de test_search_table_none y test_search_table_empty_value. Verifica que las búsquedas de Blank y de cadenas vacías mantengan su comportamiento actual, mientras que cero numérico, 0.0 y False coincidan con sus representaciones de cadena sin ampliar los resultados a toda la tabla.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 13.9k
- Forks
- 2.4k
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 432
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataPosiblemente ocupada @moonbox3 la tomó hace 6 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: Clarify when to use platformPosiblemente ocupada @eavanvalkenburg la tomó hace 6 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/agent-framework#8599 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
.NET Compaction - Update docs to refer to `AIContextProvider` deep divePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto.NET compaction documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
microsoft/agent-framework#4629 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: [Bug]: Public stream close does not release delegated provider responsesPosiblemente ocupada @eavanvalkenburg la tomó hoy. Abiertoag-ui python reproduced
microsoft/agent-framework#9099 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
modelcontextprotocol/python-sdk#3648 ·
Los mantenedores suelen responder en 1 día
-
docs good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
VenetoStato/giorgio#6 ·
-
Claiming namespace ddalusAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
EclipseFdn/open-vsx.org#13831 ·
Los mantenedores suelen responder en 1 día
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días