Skip to content

refactor(envd): extract inlined request/response bodies to OpenAPI components#2932

Open
mishushakov wants to merge 3 commits into
mainfrom
mishushakov/envd-extract-body-components
Open

refactor(envd): extract inlined request/response bodies to OpenAPI components#2932
mishushakov wants to merge 3 commits into
mainfrom
mishushakov/envd-extract-body-components

Conversation

@mishushakov
Copy link
Copy Markdown
Member

Moves the inlined request and response bodies in the envd OpenAPI spec into reusable components/requestBodies (Init, Compose) and components/responses (Metrics, EnvVars, ComposeSuccess), with each operation now referencing them via $ref. Regenerated api.gen.go gains only named type aliases — the operation-derived types like PostInitJSONBody are preserved, so handlers are unchanged. Verified with go build, go vet, and golangci-lint.

🤖 Generated with Claude Code

Move the inlined /init and /files/compose request bodies and the
/metrics, /envs, /files/compose response bodies into reusable
components/requestBodies and components/responses. Regenerated
api.gen.go gains named aliases only; operation-derived types are
preserved, so handlers are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 5, 2026

PR Summary

Low Risk
Spec and generated-type refactor only; no runtime or auth logic changes, and JSON shapes stay the same.

Overview
This refactor moves inlined envd OpenAPI request and response shapes into reusable components and regenerates clients and server types so handlers and tests use the shared names Init, Compose, and ComposeSuccess instead of operation-specific or generic EntryInfo types for those payloads. HTTP JSON contracts are unchanged; the work is spec organization and aligned Go type names across envd, orchestrator, and integration generated code.

Reviewed by Cursor Bugbot for commit e141c54. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2731 4 2727 5
View the full list of 4 ❄️ flaky test(s)
github.com/e2b-dev/infra/tests/integration/internal/tests/orchestrator::TestSandboxMemoryIntegrity

Flake rate in main: 54.88% (Passed 878 times, Failed 1068 times)

Stack Traces | 67.2s run time
=== RUN   TestSandboxMemoryIntegrity
=== PAUSE TestSandboxMemoryIntegrity
=== CONT  TestSandboxMemoryIntegrity
    sandbox_memory_integrity_test.go:27: Build completed successfully
--- FAIL: TestSandboxMemoryIntegrity (67.25s)
github.com/e2b-dev/infra/tests/integration/internal/tests/orchestrator::TestSandboxMemoryIntegrity/tmpfs_hash

Flake rate in main: 54.96% (Passed 868 times, Failed 1059 times)

