Complete Gateway API Surface and Canonical OpenAPI 3.1 Specification
Source:
docs/enhancements/0012-complete-gateway-api-and-openapi/README.md· Status:implemented· Area:core· Milestone:v0.3.0
- CEP Number:
0012 - Status:
implementable - Target Version:
v0.3.0 - Components:
pkg/gateway/server.go,pkg/gateway/server_test.go,api/openapi/cubepod-v1.yaml
1. Summary
Section titled “1. Summary”Completes the cubepod-gateway HTTP REST/SSE API surface so every capability of podd and cubepod-controller is exposed over the unified Gateway contract, and brings api/openapi/cubepod-v1.yaml to 100% parity with the implementation.
2. Motivation
Section titled “2. Motivation”- Expose missing file management routes on
cubepod-gateway:DELETE /sandboxes/{sandboxID}/files?path=...(forwards topoddDELETE /v1/filesor deletes from local sandbox workspace).GET /sandboxes/{sandboxID}/files/list?path=...(forwards topoddGET /v1/files/listor lists local sandbox workspace directory entries withname,path,is_dir,size,mode).
- Expose missing command & streaming routes on
cubepod-gateway:GET /sandboxes/{sandboxID}/commands/{cmdID}/status(returnsid,pid,running,exit_code,cursor).GET /sandboxes/{sandboxID}/commands/{cmdID}/stream(Server-Sent Eventstext/event-streamstreamingdata: {"content":...,"cursor":...,"running":...}\n\nevents until the command exits).
- Expose WarmPool and Template management routes on
cubepod-gateway:POST /warmpools(registers/reconciles aPodWarmPoolSpecviareconciler.ReconcileWarmPool).GET /warmpools(lists active warm pool specs and ready standby counts).GET /templates(returns available sandbox templates).GET /openapi.yaml(serves the embedded or on-diskapi/openapi/cubepod-v1.yamlspecification).
- Update
api/openapi/cubepod-v1.yamlto document all 20+ routes and schemas.
Non-Goals
Section titled “Non-Goals”- GraphQL or gRPC control-plane APIs.
3. Design Details
Section titled “3. Design Details”3.1 File Management Routes (DELETE /sandboxes/{sandboxID}/files, GET /sandboxes/{sandboxID}/files/list)
Section titled “3.1 File Management Routes (DELETE /sandboxes/{sandboxID}/files, GET /sandboxes/{sandboxID}/files/list)”- Both routes trigger
ensureRunning(ctx, rec)(Auto-Resume ifPaused). - If
rec.PoddURL != "", forward topoddURL + "/v1/files"(DELETE) orpoddURL + "/v1/files/list"(GET). - Otherwise execute against
rec.WorkspaceDirusingresolveFilePath(rejecting..traversal) and return the identical JSON schema aspodd({"deleted":"..."}and{"entries":[...]}).
3.2 Command Status & SSE Streaming (GET /sandboxes/{sandboxID}/commands/{cmdID}/status, /stream)
Section titled “3.2 Command Status & SSE Streaming (GET /sandboxes/{sandboxID}/commands/{cmdID}/status, /stream)”GET /sandboxes/{sandboxID}/commands/{cmdID}/status: Forwards topoddURL + "/v1/commands/" + cmdID + "/status"whenrec.PoddURL != "", or returns the localcommandEntrystatus.GET /sandboxes/{sandboxID}/commands/{cmdID}/stream: SetsContent-Type: text/event-stream,Cache-Control: no-cache, and polls incremental logs (cursor) every 50ms, flushing SSEdata: {...}\n\nframes viahttp.Flusheruntilrunning == false.
3.3 WarmPool & Template Routes (POST /warmpools, GET /warmpools, GET /templates)
Section titled “3.3 WarmPool & Template Routes (POST /warmpools, GET /warmpools, GET /templates)”POST /warmpools: Accepts{"name":"default-pool","templateRef":"cubeplex-ubuntu24-desktop","replicas":2}, callsreconciler.ReconcileWarmPool, and returns201 Createdwith pool status.GET /warmpools: Returns all registered warm pools andwarmPoolReadyCount.
4. Test Plan
Section titled “4. Test Plan”- Unit tests in
pkg/gateway/server_test.gocoveringDELETE /sandboxes/{id}/files,GET /sandboxes/{id}/files/list,GET /sandboxes/{id}/commands/{cmdID}/status, SSE/stream,POST/GET /warmpools, andGET /templates.
5. Graduation Criteria & PRR
Section titled “5. Graduation Criteria & PRR”- All routes documented in
api/openapi/cubepod-v1.yamland verified by automated tests.
6. Alternatives Considered
Section titled “6. Alternatives Considered”- WebSockets for command log streaming: SSE (
text/event-stream) works natively over standard HTTP/1.1 and HTTP/2 proxies andhttpx/curlwithout handshake complexity.