Integer-like property keys render in a different order in TypeScript
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
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, typescript
Direzione di ricerca
Start with formatProps in typescript/src/retrieval.ts and line in typescript/src/contradiction.ts, then compare them with Python’s _format_props and _line and the Obsidian export’s key sorting. Add integer-like property keys to the retrieve conformance cases and check that rendered properties follow the same order in both SDKs; verify the contradiction facts use consistent ordering as well.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When a relation has a property key that looks like an integer ("2", "10"), the two SDKs render its properties in a different order. This changes the retrieve context text and the facts sent to the contradiction="llm" judge, which should match across SDKs.
Tested at 5a277c9 (current main), Kuzu.
Reproduce
Python:
await g.entities.create("Ada Lovelace", "Person")
await g.entities.create("Analytical Engine", "Machine")
await g.relations.create("person:ada-lovelace", "WORKED_ON", "machine:analytical-engine",
properties={"role": "author", "2": "b", "10": "c"})
(await g.retrieve("Ada Lovelace")).context
GRAPH | Ada Lovelace -[WORKED_ON]-> Analytical Engine {10=c, 2=b, role=author}
TypeScript, same calls:
GRAPH | Ada Lovelace -[WORKED_ON]-> Analytical Engine {2=b, 10=c, role=author}
Cause
Both SDKs store properties as key-sorted JSON. Python reads them back in that order. JavaScript objects always enumerate integer-like keys first, in numeric order, whatever the JSON order, so Object.entries gives a different order:
formatPropsintypescript/src/retrieval.ts:135(Python_format_props,src/selfgraph/retrieval.py:202) renders the GRAPH lines of the retrieve context.lineintypescript/src/contradiction.ts:28(Python_line,src/selfgraph/contradiction.py:29) renders the facts in the judge prompt. Here Python also uses the caller's insertion order for the relation just written, so the prompt order depends on how the properties were passed.
The Obsidian export is not affected because both sides sort its keys explicitly.
Suggested fix
Sort property keys explicitly with the shared Python-order comparison (comparePy / plain sorted) in both renderers in both SDKs, as the Obsidian export already does, and add a relation with integer-like keys to the conformance cases for retrieve.
- 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 ·