(state: &Arc<ServerState>, sandbox_id: &str)
| 127 | } |
| 128 | |
| 129 | async fn ensure_sandbox_exists(state: &Arc<ServerState>, sandbox_id: &str) -> Result<(), Status> { |
| 130 | if sandbox_id.is_empty() { |
| 131 | return Err(Status::invalid_argument("sandbox_id is required")); |
| 132 | } |
| 133 | |
| 134 | state |
| 135 | .store |
| 136 | .get_message::<Sandbox>(sandbox_id) |
| 137 | .await |
| 138 | .map_err(|e| Status::internal(format!("fetch sandbox failed: {e}")))? |
| 139 | .ok_or_else(|| Status::not_found("sandbox not found"))?; |
| 140 | |
| 141 | Ok(()) |
| 142 | } |
| 143 | |
| 144 | #[cfg(test)] |
| 145 | mod tests { |
no test coverage detected