fix(build): complete strict lint and test cleanup (replacement for #476)

This commit is contained in:
Chummy 2026-02-17 23:19:55 +08:00
parent fc6e8eb521
commit 0aa35eb669
9 changed files with 24 additions and 34 deletions

View file

@ -7,6 +7,7 @@ pub mod prompt;
#[allow(unused_imports)] #[allow(unused_imports)]
pub use agent::{Agent, AgentBuilder}; pub use agent::{Agent, AgentBuilder};
#[allow(unused_imports)]
pub use loop_::{process_message, run}; pub use loop_::{process_message, run};
#[cfg(test)] #[cfg(test)]

View file

@ -124,20 +124,15 @@ fn default_max_depth() -> u32 {
// ── Hardware Config (wizard-driven) ───────────────────────────── // ── Hardware Config (wizard-driven) ─────────────────────────────
/// Hardware transport mode. /// Hardware transport mode.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum HardwareTransport { pub enum HardwareTransport {
#[default]
None, None,
Native, Native,
Serial, Serial,
Probe, Probe,
} }
impl Default for HardwareTransport {
fn default() -> Self {
Self::None
}
}
impl std::fmt::Display for HardwareTransport { impl std::fmt::Display for HardwareTransport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
@ -407,7 +402,7 @@ fn get_default_pricing() -> std::collections::HashMap<String, ModelPricing> {
// ── Peripherals (hardware: STM32, RPi GPIO, etc.) ──────────────────────── // ── Peripherals (hardware: STM32, RPi GPIO, etc.) ────────────────────────
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PeripheralsConfig { pub struct PeripheralsConfig {
/// Enable peripheral support (boards become agent tools) /// Enable peripheral support (boards become agent tools)
#[serde(default)] #[serde(default)]
@ -444,16 +439,6 @@ fn default_peripheral_baud() -> u32 {
115_200 115_200
} }
impl Default for PeripheralsConfig {
fn default() -> Self {
Self {
enabled: false,
boards: Vec::new(),
datasheet_dir: None,
}
}
}
impl Default for PeripheralBoardConfig { impl Default for PeripheralBoardConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
@ -710,6 +695,7 @@ fn default_http_timeout_secs() -> u64 {
// ── Memory ─────────────────────────────────────────────────── // ── Memory ───────────────────────────────────────────────────
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[allow(clippy::struct_excessive_bools)]
pub struct MemoryConfig { pub struct MemoryConfig {
/// "sqlite" | "lucid" | "markdown" | "none" (`none` = explicit no-op memory) /// "sqlite" | "lucid" | "markdown" | "none" (`none` = explicit no-op memory)
pub backend: String, pub backend: String,

View file

@ -9,6 +9,7 @@
use anyhow::Result; use anyhow::Result;
use chrono::Local; use chrono::Local;
use rusqlite::{params, Connection}; use rusqlite::{params, Connection};
use std::fmt::Write;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -63,18 +64,17 @@ pub fn export_snapshot(workspace_dir: &Path) -> Result<usize> {
output.push_str(SNAPSHOT_HEADER); output.push_str(SNAPSHOT_HEADER);
let now = Local::now().format("%Y-%m-%d %H:%M:%S").to_string(); let now = Local::now().format("%Y-%m-%d %H:%M:%S").to_string();
output.push_str(&format!("**Last exported:** {now}\n\n")); write!(output, "**Last exported:** {now}\n\n").unwrap();
output.push_str(&format!( write!(output, "**Total core memories:** {}\n\n---\n\n", rows.len()).unwrap();
"**Total core memories:** {}\n\n---\n\n",
rows.len()
));
for (key, content, _category, created_at, updated_at) in &rows { for (key, content, _category, created_at, updated_at) in &rows {
output.push_str(&format!("### 🔑 `{key}`\n\n")); write!(output, "### 🔑 `{key}`\n\n").unwrap();
output.push_str(&format!("{content}\n\n")); write!(output, "{content}\n\n").unwrap();
output.push_str(&format!( write!(
output,
"*Created: {created_at} | Updated: {updated_at}*\n\n---\n\n" "*Created: {created_at} | Updated: {updated_at}*\n\n---\n\n"
)); )
.unwrap();
} }
let snapshot_path = snapshot_path(workspace_dir); let snapshot_path = snapshot_path(workspace_dir);

View file

@ -5,11 +5,14 @@ pub mod otel;
pub mod traits; pub mod traits;
pub mod verbose; pub mod verbose;
#[allow(unused_imports)]
pub use self::log::LogObserver; pub use self::log::LogObserver;
#[allow(unused_imports)]
pub use self::multi::MultiObserver; pub use self::multi::MultiObserver;
pub use noop::NoopObserver; pub use noop::NoopObserver;
pub use otel::OtelObserver; pub use otel::OtelObserver;
pub use traits::{Observer, ObserverEvent}; pub use traits::{Observer, ObserverEvent};
#[allow(unused_imports)]
pub use verbose::VerboseObserver; pub use verbose::VerboseObserver;
use crate::config::ObservabilityConfig; use crate::config::ObservabilityConfig;

View file

@ -41,7 +41,6 @@ pub fn ensure_arduino_cli() -> Result<()> {
if !arduino_cli_available() { if !arduino_cli_available() {
anyhow::bail!("arduino-cli still not found after install. Ensure it's in PATH."); anyhow::bail!("arduino-cli still not found after install. Ensure it's in PATH.");
} }
return Ok(());
} }
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@ -58,6 +57,9 @@ pub fn ensure_arduino_cli() -> Result<()> {
println!("arduino-cli not found. Install it: https://arduino.github.io/arduino-cli/"); println!("arduino-cli not found. Install it: https://arduino.github.io/arduino-cli/");
anyhow::bail!("arduino-cli not installed."); anyhow::bail!("arduino-cli not installed.");
} }
#[allow(unreachable_code)]
Ok(())
} }
/// Ensure arduino:avr core is installed. /// Ensure arduino:avr core is installed.

View file

@ -412,10 +412,7 @@ impl Provider for ReliableProvider {
// Convert channel receiver to stream // Convert channel receiver to stream
return stream::unfold(rx, |mut rx| async move { return stream::unfold(rx, |mut rx| async move {
match rx.recv().await { rx.recv().await.map(|chunk| (chunk, rx))
Some(chunk) => Some((chunk, rx)),
None => None,
}
}) })
.boxed(); .boxed();
} }

View file

@ -140,7 +140,7 @@ impl StreamChunk {
/// Estimate tokens (rough approximation: ~4 chars per token). /// Estimate tokens (rough approximation: ~4 chars per token).
pub fn with_token_estimate(mut self) -> Self { pub fn with_token_estimate(mut self) -> Self {
self.token_count = (self.delta.len() + 3) / 4; self.token_count = self.delta.len().div_ceil(4);
self self
} }
} }

View file

@ -49,6 +49,7 @@ pub use memory_recall::MemoryRecallTool;
pub use memory_store::MemoryStoreTool; pub use memory_store::MemoryStoreTool;
pub use pushover::PushoverTool; pub use pushover::PushoverTool;
pub use schedule::ScheduleTool; pub use schedule::ScheduleTool;
#[allow(unused_imports)]
pub use schema::{CleaningStrategy, SchemaCleanr}; pub use schema::{CleaningStrategy, SchemaCleanr};
pub use screenshot::ScreenshotTool; pub use screenshot::ScreenshotTool;
pub use shell::ShellTool; pub use shell::ShellTool;

View file

@ -103,7 +103,7 @@ pub enum CleaningStrategy {
impl CleaningStrategy { impl CleaningStrategy {
/// Get the list of unsupported keywords for this strategy. /// Get the list of unsupported keywords for this strategy.
pub fn unsupported_keywords(&self) -> &'static [&'static str] { pub fn unsupported_keywords(self) -> &'static [&'static str] {
match self { match self {
Self::Gemini => GEMINI_UNSUPPORTED_KEYWORDS, Self::Gemini => GEMINI_UNSUPPORTED_KEYWORDS,
Self::Anthropic => &["$ref", "$defs", "definitions"], // Anthropic doesn't resolve refs Self::Anthropic => &["$ref", "$defs", "definitions"], // Anthropic doesn't resolve refs