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

Aperta
#119 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, grpc

Direzione di ricerca

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.

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

Descrizione

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"
Lingua principale
Go
Stelle
70
Fork
17
Merge medio
21h 36m
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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

Tutte le issue di agent-substrate/env

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.