feat(sdk): warm pool management across typescript, python, go, ruby and java sdks - #145
feat(sdk): warm pool management across typescript, python, go, ruby and java sdks#145brunogrbavac wants to merge 1 commit into
Conversation
…nd java sdks Signed-off-by: Bruno Grbavac <bruno.grbavac@outlook.com>
Vidoc security reviewTip Good to merge — no security issues found. Reviewed 35 changed files. 💬 Have questions? Tag @vidoc in a comment and I'll answer. |
|
All contributors have signed the CLA. ✅ Thank you! |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
5 issues found across 35 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="sdk-java/src/main/java/io/daytona/sdk/WarmPoolService.java">
<violation number="1" location="sdk-java/src/main/java/io/daytona/sdk/WarmPoolService.java:1">
P3: This new SDK source file omits the repository-required Apache-2.0 copyright/SPDX header used by the other hand-written Java SDK files. Adding the standard header keeps licensing metadata and automated license checks consistent.</violation>
</file>
<file name="sdk-typescript/src/WarmPool.ts">
<violation number="1" location="sdk-typescript/src/WarmPool.ts:1">
P2: The new SDK source file will fail the repository's license-header check because it omits the required Apache-2.0 copyright/SPDX header; adding the standard header keeps this package compliant with the configured repository check.</violation>
</file>
<file name="sdk-go/pkg/daytona/warm_pool_test.go">
<violation number="1" location="sdk-go/pkg/daytona/warm_pool_test.go:92">
P2: Missing test coverage for `WarmPoolService.Update`. The service exposes a public `Update(ctx, warmPoolID, pool)` method, but this test file only covers `List`, `Create` (error), and `Delete` (error). Without an update test, the update code path — including its API call and error handling — is untested, leaving a gap in the PR's explicitly mentioned operations (list, create, update, delete).</violation>
</file>
<file name="examples/java/warm-pools/src/main/java/io/daytona/examples/WarmPools.java">
<violation number="1" location="examples/java/warm-pools/src/main/java/io/daytona/examples/WarmPools.java:28">
P2: Cleanup on line 28 is not guaranteed if a prior operation throws. Wrap the body in try/finally so delete still runs on failure — the Lifecycle example demonstrates this pattern.</violation>
</file>
<file name="sdk-ruby/lib/daytona/warm_pool_service.rb">
<violation number="1" location="sdk-ruby/lib/daytona/warm_pool_service.rb:1">
P2: New file is missing the standard copyright header that every other hand-written Ruby SDK file includes. The file starts with `# frozen_string_literal: true` but should be preceded by the two-line copyright block to match the project convention.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -0,0 +1,106 @@ | |||
| import { WarmPoolsApi } from '@daytona/api-client' | |||
There was a problem hiding this comment.
P2: The new SDK source file will fail the repository's license-header check because it omits the required Apache-2.0 copyright/SPDX header; adding the standard header keeps this package compliant with the configured repository check.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sdk-typescript/src/WarmPool.ts, line 1:
<comment>The new SDK source file will fail the repository's license-header check because it omits the required Apache-2.0 copyright/SPDX header; adding the standard header keeps this package compliant with the configured repository check.</comment>
<file context>
@@ -0,0 +1,106 @@
+import { WarmPoolsApi } from '@daytona/api-client'
+import type { CreateWarmPool, UpdateWarmPool, WarmPool as WarmPoolDto } from '@daytona/api-client'
+import { WithInstrumentation } from './utils/otel.decorator'
</file context>
| @@ -0,0 +1,129 @@ | |||
| package daytona | |||
There was a problem hiding this comment.
P2: Missing test coverage for WarmPoolService.Update. The service exposes a public Update(ctx, warmPoolID, pool) method, but this test file only covers List, Create (error), and Delete (error). Without an update test, the update code path — including its API call and error handling — is untested, leaving a gap in the PR's explicitly mentioned operations (list, create, update, delete).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sdk-go/pkg/daytona/warm_pool_test.go, line 92:
<comment>Missing test coverage for `WarmPoolService.Update`. The service exposes a public `Update(ctx, warmPoolID, pool)` method, but this test file only covers `List`, `Create` (error), and `Delete` (error). Without an update test, the update code path — including its API call and error handling — is untested, leaving a gap in the PR's explicitly mentioned operations (list, create, update, delete).</comment>
<file context>
@@ -0,0 +1,129 @@
+ require.Error(t, err)
+}
+
+func TestWarmPoolDeleteError(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
</file context>
| System.out.println("Updated desired size to " + updated.getPool()); | ||
|
|
||
| // Cleanup | ||
| daytona.warmPool().delete(pool.getId()); |
There was a problem hiding this comment.
P2: Cleanup on line 28 is not guaranteed if a prior operation throws. Wrap the body in try/finally so delete still runs on failure — the Lifecycle example demonstrates this pattern.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/java/warm-pools/src/main/java/io/daytona/examples/WarmPools.java, line 28:
<comment>Cleanup on line 28 is not guaranteed if a prior operation throws. Wrap the body in try/finally so delete still runs on failure — the Lifecycle example demonstrates this pattern.</comment>
<file context>
@@ -0,0 +1,32 @@
+ System.out.println("Updated desired size to " + updated.getPool());
+
+ // Cleanup
+ daytona.warmPool().delete(pool.getId());
+ System.out.println("Deleted warm pool");
+ }
</file context>
| @@ -0,0 +1,58 @@ | |||
| # frozen_string_literal: true | |||
There was a problem hiding this comment.
P2: New file is missing the standard copyright header that every other hand-written Ruby SDK file includes. The file starts with # frozen_string_literal: true but should be preceded by the two-line copyright block to match the project convention.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sdk-ruby/lib/daytona/warm_pool_service.rb, line 1:
<comment>New file is missing the standard copyright header that every other hand-written Ruby SDK file includes. The file starts with `# frozen_string_literal: true` but should be preceded by the two-line copyright block to match the project convention.</comment>
<file context>
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+module Daytona
</file context>
| # frozen_string_literal: true | |
| # Copyright Daytona Platforms Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # frozen_string_literal: true |
| @@ -0,0 +1,102 @@ | |||
| package io.daytona.sdk; | |||
There was a problem hiding this comment.
P3: This new SDK source file omits the repository-required Apache-2.0 copyright/SPDX header used by the other hand-written Java SDK files. Adding the standard header keeps licensing metadata and automated license checks consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sdk-java/src/main/java/io/daytona/sdk/WarmPoolService.java, line 1:
<comment>This new SDK source file omits the repository-required Apache-2.0 copyright/SPDX header used by the other hand-written Java SDK files. Adding the standard header keeps licensing metadata and automated license checks consistent.</comment>
<file context>
@@ -0,0 +1,102 @@
+package io.daytona.sdk;
+
+import io.daytona.api.client.api.WarmPoolsApi;
</file context>
Description
Adds warm pool management to all five SDKs (TypeScript, Python, Go, Ruby, Java): list, create, update and delete, mirroring each SDK's existing per-resource service pattern. The returned model exposes currentSize vs pool plus errorReason as the status check, so no pollers or waiters were added. Includes unit tests and a runnable example per language. The spec and generated clients were already on main, so this is purely the hand-written surface. All five verified live against production.
Documentation
Summary by cubic
Adds Warm Pool management to the TypeScript, Python, Go, Ruby, and Java SDKs so teams can keep ready-to-use sandboxes for snapshots. Supports listing, creating, updating, and deleting pools with simple status via current size vs desired pool.
daytona.warmPool, Pythondaytona.warm_pool(sync/async), Goclient.WarmPool, Rubydaytona.warm_pool, Javadaytona.warmPool().poolto 0 to drain. Status iscurrentSizevspool;errorReasonshows why a pool can’t fill (no waiters/pollers).Written for commit 300001b. Summary will update on new commits.