Schema consistency errors have no field in Python
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, typescript
- Ambito
- backend-api-design, testing
Direzione di ricerca
Leggi src/selfgraph/schema.py nella sezione intorno a Schema._check_consistency, poi esamina src/selfgraph/models.py intorno a validation_error. Confronta la gestione dei percorsi in TypeScript in typescript/src/schema.ts. Riproduci i casi elencati e verifica se ogni errore Python espone lo stesso percorso field di TypeScript. Il lavoro è completato quando tutti gli errori di coerenza includono il percorso dell’errore, mantenendo invariati codice e messaggio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Schema errors found by the cross-type consistency checks have the same code and message in both SDKs, but Python leaves field empty while TypeScript sets it to the path at fault. AGENTS.md asks for the same code, field, and hint for the same failure on every surface and in both SDKs, and agents use field to find what to change.
Tested at 04862c4 (current main), Python 3.14 and Node 26.12.
Reproduce
from selfgraph import Schema
from selfgraph.errors import SelfGraphError
for spec in [
{"entities": [{"name": "Person"}, {"name": "Person"}]},
{"entities": [{"name": "Employee", "parent": "Persn"}]},
{"entities": [{"name": "Person"}], "relations": [{"type": "WORKS_AT", "to": {"types": ["Company"]}}]},
{"relations": [{"type": "KNOWS"}, {"type": "knows"}]},
{"relations": [{"type": "X", "from": {"max_count": 0}}]},
]:
try:
Schema.model_validate(spec)
except SelfGraphError as e:
print(e.code, e.field, str(e))
| message | Python field |
TypeScript field |
|---|---|---|
invalid schema: entities[1].name: duplicate entity type 'Person' |
None |
entities[1].name |
invalid schema: entities[0].parent: unknown type 'Persn' |
None |
entities[0].parent |
invalid schema: relations[0].to.types[0]: unknown type 'Company' |
None |
relations[0].to.types[0] |
invalid schema: relations[1].type: duplicate relation type 'knows' |
None |
relations[1].type |
invalid schema: relations[0].from.max_count: must be >= 1 |
None |
relations[0].from.max_count |
Errors from single-field checks (for example a non-string name) already carry a field in both SDKs; only these consistency checks lose it.
Cause
Schema._check_consistency (src/selfgraph/schema.py:204) is a model_validator(mode="after") that raises ValueError with the path written into the message text (for example :214, :232, :254, :264, :269). Pydantic records such an error at the model level with an empty location, so validation_error (src/selfgraph/models.py:371), which takes field from the first issue's location, gets nothing.
TypeScript's Schema (typescript/src/schema.ts:96-99) adds the same problem as an issue with an explicit path, which is where its field comes from. Raising the consistency errors with their location in Python, as a PydanticCustomError placed at that path or by setting field directly, would give the same field as TypeScript.
- 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 ·