From ad0752822a3571ca46b42a34887fe18a305aeecd Mon Sep 17 00:00:00 2001 From: atlas Date: Sat, 11 Jul 2026 11:51:01 +0200 Subject: [PATCH] =?UTF-8?q?fix(#2377):=20extract=20handle=5Fagent=5Fstatus?= =?UTF-8?q?=20=E2=80=94=20drop=20clippy::too=5Fmany=5Flines=20allow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dispatch was 101 lines (1 over limit) due to the AgentStatus arm. Extract it to a dedicated handle_agent_status helper to bring dispatch under the 100-line lint limit without the allow attribute. Per mara review comment on PR #2379. --- hive-c0re/src/server.rs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/hive-c0re/src/server.rs b/hive-c0re/src/server.rs index f98f9312..0320467d 100644 --- a/hive-c0re/src/server.rs +++ b/hive-c0re/src/server.rs @@ -74,7 +74,6 @@ async fn handle(stream: UnixStream, coord: Arc) -> Result<()> { } } -#[allow(clippy::too_many_lines)] async fn dispatch(req: &HostRequest, coord: Arc) -> HostResponse { let result: anyhow::Result = async { Ok(match req { @@ -147,22 +146,7 @@ async fn dispatch(req: &HostRequest, coord: Arc) -> HostResponse { HostResponse::dags(dags) } HostRequest::List => HostResponse::list(lifecycle::list().await?), - HostRequest::AgentStatus => { - let rows = crate::container_view::build_all(&coord) - .await - .into_iter() - .map(|v| hive_sh4re::AgentStatusRow { - name: v.name, - running: v.running, - needs_update: v.needs_update, - needs_login: v.needs_login, - deployed_sha: v.deployed_sha, - pending_reminders: v.pending_reminders, - parent: v.parent, - }) - .collect(); - HostResponse::agent_statuses(rows) - } + HostRequest::AgentStatus => handle_agent_status(&coord).await, // The hive domain + per-surface public URLs are injected into // c0re's service env by hive-c0re.nix; surface them so the // operator CLI can fill in this hive's own identity (the @@ -243,6 +227,24 @@ async fn handle_spawn(coord: &Arc, name: &str) -> Result) -> HostResponse { + let rows = crate::container_view::build_all(coord) + .await + .into_iter() + .map(|v| hive_sh4re::AgentStatusRow { + name: v.name, + running: v.running, + needs_update: v.needs_update, + needs_login: v.needs_login, + deployed_sha: v.deployed_sha, + pending_reminders: v.pending_reminders, + parent: v.parent, + }) + .collect(); + HostResponse::agent_statuses(rows) +} + /// Single-agent queue verbs the admin socket exposes. Each submits the /// matching DAG (persisting the `wanted` intent, serializing on the /// agent's lease, with the transient/crash-watch suppression the old