ate-env leaks raw/double-wrapped gRPC errors and misleading "suspending" error on delete of non-existent environment

Abierto
#119 0 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
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, grpc

Línea de trabajo

Start with the listed error-handling paths in internal/ate/client.go, internal/apiservice/server.go, clients/go/client.go, and guest/filesystem/service.go; trace how each reproduced failure is wrapped and translated across the API and CLI. Use the five ate-env commands in the reproduction guide to check the current behavior. Done means errors are presented once with useful context, missing-environment deletion identifies the missing environment, directory reads use an appropriate status, and transport failures explain how to check connectivity.

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

Descripción

Summary & Root Cause
  • Errors are wrapped twice. The env API server wraps Substrate errors (ate: creating "alice": <status error>) and re-emits them with the same code. gRPC's status.FromError accepts the wrapped error and uses its full text as the message, so the CLI shows rpc error: code = AlreadyExists desc = ate: creating "alice": rpc error: code = AlreadyExists desc = ....
  • delete of a missing environment fails inside the implicit Suspend, so the message says suspending.
  • read of a directory is reported as Internal.
  • Transport failures (the port-forward is down) reach the user as raw Unavailable dial errors, with no hint to check the port-forward or --api.
Affected Code Locations

At env 40a6c63, with de462e98 line numbers noted where they differ:

  • internal/ate/client.go:316-328 (de462e98: 306-318): Client.Delete calls c.Suspend first and returns its error unchanged
  • internal/ate/client.go:305-314 (de462e98: 299-304): Suspend wraps errors as ate: suspending %q: %w
  • internal/ate/client.go:277-279: Create wraps the raw CreateActor status error with %w (only NotFound is translated, by wrapGRPCError at :372-377, de462e98: 362-367)
  • internal/apiservice/server.go:146-148, 255-257: CreateEnvironment and DeleteEnvironment return toGRPCError(err)
  • internal/apiservice/server.go:557-570: toGRPCError returns any error that already carries a non-Unknown gRPC code as is, so the wrapped text (including the inner rpc error: ...) becomes the new status message
  • clients/go/client.go:154-167: fromGRPCError translates only NotFound and one FailedPrecondition case. Everything else becomes env: <raw status error>
  • guest/filesystem/service.go:155-160: a read error (including EISDIR) is returned as codes.Internal, failed to read file %q: %v
Detailed Reproduction Guide
ate-env delete does-not-exist; echo "exit: $?"
ate-env create alice; ate-env create alice; echo "exit: $?"
ate-env create alice-py --rootfs-image python:3.12; echo "exit: $?"
ate-env alice read .; echo "exit: $?"
ate-env alice shell --api 127.0.0.1:17799 echo hi; echo "exit: $?"   # nothing listening on 17799
Expected vs. Actual Behavior
  • Expected: environment "does-not-exist" not found. environment "alice" already exists. "." is a directory as InvalidArgument or FailedPrecondition. cannot reach ate-env-api at 127.0.0.1:17799 (is the port-forward running? see --api / SUBSTRATE_ENV_API). No raw rpc error: code = ... text.
  • Actual: See the outputs below: a misleading suspending context, a double-wrapped AlreadyExists, Internal for a directory read, and raw gRPC transport text.
Observed Output & Logs
ate-env: env: not found: ate: suspending "does-not-exist": not found: actor "does-not-exist" not found
ate-env: env: rpc error: code = AlreadyExists desc = ate: creating "alice": rpc error: code = AlreadyExists desc = actor "alice" already exists
ate-env: env: rpc error: code = InvalidArgument desc = image "python:3.12" is not pinned by digest (want repo@sha256:<64 hex>)
ate-env: env: rpc error: code = Internal desc = failed to read file ".": read /workspace: is a directory
ate-env: env: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:7777: connect: connection refused"
$ ate-env delete does-not-exist
ate-env: env: not found: ate: suspending "does-not-exist": not found: actor "does-not-exist" not found
EXIT: 1
$ ate-env create alice && ate-env create alice
ate-env: env: rpc error: code = AlreadyExists desc = ate: creating "alice": rpc error: code = AlreadyExists desc = actor "alice" already exists
EXIT: 1
$ ate-env alice read .
ate-env: env: rpc error: code = Internal desc = failed to read file ".": read /tmp/TestReverifyEnvCLI511734675/001: is a directory
EXIT: 1
$ ate-env --api 127.0.0.1:17777 create alice
ate-env: env: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:17777: connect: connection refused"
EXIT: 1
$ ate-env delete does-not-exist
EXIT: 1
ate-env: env: not found: ate: suspending "does-not-exist": not found: Actor ate-env/does-not-exist not found
$ ate-env create alice
EXIT: 1
ate-env: env: rpc error: code = AlreadyExists desc = ate: creating "alice": rpc error: code = AlreadyExists desc = Actor alice already exists
$ ate-env create alice-py --rootfs-image python:3.12
EXIT: 1
ate-env: env: rpc error: code = InvalidArgument desc = image "python:3.12" is not pinned by digest (want repo@sha256:<64 hex>)
$ ate-env alice read .
EXIT: 1
ate-env: env: rpc error: code = Internal desc = failed to read file ".": read .: is a directory
$ ate-env alice shell --api 127.0.0.1:17799 echo hi
EXIT: 1
ate-env: env: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:17799: connect: connection refused"
Lenguaje dominante
Go
Estrellas
70
Forks
17
Merge medio
21 h 36 min
PR fusionados (30 d)
19

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 agent-substrate/env

Todos los issues de agent-substrate/env

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.