From 7c9954ceec76d9334f0773eeb6afe1097e2731e8 Mon Sep 17 00:00:00 2001 From: damocles Date: Tue, 9 Jun 2026 00:26:19 +0200 Subject: [PATCH] chore(#1474): add reason= to remaining bare clippy allows outside dashboard --- hive-ag3nt/src/serve_common.rs | 6 +++++- hive-ag3nt/src/turn.rs | 7 ++++++- hive-c0re/src/actions.rs | 6 +++++- hive-c0re/src/agent_server.rs | 18 +++++++++++++++--- hive-c0re/src/coordinator.rs | 12 ++++++++++-- hive-c0re/src/lifecycle.rs | 6 +++++- hive-c0re/src/manager_server.rs | 12 ++++++++++-- hive-c0re/src/rebuild_queue.rs | 6 +++++- hive-c0re/src/server.rs | 6 +++++- hive-forge/src/verbs/timeline.rs | 6 +++++- hive-matrix-mcp/src/bin/mcp.rs | 6 +++++- hive-priv/src/main.rs | 6 +++++- 12 files changed, 81 insertions(+), 16 deletions(-) diff --git a/hive-ag3nt/src/serve_common.rs b/hive-ag3nt/src/serve_common.rs index d44adb3f..eaf8a529 100644 --- a/hive-ag3nt/src/serve_common.rs +++ b/hive-ag3nt/src/serve_common.rs @@ -40,7 +40,11 @@ pub fn now_unix() -> i64 { /// the agent and manager serve loops — the shape is identical, only the /// post-turn count fetch helpers differ (and those stay in each binary). #[must_use] -#[allow(clippy::too_many_arguments)] +#[allow( + clippy::too_many_arguments, + reason = "args mirror the turn-stats row columns 1:1; a builder struct used \ + only here would just relabel the same fields" +)] pub fn build_row( started_at: i64, ended_at: i64, diff --git a/hive-ag3nt/src/turn.rs b/hive-ag3nt/src/turn.rs index ca3129a0..a06cf1c9 100644 --- a/hive-ag3nt/src/turn.rs +++ b/hive-ag3nt/src/turn.rs @@ -637,7 +637,12 @@ pub async fn compact_session(files: &TurnFiles, bus: &Bus) -> TurnOutcome { outcome } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "one linear subprocess driver: spawn claude, stream + classify \ + stdout/stderr, then assemble the outcome; splitting it would \ + fragment the streaming state across helpers" +)] async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<(bool, bool, bool)> { // Keep the last STDERR_TAIL_LINES of stderr so a non-zero exit can // include real context in the bail message (and downstream in the diff --git a/hive-c0re/src/actions.rs b/hive-c0re/src/actions.rs index 5235d226..c1f8bb44 100644 --- a/hive-c0re/src/actions.rs +++ b/hive-c0re/src/actions.rs @@ -423,7 +423,11 @@ fn finish_approval( /// and reset the working tree back to the last known-good main. main /// never advances on a failed build, so a crash-and-recover doesn't /// leave the agent pointing at a tree it can't evaluate. -#[allow(clippy::too_many_lines)] // sequential build/tag/notify pipeline; splitting would obscure the flow +#[allow( + clippy::too_many_lines, + reason = "one sequential build/tag/notify pipeline; splitting the steps \ + across helpers would obscure the linear flow without shrinking it" +)] async fn run_apply_commit( coord: &Arc, approval: &hive_sh4re::Approval, diff --git a/hive-c0re/src/agent_server.rs b/hive-c0re/src/agent_server.rs index 80a58e6e..2949de69 100644 --- a/hive-c0re/src/agent_server.rs +++ b/hive-c0re/src/agent_server.rs @@ -113,7 +113,11 @@ pub(crate) fn recv_timeout(wait_seconds: Option) -> std::time::Duration { } } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat dispatch table: one match arm per shared request variant; \ + splitting it would scatter the routing logic without shrinking it" +)] /// Handle the subset of `Request` variants that are identical on both /// the agent socket and the manager socket. Returns `Some(response)` for /// every variant it handles; returns `None` for variants with socket-specific @@ -301,7 +305,11 @@ pub(crate) async fn dispatch_shared( }) } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat dispatch table: one match arm per agent-socket request \ + variant; splitting it would scatter the routing logic" +)] async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc) -> AgentResponse { if let Some(resp) = dispatch_shared(req, agent, coord).await { return resp; @@ -553,7 +561,11 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc) -> /// /// The manager is not exempt - grant `read_host_journal` in /// `meta/capabilities.json` to enable it for any agent including the manager. -#[allow(clippy::too_many_arguments)] +#[allow( + clippy::too_many_arguments, + reason = "args mirror the GetHostJournal wire variant 1:1 at this single \ + call site; a params struct would just relabel the same fields" +)] pub async fn dispatch_host_journal( agent: &str, unit: &Option, diff --git a/hive-c0re/src/coordinator.rs b/hive-c0re/src/coordinator.rs index 68d352e1..60a0286e 100644 --- a/hive-c0re/src/coordinator.rs +++ b/hive-c0re/src/coordinator.rs @@ -652,7 +652,11 @@ impl Coordinator { /// already have an authoritative timestamp from the db update, /// the tiny skew between "row updated" and "event emitted" is /// presentation-only and doesn't matter to clients. - #[allow(clippy::too_many_arguments)] + #[allow( + clippy::too_many_arguments, + reason = "args mirror the approval-resolved event payload fields; \ + bundling them into a struct used only here adds no clarity" + )] pub fn emit_approval_resolved( &self, id: i64, @@ -685,7 +689,11 @@ impl Coordinator { /// both operator-targeted (`target = None`) and peer-to-peer /// (`target = Some(agent)`) threads — the dashboard surfaces /// both, distinguishing visually + offering operator override. - #[allow(clippy::too_many_arguments)] + #[allow( + clippy::too_many_arguments, + reason = "args mirror the question-added event payload fields; \ + bundling them into a struct used only here adds no clarity" + )] pub fn emit_question_added( &self, id: i64, diff --git a/hive-c0re/src/lifecycle.rs b/hive-c0re/src/lifecycle.rs index 0816ec4d..51d7af3a 100644 --- a/hive-c0re/src/lifecycle.rs +++ b/hive-c0re/src/lifecycle.rs @@ -1128,7 +1128,11 @@ fn bind_child_agent_dirs(child: &str, binds: &mut Vec) { }); } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "one contiguous nspawn-flag assembly block; the length is the flag \ + surface itself, splitting it would just hide the shape" +)] async fn set_nspawn_flags( container: &str, runtime_dir: &Path, diff --git a/hive-c0re/src/manager_server.rs b/hive-c0re/src/manager_server.rs index 1e13f378..d7cbcfdf 100644 --- a/hive-c0re/src/manager_server.rs +++ b/hive-c0re/src/manager_server.rs @@ -74,7 +74,11 @@ async fn serve(stream: UnixStream, coord: Arc) -> Result<()> { } } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat dispatch table: one match arm per manager-socket request \ + variant; splitting it would scatter the routing logic" +)] async fn dispatch(req: &ManagerRequest, coord: &Arc) -> ManagerResponse { // Delegate all variants shared with the agent socket to the common handler. if let Some(resp) = crate::agent_server::dispatch_shared(req, MANAGER_AGENT, coord).await { @@ -664,7 +668,11 @@ async fn handle_fire_schedule_now( /// zero-interval validation. Returns `Ok` on a clean update; /// `Err` with the underlying message on any auth / validation /// failure so the dashboard can surface it verbatim. -#[allow(clippy::too_many_arguments)] +#[allow( + clippy::too_many_arguments, + reason = "args mirror the edit-schedule PATCH fields 1:1; bundling them into \ + a struct used only here adds no clarity" +)] #[allow( clippy::option_option, reason = "double-Option carries three-state PATCH semantics: outer None = \ diff --git a/hive-c0re/src/rebuild_queue.rs b/hive-c0re/src/rebuild_queue.rs index 425203dd..97e91c6d 100644 --- a/hive-c0re/src/rebuild_queue.rs +++ b/hive-c0re/src/rebuild_queue.rs @@ -366,7 +366,11 @@ impl RebuildQueue { // four kind-specific payload fields (inputs, approval_id, perm_payload, // depends_on). A builder struct would obscure the call sites; the // shorter wrappers already cover all common cases. - #[allow(clippy::too_many_arguments)] + #[allow( + clippy::too_many_arguments, + reason = "args mirror the queue-entry fields the row is built from; the \ + thinner enqueue helpers wrap this for the common cases" + )] pub fn enqueue_full( &self, kind: QueueKind, diff --git a/hive-c0re/src/server.rs b/hive-c0re/src/server.rs index 0fc79567..0c3e0d85 100644 --- a/hive-c0re/src/server.rs +++ b/hive-c0re/src/server.rs @@ -73,7 +73,11 @@ async fn handle(stream: UnixStream, coord: Arc) -> Result<()> { } } -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat dispatch table: one match arm per host-socket request \ + variant; splitting it would scatter the routing logic" +)] async fn dispatch(req: &HostRequest, coord: Arc) -> HostResponse { let result: anyhow::Result = async { Ok(match req { diff --git a/hive-forge/src/verbs/timeline.rs b/hive-forge/src/verbs/timeline.rs index e9c7cca6..8677cb8d 100644 --- a/hive-forge/src/verbs/timeline.rs +++ b/hive-forge/src/verbs/timeline.rs @@ -62,7 +62,11 @@ pub fn run(client: &Client, args: Args) -> Result<()> { /// output for every supported event type without re-implementing the /// per-arm dispatch. `print_event` is the only caller that adds the /// terminating newline. -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat per-event-type dispatch: one arm per timeline event kind; \ + splitting it would scatter the formatting without shrinking it" +)] fn format_event(ev: &Value) -> String { let event_type = ev.get("type").and_then(Value::as_str).unwrap_or("?"); let user = ev diff --git a/hive-matrix-mcp/src/bin/mcp.rs b/hive-matrix-mcp/src/bin/mcp.rs index cb0cf030..0dc0e48f 100644 --- a/hive-matrix-mcp/src/bin/mcp.rs +++ b/hive-matrix-mcp/src/bin/mcp.rs @@ -147,7 +147,11 @@ struct InviteUserArgs { } struct MatrixBridge { - #[allow(dead_code)] + #[allow( + dead_code, + reason = "populated by the #[tool_router] macro; the generated \ + ServerHandler wiring consumes it, the field is never read directly" + )] tool_router: rmcp::handler::server::router::tool::ToolRouter, } diff --git a/hive-priv/src/main.rs b/hive-priv/src/main.rs index a830c7da..58733b8b 100644 --- a/hive-priv/src/main.rs +++ b/hive-priv/src/main.rs @@ -155,7 +155,11 @@ async fn write_line_event(writer: &mut OwnedWriteHalf, stream: PrivStream, data: /// For streaming ops (`CreateContainer`/`UpdateContainer` with `stream: true`) /// output lines are forwarded to `writer` as `PrivEvent::Line` messages and /// the returned strings are empty. -#[allow(clippy::too_many_lines)] +#[allow( + clippy::too_many_lines, + reason = "flat dispatch table: one match arm per privileged request variant; \ + splitting it would scatter the routing logic" +)] async fn exec(req: PrivRequest, writer: &mut OwnedWriteHalf) -> Result<(String, String)> { match req { PrivRequest::StartContainer { ref name } => {