From 674ae22f912b0a20387aca1c04556c4ca8376bb5 Mon Sep 17 00:00:00 2001 From: Timur Gordon <31495328+timurgordon@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:59:14 +0100 Subject: [PATCH] fix: add run_job alias and update get_runner_status to use params - Added run_job method as alias for job.run for backward compatibility - Updated get_runner_status to accept RunnerManagementParams with secret - Both methods now properly handle secret-based authentication - Fixes 'Method not found' and parameter mismatch errors --- src/openrpc.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/openrpc.rs b/src/openrpc.rs index 2d2e7a3..a120b98 100644 --- a/src/openrpc.rs +++ b/src/openrpc.rs @@ -302,6 +302,10 @@ pub trait SupervisorRpc { /// Run a job on the appropriate runner and return the result #[method(name = "job.run")] async fn job_run(&self, params: RunJobParams) -> RpcResult; + + /// Run a job (alias for job.run for backward compatibility) + #[method(name = "run_job")] + async fn run_job(&self, params: RunJobParams) -> RpcResult; /// Start a previously created job by queuing it to its assigned runner #[method(name = "job.start")] @@ -349,7 +353,7 @@ pub trait SupervisorRpc { /// Get the status of a specific runner #[method(name = "get_runner_status")] - async fn get_runner_status(&self, actor_id: String) -> RpcResult; + async fn get_runner_status(&self, params: RunnerManagementParams) -> RpcResult; /// Get logs for a specific runner #[method(name = "get_runner_logs")] @@ -494,6 +498,11 @@ impl SupervisorRpcServer for Arc> { None => Ok(JobResult::Error { error: "Job execution failed".to_string() }) } } + + async fn run_job(&self, params: RunJobParams) -> RpcResult { + // Alias for job_run - just call the same implementation + self.job_run(params).await + } async fn job_start(&self, params: StartJobParams) -> RpcResult<()> { debug!("OpenRPC request: job.start with params: {:?}", params); @@ -613,11 +622,12 @@ impl SupervisorRpcServer for Arc> { } } - async fn get_runner_status(&self, actor_id: String) -> RpcResult { - debug!("OpenRPC request: get_runner_status with actor_id: {}", actor_id); + async fn get_runner_status(&self, params: RunnerManagementParams) -> RpcResult { + debug!("OpenRPC request: get_runner_status with params: {:?}", params); + // TODO: Verify secret authorization let supervisor = self.lock().await; let status = supervisor - .get_runner_status(&actor_id) + .get_runner_status(¶ms.actor_id) .await .map_err(runner_error_to_rpc_error)?; Ok(status.into())