Python store constructors report a misspelled option as query_failed or blame uri

Aperta Adatta ai principianti
#398 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, typescript
Ambito
backend

Direzione di ricerca

Inizia con KuzuStore.__init__ in src/selfgraph/stores/kuzu.py e bolt_driver in src/selfgraph/stores/_cypher.py; confronta la convalida delle opzioni Python con check_options di FalkorDBStore e il comportamento TypeScript descritto nell’issue. Verifica come CypherStore e HydraDBStore passano le opzioni al driver. Il lavoro è completato quando i quattro store nominati segnalano unknown_key, identificano l’opzione non valida in field ed elencano le opzioni valide.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

approved-for-pr area: errors area: store bug effort: S P3

What happens

The Python store constructors do not check their option names. A misspelled option gets the wrong code, and sometimes blames the wrong field:

KuzuStore("g.kuzu", buffer_pool=1)
# StoreError query_failed, field None:
# could not open Kuzu database 'g.kuzu': Database.__init__() got an unexpected keyword argument 'buffer_pool'. Did you mean 'buffer_pool_size'?

Neo4jStore("bolt://h:1", bogus=1)
# StoreError invalid_setting, field 'uri':
# cannot open a Bolt driver for 'bolt://h:1': Unexpected config keys: bogus

HydraDBStore("bolt://h:1", bogus=1)
# same as Neo4jStore

query_failed says the backend rejected a query, and its hint says to check your Cypher. field="uri" points at the URI, which is fine. Neither tells the user that an option name is wrong.

TypeScript checks the options first:

new KuzuStore("g.kuzu", { buffer_pool: 1 })
// unknown_key, field buffer_pool:
// unknown option 'buffer_pool' for KuzuStore (valid options: buffer_pool_size, max_db_size, compression, read_only)

FalkorDBStore in Python already does this with check_options.

Reproduce

On 04862c4, run the three Python calls above.

Expected

unknown_key with field set to the option and the list of valid options, matching TypeScript, for KuzuStore, Neo4jStore, CypherStore, and HydraDBStore.

Where

  • src/selfgraph/stores/kuzu.py, KuzuStore.__init__
  • src/selfgraph/stores/_cypher.py, bolt_driver, which passes extra options to the driver unchecked
Lingua principale
TypeScript
Stelle
173
Fork
58
Merge medio
6h
PR unite (30g)
120

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hydra-db/selfgraph

Tutte le issue di hydra-db/selfgraph

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.