data.ingest() silently stores empty objects for the NonReferenceInputs form its type signature accepts
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- database
Direzione di ricerca
Inizia in src/collections/data/index.ts, alla firma di ingest intorno alla riga 88 e al ciclo intorno alle righe 251-257. Confronta la relativa gestione con insert intorno alla riga 287 e con la definizione di DataGuards.isDataObject in src/collections/serialize/index.ts:355. Verifica la riproduzione per gli input avvolti e non avvolti; il lavoro è completato quando le proprietà non avvolte vengono memorizzate e il comportamento di successo riportato rimane corretto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
collection.data.ingest() accepts NonReferenceInputs<T> (the unwrapped { title: 'x' } form) in its type signature, but silently stores objects with no properties when given that form. The call reports success: UUIDs are returned, errors is empty, and hasErrors is false.
collection.data.insertMany() handles the same unwrapped input correctly, so the two batch entry points disagree on an input shape they both claim to accept.
This is silent data loss. A caller following the type signature gets a clean success response and an empty collection.
The type signature accepts the unwrapped form
src/collections/data/index.ts:88:
ingest: (objs: Iterable<DataObject<T> | NonReferenceInputs<T>>) => Promise<BatchObjectsReturn<T>>;
The implementation does not normalize it
src/collections/data/index.ts:251-257:
for (const obj of objs) {
// eslint-disable-next-line no-await-in-loop
await batching.addObject({
collection: name,
...obj, // <-- spread directly
tenant,
});
}
For a DataObject<T> the spread yields { collection, properties, tenant } and works. For a NonReferenceInputs<T> it yields { collection, title, tenant } — properties is never set, so the object is created empty.
Compare insert in the same file, :287, which normalizes exactly this case:
parseObject(
obj ? (DataGuards.isDataObject(obj) ? obj : ({ properties: obj } as InsertObject<T>)) : obj
),
DataGuards.isDataObject is defined at src/collections/serialize/index.ts:355 and is already the established guard for this discrimination. ingest never calls it.
Reproduction
import weaviate from 'weaviate-client';
const client = await weaviate.connectToLocal();
async function fresh(name) {
if (await client.collections.exists(name)) await client.collections.delete(name);
return client.collections.create({
name,
properties: [{ name: 'title', dataType: 'text' }],
vectorizers: weaviate.configure.vectors.selfProvided(),
});
}
// A — unwrapped NonReferenceInputs form
const a = await fresh('ReproIngestUnwrapped');
const ra = await a.data.ingest([{ title: 'alpha' }, { title: 'beta' }]);
console.log('uuids:', Object.keys(ra.uuids).length, 'errors:', Object.keys(ra.errors).length, 'hasErrors:', ra.hasErrors);
for await (const o of a.iterator()) console.log('STORED:', JSON.stringify(o.properties));
// B — wrapped DataObject form
const b = await fresh('ReproIngestWrapped');
await b.data.ingest([{ properties: { title: 'alpha' } }, { properties: { title: 'beta' } }]);
for await (const o of b.iterator()) console.log('STORED:', JSON.stringify(o.properties));
// C — insertMany with the same unwrapped form
const c = await fresh('ReproInsertMany');
await c.data.insertMany([{ title: 'alpha' }, { title: 'beta' }]);
for await (const o of c.iterator()) console.log('STORED:', JSON.stringify(o.properties));
Actual output
A: data.ingest([{ title: "..." }]) <- NonReferenceInputs form
reported uuids : 2
reported errors : 0
hasErrors : false
STORED PROPERTIES: {}
STORED PROPERTIES: {}
B: data.ingest([{ properties: { title } }]) <- DataObject form
reported uuids : 2
STORED PROPERTIES: {"title":"beta"}
STORED PROPERTIES: {"title":"alpha"}
C: data.insertMany([{ title: "..." }]) <- same unwrapped form
STORED PROPERTIES: {"title":"alpha"}
STORED PROPERTIES: {"title":"beta"}
Expected
Case A should store {"title":"alpha"} and {"title":"beta"}, matching cases B and C.
If the unwrapped form is not intended to be supported by ingest, then the type signature at :88 should drop NonReferenceInputs<T> so this fails at compile time rather than silently at runtime.
Suggested fix
Apply the same normalization insert already uses, inside the ingest loop:
for (const obj of objs) {
await batching.addObject({
collection: name,
...(DataGuards.isDataObject(obj) ? obj : { properties: obj }),
tenant,
});
}
Environment
weaviate-client3.13.1- Weaviate server 1.38.0 (
cr.weaviate.io/semitechnologies/weaviate:1.38.0, anonymous access, self-provided vectors) - Node.js v22.14.0, macOS
Note
This surfaced while updating the Weaviate quickstart documentation to use data.ingest(). Every plain property list had to be rewritten as .map((properties) => ({ properties })) to work, which is what led back to the signature mismatch.
- Lingua principale
- TypeScript
- Stelle
- 101
- Fork
- 43
- Merge medio
- 7h 31m
- PR unite (30g)
- 6
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 weaviate/typescript-client
-
CI: journey test asserts WCD cluster's replication default; timeDecay boost test is flakyForse già presa @dudanogueira l’ha presa 49 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
weaviate/typescript-client#485 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
weaviate/typescript-client#411 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 54/100
weaviate/typescript-client#487 ·
I maintainer di solito rispondono entro 1 giorno
-
Add support for new generative-meta moduleForse già presa @OsamaAnsar l’ha presa 64 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
weaviate/typescript-client#478 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
weaviate/typescript-client#470 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di weaviate/typescript-client
Issue simili
-
bot:ai-assisted component:platform-js status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
midnightntwrk/platform-js#69 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Picolab/pico-engine#668 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
ai-driven-qa bug claude Cosmetic
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
needs verification
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 13 giorni