style: import ordering + blank lines after now_unix sweep (treefmt)

This commit is contained in:
müde 2026-07-06 22:08:40 +02:00
commit dc6a37b29a
14 changed files with 10 additions and 26 deletions

View file

@ -13,10 +13,10 @@ use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, Ordering};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use hive_claude::TokenUsage; use hive_claude::TokenUsage;
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, params}; use rusqlite::{Connection, params};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::broadcast; use tokio::sync::broadcast;
use hive_sh4re::wire_time::now_unix;
const CHANNEL_CAPACITY: usize = 256; const CHANNEL_CAPACITY: usize = 256;
/// Max `LiveEvent`s the `Bus` returns from `history()` and keeps in /// Max `LiveEvent`s the `Bus` returns from `history()` and keeps in
@ -214,7 +214,6 @@ pub fn write_forge_cursor<S: std::hash::BuildHasher>(
write_harness_json(&v); write_harness_json(&v);
} }
const SCHEMA: &str = " const SCHEMA: &str = "
CREATE TABLE IF NOT EXISTS events ( CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,

View file

@ -568,7 +568,6 @@ fn u64_from_i64(v: i64) -> u64 {
u64::try_from(v).unwrap_or(0) u64::try_from(v).unwrap_or(0)
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -17,8 +17,8 @@
use std::path::Path; use std::path::Path;
use std::time::Duration; use std::time::Duration;
use rusqlite::{Connection, Result, params};
use hive_sh4re::wire_time::now_unix; use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, Result, params};
/// How often the sweep runs. /// How often the sweep runs.
const VACUUM_INTERVAL: Duration = Duration::from_hours(1); const VACUUM_INTERVAL: Duration = Duration::from_hours(1);
@ -131,4 +131,3 @@ fn vacuum_events(path: &Path) -> Result<u64> {
)?; )?;
Ok(u64::try_from(removed).unwrap_or(0)) Ok(u64::try_from(removed).unwrap_or(0))
} }

View file

@ -6,9 +6,9 @@ use std::path::Path;
use std::sync::Mutex; use std::sync::Mutex;
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use hive_sh4re::wire_time::now_unix;
use hive_sh4re::{Approval, ApprovalKind, ApprovalStatus}; use hive_sh4re::{Approval, ApprovalKind, ApprovalStatus};
use rusqlite::{Connection, OptionalExtension, params}; use rusqlite::{Connection, OptionalExtension, params};
use hive_sh4re::wire_time::now_unix;
const SCHEMA: &str = r" const SCHEMA: &str = r"
CREATE TABLE IF NOT EXISTS approvals ( CREATE TABLE IF NOT EXISTS approvals (
@ -367,7 +367,6 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
}) })
} }
fn kind_from_str(s: &str) -> Result<ApprovalKind> { fn kind_from_str(s: &str) -> Result<ApprovalKind> {
Ok(match s { Ok(match s {
"apply_commit" => ApprovalKind::ApplyCommit, "apply_commit" => ApprovalKind::ApplyCommit,
@ -380,7 +379,6 @@ fn kind_from_str(s: &str) -> Result<ApprovalKind> {
}) })
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -25,9 +25,9 @@ use std::sync::{Arc, Mutex, OnceLock};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, params}; use rusqlite::{Connection, params};
use serde::Serialize; use serde::Serialize;
use hive_sh4re::wire_time::now_unix;
/// Process-singleton handle, set once at coordinator startup. Mirrors /// Process-singleton handle, set once at coordinator startup. Mirrors
/// `build_logs::GLOBAL` — lets recording sites write without threading an /// `build_logs::GLOBAL` — lets recording sites write without threading an
@ -259,7 +259,6 @@ fn row_to_entry(r: &rusqlite::Row) -> rusqlite::Result<AuditEntry> {
}) })
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -8,11 +8,11 @@ use std::sync::Mutex;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use hive_sh4re::wire_time::now_unix;
use hive_sh4re::{InboxRow, Message}; use hive_sh4re::{InboxRow, Message};
use rusqlite::{Connection, OptionalExtension, params}; use rusqlite::{Connection, OptionalExtension, params};
use serde::Serialize; use serde::Serialize;
use tokio::sync::broadcast; use tokio::sync::broadcast;
use hive_sh4re::wire_time::now_unix;
const SCHEMA: &str = r" const SCHEMA: &str = r"
CREATE TABLE IF NOT EXISTS messages ( CREATE TABLE IF NOT EXISTS messages (
@ -1136,7 +1136,6 @@ fn ensure_reminder_columns(conn: &Connection) -> Result<()> {
) )
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -7,10 +7,10 @@ use std::path::Path;
use std::sync::{Arc, Mutex, OnceLock}; use std::sync::{Arc, Mutex, OnceLock};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, OptionalExtension, params}; use rusqlite::{Connection, OptionalExtension, params};
use serde::Serialize; use serde::Serialize;
use tokio::sync::broadcast; use tokio::sync::broadcast;
use hive_sh4re::wire_time::now_unix;
/// Process-singleton handle, set once at coordinator startup. Lets /// Process-singleton handle, set once at coordinator startup. Lets
/// the `lifecycle` module's `run` / `prebuild_toplevel` access the /// the `lifecycle` module's `run` / `prebuild_toplevel` access the
@ -438,7 +438,6 @@ fn row_to_header(r: &rusqlite::Row) -> rusqlite::Result<BuildLogHeader> {
}) })
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -226,7 +226,6 @@ struct AgentAgg {
bash: HashMap<String, u64>, bash: HashMap<String, u64>,
} }
#[allow( #[allow(
clippy::cast_sign_loss, clippy::cast_sign_loss,
clippy::cast_possible_truncation, clippy::cast_possible_truncation,

