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

Offen Anfängerfreundlich
#3,765 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

@AdaAibaby arbeitet bereits daran.

Seit 29.10.2026.

  • #3767 von @AdaAibaby — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
84/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go, openapi

Rechercherichtung

Beginne mit packages/api/internal/api/spec_test.go und den bestehenden Vertragstests, die im Issue genannt werden. Lies die Schemas NewSandbox und NewSandboxV2 in spec/openapi.yml und suche dann nach sandboxtypes.AutoPauseDefault und seiner Verwendung in sandbox_create.go. Fertig ist die Aufgabe, wenn ein Test fehlschlägt, falls einer der Spec-Standardwerte von der Go-Konstante abweicht, und besteht, wenn sie übereinstimmen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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).

Vorherrschende Sprache
Go
Sterne
1.8k
Forks
503
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus e2b-dev/runtime

Alle Issues in e2b-dev/runtime

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.