TypeScript CLI rejects --metadata with a __proto__ key
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- cli
Línea de trabajo
Empieza con metadataOf en typescript/src/cli.ts:219-226 y compara su lógica de combinación con kv, que ya maneja __proto__ de forma segura. Luego busca las pruebas de paridad de la CLI y añade un caso de --metadata para los formatos JSON y KEY=VALUE. El trabajo estará terminado cuando la CLI de TypeScript acepte y almacene metadatos con una clave propia __proto__, igual que la CLI de Python y la API.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The TypeScript CLI rejects insert text --metadata input that holds a __proto__ key, with a misleading error. The Python CLI and both APIs accept the same metadata and store it. This is the --metadata counterpart of #139, which fixed --prop.
Tested at 5a277c9 (current main), Kuzu.
Reproduce
$ selfgraph insert text "Ada Lovelace met Charles Babbage." --source-id s1 --metadata '{"__proto__": {"x": 1}, "a": 1}'
- Python CLI: succeeds and stores
metadata_json{"__proto__": {"x": 1}, "a": 1}on the source version. - TypeScript CLI:
error[invalid_argument]: metadata must be a mapping, got Object.
The KEY=VALUE form fails the same way in TypeScript:
$ selfgraph insert text "..." --source-id s2 --metadata '__proto__={"x":1}' --metadata a=1
error[invalid_argument]: metadata must be a mapping, got Object
The TypeScript API accepts the parsed object and stores the same metadata_json as Python:
await graph.insert.text("Ada Lovelace met Charles Babbage.", {
source_id: "s1",
metadata: JSON.parse('{"__proto__": {"x": 1}, "a": 1}'),
});
Cause
metadataOf in typescript/src/cli.ts:219-226 merges each value with Object.assign into a plain {}. Object.assign writes an own __proto__ key through the prototype setter, so it replaces the prototype of out instead of adding a key. requireJsonMapping then sees an object whose prototype is not Object.prototype and reports got Object. When the value is not an object, the key is silently dropped. kv already builds its map with Object.create(null) since #139, but metadataOf does not.
Suggested fix
Build the merged metadata with Object.create(null) (or define each key with Object.defineProperty / Object.fromEntries), as kv does, and add a --metadata case to the CLI parity tests.
- Lenguaje dominante
- TypeScript
- Estrellas
- 173
- Forks
- 58
- Merge medio
- 6 h
- PR fusionados (30 d)
- 120
Preparar el entorno
- 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 hydra-db/selfgraph
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
hydra-db/selfgraph#401 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: errors area: store bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
hydra-db/selfgraph#398 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: errors area: write bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
hydra-db/selfgraph#392 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
approved-for-pr area: parity area: write bug effort: S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
hydra-db/selfgraph#391 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
Todos los issues de hydra-db/selfgraph
Issues similares
-
parity: scripting.net's net-http row fails on macOS with errno 61 where the BDS golden has 111AbiertoBug Tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
JSPrismarine/JSPrismarine#3384 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
zingolabs/zingo-mobile#1951 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Automattic/data-liberation-agent#2175 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
xdelmo/Portfolio-minimal#613 ·
Los mantenedores suelen responder en 1 día
-
backend documentation low-priority Stellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Savitura/Savitools#611 · 1 comentario ·
Los mantenedores suelen responder en 6 días