api: autoPause default is declared in the spec and in a Go constant with no test keeping them in sync

Abierto Apto para principiantes
#3,765 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@AdaAibaby ya está trabajando en esto.

Desde el 29/10/2026.

  • #3767 de @AdaAibaby — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, openapi

Línea de trabajo

Empieza con packages/api/internal/api/spec_test.go y las pruebas de contrato existentes mencionadas en la issue. Lee los esquemas NewSandbox y NewSandboxV2 en spec/openapi.yml y luego localiza sandboxtypes.AutoPauseDefault y su uso en sandbox_create.go. La tarea está lista cuando una prueba falla si alguno de los valores predeterminados de la spec difiere de la constante de Go y pasa cuando coinciden.

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

Descripción

Summary

The default timeout action for a sandbox (autoPause when omitted) is declared in two places in this repo with no test keeping them in sync:

  1. OpenAPI spec — spec/openapi.yml, NewSandbox and NewSandboxV2 both declare autoPause: { type: boolean, default: false }. This is documentation only: the generated Go type is *bool with omitempty (api.gen.go), so the spec default is never applied at decode time.
  2. Go constant — sandboxtypes.AutoPauseDefault = false, which is what sandbox_create.go actually applies via DerefOrDefault(body.AutoPause, sandbox.AutoPauseDefault) when the request omits autoPause.

The spec value is the one the SDKs read and document as the default (see e2b-dev/E2B #2057 — both SDKs hardcode "currently kill" against this). If the Go constant ever changes without the spec (or vice versa), the published contract silently lies about what an omitted autoPause does, and the SDKs' documented/validated default drifts from reality — with no signal.

Proposal

Add a contract test (mirroring the existing TestSpecSecuritySchemeHeaderNames / TestTemplateBuildMinimumFreeDiskContract pattern in packages/api/internal/api/spec_test.go) that asserts the spec's declared autoPause default on NewSandbox and NewSandboxV2 equals sandboxtypes.AutoPauseDefault. Makes the spec the single documented source of the default and fails CI on drift.

This is the infra-side half of the drift concern raised in e2b-dev/E2B #2057 (the SDK-side half — single-sourcing the SDK's local assumption — is handled there).

Lenguaje dominante
Go
Estrellas
1.8k
Forks
503
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 e2b-dev/runtime

Todos los issues de e2b-dev/runtime

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.