`has()` and `in` treat a map entry whose value is `null` as absent
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- bun, javascript, typescript
Direzione di ricerca
Start by tracing how the map adapter handles key presence for has() and in; the issue points to that adapter as the likely fix. Run the listed examples with both plain objects and Map values, then add or update tests for null-valued entries. Done means both operators report the key as present while size() remains consistent.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @bufbuild/cel 0.6.2 (run on Bun)
A map entry whose value is null is reported as absent by has() and in, but size() still counts it. The CEL spec defines has(m.f) on a map, and k in m, as tests of whether the key is present, whatever its value.
import { run } from "@bufbuild/cel";
run("has(m.a)", { m: { a: null } }); // false, expected true
run('"a" in m', { m: { a: null } }); // false, expected true
run("has(m.a)", { m: new Map([["a", null]]) }); // false, expected true
run('"a" in {"a": null}', {}); // false, expected true
run('has({"a": null}.a)', {}); // false, expected true
run('size({"a": null})', {}); // 1n, so the entry exists
This matters when JSON data uses null to mean "present but empty": has() can't tell that apart from a missing field.
We work around it by wrapping maps before binding. The fix is probably to test key presence in the map adapter, rather than whether the value is null or undefined.
- Lingua principale
- TypeScript
- Stelle
- 42
- Fork
- 8
- Merge medio
- 1g 12h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bufbuild/cel-es
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Iterating the result of map() or filter() is quadratic, and overflows the stack at about 8,000 itemsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bufbuild/cel-es
Issue simili
-
Language request: NixApertaenhancement language
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
pngwn/twinkleplop#178 ·
-
Type: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
resend/react-email#3889 ·
I maintainer di solito rispondono entro 1 giorno
-
build P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
maniator/verticopolis#1945 ·
I maintainer di solito rispondono entro 1 giorno
-
Admin users page number stays stale after filteringForse già presa @matthewxkong l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
feature request needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100