invalid_setting exits with 1 or 2 depending on the error class

Abierto
#397 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, typescript

Línea de trabajo

Start with the exit code handling in src/selfgraph/cli.py and typescript/src/cli.ts, then trace how each CLI classifies errors by code or error class. Check the StoreError cases in src/selfgraph/stores/_cypher.py and typescript/src/stores/bolt.ts. Done means every invalid_setting error exits with code 2 in both CLIs, including the two reported cases.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

approved-for-pr area: cli-mcp area: errors bug effort: S P3

What happens

docs/cli.md says a bad flag or setting exits with code 2. Some invalid_setting errors exit with 1, because the CLI picks the exit code from the error class, not the code. invalid_setting is raised both as ValidationError (exit 2) and as StoreError (exit 1):

Command Error Exit
--store falkordb --uri h:0 entity list error[invalid_setting]: invalid FalkorDB address ... 2
--store neo4j --uri 'bolt://u:p/x@h:1' entity list error[invalid_setting]: the store URI has an unencoded character ... 2
--store hydradb --uri http://127.0.0.1:1 entity list error[invalid_setting]: 'http://127.0.0.1:1' is not a Bolt URI; use bolt://host:port 1
--store neo4j --uri bolt://u:[email protected]:1 entity list (Python) error[invalid_setting]: cannot open a Bolt driver for 'bolt://***@127.0.0.1:1': URI userinfo is not supported ... 1

Both CLIs exit 1 for the http:// case. The userinfo case is Python only, because the TypeScript driver accepts userinfo. A script that treats exit 2 as "fix your settings" and exit 1 as "the server failed" retries the last two forever.

Reproduce

On 04862c4, run the commands above with selfgraph and node typescript/dist/cli.js, then check $?.

Expected

Every invalid_setting, and the other input codes, exits with 2 whatever class raised it. For example, decide the exit code from exc.code, or raise these two as ValidationError.

Where

  • src/selfgraph/stores/_cypher.py, bolt_driver: StoreError(..., code="invalid_setting", field="uri") for a non-Bolt scheme and for a driver that rejects the URI
  • src/selfgraph/cli.py, _USAGE_ERRORS and the exit code in main
  • The same in typescript/src/stores/bolt.ts and typescript/src/cli.ts
Lenguaje dominante
TypeScript
Estrellas
173
Forks
58
Merge medio
6 h
PR fusionados (30 d)
120

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hydra-db/selfgraph

Todos los issues de hydra-db/selfgraph

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.