View file

@ -28,8 +28,8 @@ mod tests;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use std::sync::Mutex; use std::sync::Mutex;
use tokio::sync::Notify;
use hive_sh4re::wire_time::now_unix; use hive_sh4re::wire_time::now_unix;
use tokio::sync::Notify;
pub use model::{ pub use model::{
Dag, DagSpec, DagView, DepWhen, Node, NodeId, NodeKind, PermPayload, Source, State, Template, Dag, DagSpec, DagView, DepWhen, Node, NodeId, NodeKind, PermPayload, Source, State, Template,
@ -566,4 +566,3 @@ impl JobQueue {
inner.dags = kept.into_iter().rev().collect(); inner.dags = kept.into_iter().rev().collect();
} }
} }

View file

@ -13,7 +13,6 @@
//! the dashboard uses, so the bottleneck would be json //! the dashboard uses, so the bottleneck would be json
//! (de)serialisation, not the read. //! (de)serialisation, not the read.
use anyhow::Result; use anyhow::Result;
use hive_sh4re::LooseEnd; use hive_sh4re::LooseEnd;
@ -143,7 +142,6 @@ fn saturating_age(now: i64, then: i64) -> u64 {
u64::try_from(delta).unwrap_or(0) u64::try_from(delta).unwrap_or(0)
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -15,9 +15,9 @@ use std::sync::Mutex;
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, OptionalExtension, params}; use rusqlite::{Connection, OptionalExtension, params};
use serde::Serialize; use serde::Serialize;
use hive_sh4re::wire_time::now_unix;
const SCHEMA: &str = r" const SCHEMA: &str = r"
CREATE TABLE IF NOT EXISTS operator_questions ( CREATE TABLE IF NOT EXISTS operator_questions (
@ -271,4 +271,3 @@ fn row_to_question(row: &rusqlite::Row<'_>) -> rusqlite::Result<OpQuestion> {
target: row.get(9)?, target: row.get(9)?,
}) })
} }

View file

@ -18,8 +18,8 @@ use std::path::Path;
use std::sync::Mutex; use std::sync::Mutex;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use rusqlite::{Connection, OptionalExtension, params};
use hive_sh4re::wire_time::now_unix; use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, OptionalExtension, params};
const SCHEMA: &str = " const SCHEMA: &str = "
CREATE TABLE IF NOT EXISTS agent_power ( CREATE TABLE IF NOT EXISTS agent_power (
@ -158,7 +158,6 @@ impl PowerStore {
} }
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -16,9 +16,9 @@ use std::path::Path;
use std::sync::Mutex; use std::sync::Mutex;
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, OptionalExtension, params}; use rusqlite::{Connection, OptionalExtension, params};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use hive_sh4re::wire_time::now_unix;
/// Typed error returned by [`ScheduledPrompts::pause`] and /// Typed error returned by [`ScheduledPrompts::pause`] and
/// [`ScheduledPrompts::resume`] when the target row does not exist or /// [`ScheduledPrompts::resume`] when the target row does not exist or
@ -675,7 +675,6 @@ fn load_targets(conn: &Connection, schedule_id: i64) -> Result<Vec<ScheduleTarge
Ok(out) Ok(out)
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -237,7 +237,6 @@ fn notify_operator_missing_target(coord: &Coordinator, schedule: &Schedule, targ
} }
} }
/// Per-target outcome counts for one `fire_now` invocation. /// Per-target outcome counts for one `fire_now` invocation.
/// Returned to the operator so the dashboard can render /// Returned to the operator so the dashboard can render
/// "fired to N (M failed, K missing)" without a follow-up GET. /// "fired to N (M failed, K missing)" without a follow-up GET.