chore(#1474): add reason= to remaining bare clippy allows outside dashboard

This commit is contained in:
damocles 2026-06-09 00:26:19 +02:00 committed by mara
commit 7c9954ceec
12 changed files with 81 additions and 16 deletions

View file

@ -40,7 +40,11 @@ pub fn now_unix() -> i64 {
/// the agent and manager serve loops — the shape is identical, only the /// the agent and manager serve loops — the shape is identical, only the
/// post-turn count fetch helpers differ (and those stay in each binary). /// post-turn count fetch helpers differ (and those stay in each binary).
#[must_use] #[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( pub fn build_row(
started_at: i64, started_at: i64,
ended_at: i64, ended_at: i64,

View file

@ -637,7 +637,12 @@ pub async fn compact_session(files: &TurnFiles, bus: &Bus) -> TurnOutcome {
outcome 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)> { 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 // 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 // include real context in the bail message (and downstream in the

View file

@ -423,7 +423,11 @@ fn finish_approval(
/// and reset the working tree back to the last known-good main. main /// 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 /// never advances on a failed build, so a crash-and-recover doesn't
/// leave the agent pointing at a tree it can't evaluate. /// 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( async fn run_apply_commit(
coord: &Arc<Coordinator>, coord: &Arc<Coordinator>,
approval: &hive_sh4re::Approval, approval: &hive_sh4re::Approval,

View file

@ -113,7 +113,11 @@ pub(crate) fn recv_timeout(wait_seconds: Option<u64>) -> 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 /// Handle the subset of `Request` variants that are identical on both
/// the agent socket and the manager socket. Returns `Some(response)` for /// the agent socket and the manager socket. Returns `Some(response)` for
/// every variant it handles; returns `None` for variants with socket-specific /// 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<Coordinator>) -> AgentResponse { async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) -> AgentResponse {
if let Some(resp) = dispatch_shared(req, agent, coord).await { if let Some(resp) = dispatch_shared(req, agent, coord).await {
return resp; return resp;
@ -553,7 +561,11 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
/// ///
/// The manager is not exempt - grant `read_host_journal` in /// The manager is not exempt - grant `read_host_journal` in
/// `meta/capabilities.json` to enable it for any agent including the manager. /// `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( pub async fn dispatch_host_journal(
agent: &str, agent: &str,
unit: &Option<String>, unit: &Option<String>,

View file

@ -652,7 +652,11 @@ impl Coordinator {
/// already have an authoritative timestamp from the db update, /// already have an authoritative timestamp from the db update,
/// the tiny skew between "row updated" and "event emitted" is /// the tiny skew between "row updated" and "event emitted" is
/// presentation-only and doesn't matter to clients. /// 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( pub fn emit_approval_resolved(
&self, &self,
id: i64, id: i64,
@ -685,7 +689,11 @@ impl Coordinator {
/// both operator-targeted (`target = None`) and peer-to-peer /// both operator-targeted (`target = None`) and peer-to-peer
/// (`target = Some(agent)`) threads — the dashboard surfaces /// (`target = Some(agent)`) threads — the dashboard surfaces
/// both, distinguishing visually + offering operator override. /// 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( pub fn emit_question_added(
&self, &self,
id: i64, id: i64,

View file

@ -1128,7 +1128,11 @@ fn bind_child_agent_dirs(child: &str, binds: &mut Vec<BindMount>) {
}); });
} }
#[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( async fn set_nspawn_flags(
container: &str, container: &str,
runtime_dir: &Path, runtime_dir: &Path,

View file

@ -74,7 +74,11 @@ async fn serve(stream: UnixStream, coord: Arc<Coordinator>) -> 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<Coordinator>) -> ManagerResponse { async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResponse {
// Delegate all variants shared with the agent socket to the common handler. // 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 { 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; /// zero-interval validation. Returns `Ok` on a clean update;
/// `Err` with the underlying message on any auth / validation /// `Err` with the underlying message on any auth / validation
/// failure so the dashboard can surface it verbatim. /// 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( #[allow(
clippy::option_option, clippy::option_option,
reason = "double-Option carries three-state PATCH semantics: outer None = \ reason = "double-Option carries three-state PATCH semantics: outer None = \

View file

@ -366,7 +366,11 @@ impl RebuildQueue {
// four kind-specific payload fields (inputs, approval_id, perm_payload, // four kind-specific payload fields (inputs, approval_id, perm_payload,
// depends_on). A builder struct would obscure the call sites; the // depends_on). A builder struct would obscure the call sites; the
// shorter wrappers already cover all common cases. // 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( pub fn enqueue_full(
&self, &self,
kind: QueueKind, kind: QueueKind,

View file

@ -73,7 +73,11 @@ async fn handle(stream: UnixStream, coord: Arc<Coordinator>) -> 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<Coordinator>) -> HostResponse { async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
let result: anyhow::Result<HostResponse> = async { let result: anyhow::Result<HostResponse> = async {
Ok(match req { Ok(match req {

View file

@ -62,7 +62,11 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
/// output for every supported event type without re-implementing the /// output for every supported event type without re-implementing the
/// per-arm dispatch. `print_event` is the only caller that adds the /// per-arm dispatch. `print_event` is the only caller that adds the
/// terminating newline. /// 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 { fn format_event(ev: &Value) -> String {
let event_type = ev.get("type").and_then(Value::as_str).unwrap_or("?"); let event_type = ev.get("type").and_then(Value::as_str).unwrap_or("?");
let user = ev let user = ev

View file

@ -147,7 +147,11 @@ struct InviteUserArgs {
} }
struct MatrixBridge { 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<Self>, tool_router: rmcp::handler::server::router::tool::ToolRouter<Self>,
} }

View file

@ -155,7 +155,11 @@ async fn write_line_event(writer: &mut OwnedWriteHalf, stream: PrivStream, data:
/// For streaming ops (`CreateContainer`/`UpdateContainer` with `stream: true`) /// For streaming ops (`CreateContainer`/`UpdateContainer` with `stream: true`)
/// output lines are forwarded to `writer` as `PrivEvent::Line` messages and /// output lines are forwarded to `writer` as `PrivEvent::Line` messages and
/// the returned strings are empty. /// 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)> { async fn exec(req: PrivRequest, writer: &mut OwnedWriteHalf) -> Result<(String, String)> {
match req { match req {
PrivRequest::StartContainer { ref name } => { PrivRequest::StartContainer { ref name } => {