TypeScript insert.text fails entirely on one extracted alias with a control character
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
- 70/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Read typescript/src/extraction/extractor.ts, especially assembleExtraction and its admit logic, then compare it with Python's handling described in #333. Make invalid aliases or entities produce a partial extraction failure instead of rejecting the entire insert, and verify the reproduced TypeScript case stores the valid entities with a warning.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
In TypeScript, one extracted entity whose alias contains a control, NUL, or surrogate character fails the whole insert.text with invalid_argument. Nothing is inserted. Python handles the same reply differently (see #333: the chunk's entities fall back to Thing). Neither drops just that alias or entity, as _assemble does for other invalid items.
Reproduce
On main (5a277c9), embedded Kuzu:
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { KuzuStore, SelfGraph } from "@hydradb/selfgraph";
async function run(name: string, replies: Record<string, unknown[]>) {
const llm = {
async generate({ output }: { output: { shape: Record<string, unknown> } }) {
const kind = Object.keys(output.shape)[0]!;
return { [kind]: replies[kind] ?? [] };
},
};
const g = new SelfGraph(new KuzuStore(join(mkdtempSync(join(tmpdir(), "sg-")), "g.kuzu")), { llm });
try {
const r = await g.insert.text("Ann works at Acme.");
console.log(name, "ok", r.entities.map((e) => e.id));
} catch (e) {
console.log(name, (e as { code?: string }).code, (e as Error).message);
} finally {
await g.close();
}
}
await run("bad alias", {
entities: [
{ type: "Person", name: "Ann", aliases: null },
{ type: "Company", name: "Acme", aliases: ["Acme\u0007Inc"] },
],
relations: [{ from_name: "Ann", type: "WORKS_AT", to_name: "Acme", event_time: null }],
});
Prints bad alias invalid_argument entity alias cannot contain control or surrogate characters. Python stores thing:ann and thing:acme with an extraction_partial_failure warning.
Cause
assembleExtraction in typescript/src/extraction/extractor.ts admits entities by checking only the type and name, so the bad alias reaches validateFacts, which rejects the batch. Dropping the alias (or the entity) inside admit with a warning, in both SDKs, would make them agree.
- Lingua principale
- TypeScript
- Stelle
- 173
- Fork
- 58
- Merge medio
- 6h
- PR unite (30g)
- 120
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 hydra-db/selfgraph
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
hydra-db/selfgraph#401 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: store bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hydra-db/selfgraph#398 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: write bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
hydra-db/selfgraph#392 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: parity area: write bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hydra-db/selfgraph#391 · 2 commenti ·
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
Tutte le issue di hydra-db/selfgraph
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
code-yeongyu/senpi#7139 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
lingdojo/kana-dojo#34395 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mastra-ai/mastra#31093 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
cuadrao-ai/argus#2328 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
nikhilb2/simple_invoicing#907 ·