Stack Traces | 203s run time
=== RUN   TestSandboxMemoryIntegrity/tmpfs_hash
=== PAUSE TestSandboxMemoryIntegrity/tmpfs_hash
=== CONT  TestSandboxMemoryIntegrity/tmpfs_hash
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{start:{pid:1253}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Total memory: 985 MB\nUsed memory before tmpfs mount: 190 MB\nFree memory before tmpfs mount: 793 MB\nMemory to use in integrity test (60% of free, min 64MB): 475 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"475+0 records in\n475+0 records out\n498073600 bytes (498 MB, 475 MiB) copied, 2.36455 s, 211 MB/s\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\tCommand being timed: \"dd if=/dev/urandom of=/mnt/testfile bs=1M count=475\"\n\tUser time (seconds): 0.00\n\tSystem time (sec"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"onds): 2.35\n\tPercent"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" of CPU "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"this "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"job "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"got:"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 99%\n\tElap"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"sed "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"(wa"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ll c"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"lock"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:") t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ime "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"(h:"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"mm:s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s or"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" m:s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s):"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 0:02.37\n\tAverage shared text size (kbytes): 0\n\tAverage unshared dat"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"a size (kbytes): 0\n\tAverage stack size (kbytes"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"): 0\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\tAve"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"rage tot"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"al s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ize"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (kb"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ytes"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"): "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"0\n\t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"Maxi"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"m"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"um resident set size (kbytes): 2724\n\tAverage resident set size (kbytes): 0\n\tMajor"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (requ"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"irin"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"g I"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"/O) "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"pag"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e fa"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ults: 2"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\n\tMi"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nor"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (re"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"cla"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"imin"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"g a"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" frame) pag"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e fault"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s: 345\n\t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"Volunta"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ry con"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"text switches: 3\n\tInvoluntary context switches: 71\n\tSwaps: 0\n\tF"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ile sys"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"tem "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"inpu"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ts: 176\n\tF"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ile"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" sys"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"tem "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"out"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"puts"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:": 0"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\n\tSocket mes"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"sages sent:"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 0\n\tSo"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"cket m"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"essage"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s received: 0\n\tSignals delivered: 0\n\tPage size (bytes): 4096\n\tExit status: 0\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Used memory after tmpfs mount and file fill: 671 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{end:{exited:true  status:"exit status 0"}}
    sandbox_memory_integrity_test.go:70: Command [bash] completed successfully in sandbox icmfg4futv6s2u2f3yno2
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{start:{pid:1269}}
Executing command bash in sandbox i8cl89ulekgh0bc2pzu4k (user: root)
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{data:{stdout:"125ac41fdea082d6fd257a77bc57b535ba3f56bc0b2ca5229d8080f85b2e8c01\n"}}
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{end:{exited:true  status:"exit status 0"}}
    sandbox_memory_integrity_test.go:80: Command [bash] completed successfully in sandbox icmfg4futv6s2u2f3yno2
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{start:{pid:1272}}
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
Executing command bash in sandbox icmfg4futv6s2u2f3yno2 (user: root)
    sandbox_memory_integrity_test.go:110: 
        	Error Trace:	.../tests/orchestrator/sandbox_memory_integrity_test.go:81
        	            				.../hostedtoolcache/go/1.26.3.../src/runtime/asm_amd64.s:1771
        	Error:      	Received unexpected error:
        	            	failed to execute command bash in sandbox icmfg4futv6s2u2f3yno2: unavailable: HTTP status 502 Bad Gateway
    sandbox_memory_integrity_test.go:110: 
        	Error Trace:	.../tests/orchestrator/sandbox_memory_integrity_test.go:78
        	            				.../tests/orchestrator/sandbox_memory_integrity_test.go:110
        	Error:      	Condition never satisfied
        	Test:       	TestSandboxMemoryIntegrity/tmpfs_hash
--- FAIL: TestSandboxMemoryIntegrity/tmpfs_hash (202.83s)
github.com/e2b-dev/infra/tests/integration/internal/tests/proxies::TestEnvdAccessTokenAutoResumeViaProxy

Flake rate in main: 39.97% (Passed 874 times, Failed 582 times)

Stack Traces | 11.4s run time
=== RUN   TestEnvdAccessTokenAutoResumeViaProxy
=== PAUSE TestEnvdAccessTokenAutoResumeViaProxy
=== CONT  TestEnvdAccessTokenAutoResumeViaProxy
Executing command ls in sandbox i4jkiw7cfxb5vllv3tfws
    traffic_access_token_test.go:357: 
        	Error Trace:	.../tests/proxies/traffic_access_token_test.go:357
        	Error:      	Received unexpected error:
        	            	Get "http://localhost:3002/health": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
        	Test:       	TestEnvdAccessTokenAutoResumeViaProxy
--- FAIL: TestEnvdAccessTokenAutoResumeViaProxy (11.37s)
github.com/e2b-dev/infra/tests/integration/internal/tests/proxies::TestSandboxAutoResumeViaProxy

Flake rate in main: 40.44% (Passed 872 times, Failed 592 times)

Stack Traces | 13.6s run time
=== RUN   TestSandboxAutoResumeViaProxy
=== PAUSE TestSandboxAutoResumeViaProxy
=== CONT  TestSandboxAutoResumeViaProxy
    auto_resume_test.go:116: 
        	Error Trace:	.../tests/proxies/auto_resume_test.go:116
        	Error:      	Received unexpected error:
        	            	Get "http://localhost:3002": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
        	Test:       	TestSandboxAutoResumeViaProxy
--- FAIL: TestSandboxAutoResumeViaProxy (13.61s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

mishushakov and others added 2 commits June 5, 2026 14:18
Switch the init and compose handlers (and their tests) to the new
component-derived types — Init, Compose, and ComposeSuccess — instead
of the operation-derived JSON body types.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread packages/envd/spec/envd.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant