From b6bc58073b67f8c9a052dfd2f237a46d64e3da79 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 4 Mar 2026 09:22:39 -0500 Subject: [PATCH] Simplify create_ssh_access return type and signature Return just the SSH command string instead of the full SshAccessDto, and hardcode the 60-minute expiration internally. Co-Authored-By: Claude Opus 4.6 --- crates/arc-workflows/src/cli/run.rs | 6 +++--- crates/arc-workflows/src/daytona_sandbox.rs | 13 ++++++------- .../arc-workflows/tests/daytona_integration.rs | 18 +++++------------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/crates/arc-workflows/src/cli/run.rs b/crates/arc-workflows/src/cli/run.rs index cc52e36c4..bd4364308 100644 --- a/crates/arc-workflows/src/cli/run.rs +++ b/crates/arc-workflows/src/cli/run.rs @@ -488,10 +488,10 @@ pub async fn run_command( // Create SSH access if requested if args.ssh { if let Some(ref daytona) = daytona_sandbox_ref { - match daytona.create_ssh_access(Some(60.0)).await { - Ok(ssh_info) => { + match daytona.create_ssh_access().await { + Ok(ssh_command) => { emitter.emit(&crate::event::WorkflowRunEvent::SshAccessReady { - ssh_command: ssh_info.ssh_command, + ssh_command, }); } Err(e) => { diff --git a/crates/arc-workflows/src/daytona_sandbox.rs b/crates/arc-workflows/src/daytona_sandbox.rs index e53a32378..386f34d0c 100644 --- a/crates/arc-workflows/src/daytona_sandbox.rs +++ b/crates/arc-workflows/src/daytona_sandbox.rs @@ -59,15 +59,14 @@ impl DaytonaSandbox { self.event_callback = Some(cb); } - pub async fn create_ssh_access( - &self, - expires_in_minutes: Option, - ) -> Result { + /// Create SSH access and return the connection command string. + pub async fn create_ssh_access(&self) -> Result { let sandbox = self.sandbox()?; - sandbox - .create_ssh_access(expires_in_minutes) + let dto = sandbox + .create_ssh_access(Some(60.0)) .await - .map_err(|e| format!("Failed to create SSH access: {e}")) + .map_err(|e| format!("Failed to create SSH access: {e}"))?; + Ok(dto.ssh_command) } fn emit(&self, event: SandboxEvent) { diff --git a/crates/arc-workflows/tests/daytona_integration.rs b/crates/arc-workflows/tests/daytona_integration.rs index b1f8d8311..15cb88ae1 100644 --- a/crates/arc-workflows/tests/daytona_integration.rs +++ b/crates/arc-workflows/tests/daytona_integration.rs @@ -1152,19 +1152,11 @@ async fn daytona_ssh_access() { let env = create_env().await; env.initialize().await.unwrap(); - let ssh_info = env.create_ssh_access(Some(60.0)).await.unwrap(); + let ssh_command = env.create_ssh_access().await.unwrap(); + assert!(!ssh_command.is_empty(), "ssh_command should not be empty"); assert!( - !ssh_info.ssh_command.is_empty(), - "ssh_command should not be empty" - ); - assert!( - ssh_info.ssh_command.contains("ssh"), - "ssh_command should contain 'ssh': {}", - ssh_info.ssh_command - ); - assert!( - !ssh_info.token.is_empty(), - "token should not be empty" + ssh_command.contains("ssh"), + "ssh_command should contain 'ssh': {ssh_command}", ); env.cleanup().await.unwrap(); @@ -1175,7 +1167,7 @@ async fn daytona_ssh_access() { async fn daytona_ssh_access_before_init_fails() { let env = create_env().await; - let result = env.create_ssh_access(Some(60.0)).await; + let result = env.create_ssh_access().await; assert!(result.is_err(), "should fail before initialize()"); assert!( result.unwrap_err().contains("not initialized"),