diff --git a/.gitignore b/.gitignore index f45749b07..284e6dea5 100644 --- a/.gitignore +++ b/.gitignore @@ -36,13 +36,16 @@ docs/prd/ **/.venv/ **/.conda/ +# 生成物 +src-tauri/gen + # Local env files .env .env.* !.env.example # IDEs 和 编辑器 -# .claude/ +.claude/ .playwright-mcp/ # lwmacct preference diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 330437d06..2a980d05c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -117,3 +117,4 @@ tempfile = "3" [features] default = ["custom-protocol"] custom-protocol = ["tauri/custom-protocol"] +notification = [] # 预留特性:系统通知功能 diff --git a/src-tauri/src/agent/native_agent.rs b/src-tauri/src/agent/native_agent.rs index 49e4611fe..2158363a1 100644 --- a/src-tauri/src/agent/native_agent.rs +++ b/src-tauri/src/agent/native_agent.rs @@ -938,7 +938,6 @@ impl NativeAgentState { #[cfg(test)] mod tests { - use super::*; use crate::agent::parsers::OpenAISSEParser; #[test] diff --git a/src-tauri/src/agent/tool_loop.rs b/src-tauri/src/agent/tool_loop.rs index 51dca0072..841133d91 100644 --- a/src-tauri/src/agent/tool_loop.rs +++ b/src-tauri/src/agent/tool_loop.rs @@ -740,11 +740,6 @@ mod proptests { "[a-zA-Z0-9 ]{1,50}".prop_map(|s| s) } - /// 生成工具调用数量 - fn arb_tool_call_count() -> impl Strategy { - 1..=5usize - } - proptest! { #![proptest_config(ProptestConfig::with_cases(100))] diff --git a/src-tauri/src/agent/tools/read_file.rs b/src-tauri/src/agent/tools/read_file.rs index e84be2484..365f7abe5 100644 --- a/src-tauri/src/agent/tools/read_file.rs +++ b/src-tauri/src/agent/tools/read_file.rs @@ -652,7 +652,7 @@ mod tests { assert!(end <= 100); // 指定起始行 - let (start, end) = calculate_line_range(100, Some(50), None); + let (start, _end) = calculate_line_range(100, Some(50), None); assert_eq!(start, 50); // 指定结束行 @@ -723,6 +723,7 @@ mod tests { #[cfg(test)] mod proptests { + #![allow(dead_code)] use super::*; use proptest::prelude::*; use std::fs; diff --git a/src-tauri/src/agent/tools/write_file.rs b/src-tauri/src/agent/tools/write_file.rs index f14d15c87..96b0639be 100644 --- a/src-tauri/src/agent/tools/write_file.rs +++ b/src-tauri/src/agent/tools/write_file.rs @@ -490,6 +490,7 @@ mod tests { #[cfg(test)] mod proptests { + #![allow(dead_code)] use super::*; use crate::agent::tools::read_file::ReadFileTool; use proptest::prelude::*; diff --git a/src-tauri/src/app/runner.rs b/src-tauri/src/app/runner.rs index cea63a5ac..7e12db063 100644 --- a/src-tauri/src/app/runner.rs +++ b/src-tauri/src/app/runner.rs @@ -3,7 +3,7 @@ //! 包含 Tauri 应用的主入口函数和命令注册。 use std::sync::Arc; -use tauri::{Emitter, Listener, Manager}; +use tauri::Manager; use crate::commands; use crate::tray::{TrayIconStatus, TrayManager, TrayStateSnapshot}; diff --git a/src-tauri/src/browser_interceptor/platform/linux.rs b/src-tauri/src/browser_interceptor/platform/linux.rs index 02b06648f..9c861bbaf 100644 --- a/src-tauri/src/browser_interceptor/platform/linux.rs +++ b/src-tauri/src/browser_interceptor/platform/linux.rs @@ -1,4 +1,4 @@ -use crate::browser_interceptor::{BrowserInterceptorError, InterceptedUrl, Result}; +use crate::browser_interceptor::{InterceptedUrl, Result}; /// Linux 平台的浏览器拦截器 pub struct LinuxInterceptor { @@ -60,7 +60,7 @@ impl LinuxInterceptor { impl Drop for LinuxInterceptor { fn drop(&mut self) { if self.running { - tokio::runtime::Handle::try_current().map(|handle| { + let _ = tokio::runtime::Handle::try_current().map(|handle| { handle.block_on(async { let _ = self.stop().await; let _ = self.restore_system_defaults().await; diff --git a/src-tauri/src/commands/config_cmd.rs b/src-tauri/src/commands/config_cmd.rs index 03f72876c..8d1fec61b 100644 --- a/src-tauri/src/commands/config_cmd.rs +++ b/src-tauri/src/commands/config_cmd.rs @@ -209,6 +209,7 @@ pub async fn set_auto_launch(app: AppHandle, enabled: bool) -> Result Result Option { /// /// 返回所有非回环的 IPv4 地址,过滤掉 VPN 和虚拟网卡 fn get_all_local_ips() -> Vec { - use std::net::Ipv4Addr; - let mut ips = Vec::new(); // 使用 if-addrs crate 获取所有网络接口 diff --git a/src-tauri/src/commands/oauth_plugin_cmd.rs b/src-tauri/src/commands/oauth_plugin_cmd.rs index 5b6ed7ffc..904b90de5 100644 --- a/src-tauri/src/commands/oauth_plugin_cmd.rs +++ b/src-tauri/src/commands/oauth_plugin_cmd.rs @@ -66,6 +66,7 @@ pub struct AuthTypeInfoResponse { /// 模型家族信息 #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] +#[allow(dead_code)] pub struct ModelFamilyResponse { pub name: String, pub pattern: String, diff --git a/src-tauri/src/commands/provider_pool_cmd.rs b/src-tauri/src/commands/provider_pool_cmd.rs index ab5dd7d1d..5c0ca736a 100644 --- a/src-tauri/src/commands/provider_pool_cmd.rs +++ b/src-tauri/src/commands/provider_pool_cmd.rs @@ -2934,7 +2934,7 @@ pub struct PlaywrightStatus { /// 获取系统 Chrome 可执行文件路径 fn get_system_chrome_path() -> Option { - let home = dirs::home_dir().unwrap_or_else(|| PathBuf::from(".")); + let _home = dirs::home_dir().unwrap_or_else(|| PathBuf::from(".")); #[cfg(target_os = "macos")] { diff --git a/src-tauri/src/commands/skill_cmd.rs b/src-tauri/src/commands/skill_cmd.rs index 5d08323c9..2f251e5cd 100644 --- a/src-tauri/src/commands/skill_cmd.rs +++ b/src-tauri/src/commands/skill_cmd.rs @@ -274,12 +274,12 @@ mod tests { } } - /// **Feature: skills-platform-mvp, Property 2: Installed Skills Discovery** - /// **Validates: Requirements 2.1, 2.2, 2.3** - /// - /// *For any* valid ~/.proxycast/skills/ directory containing subdirectories - /// with SKILL.md files, calling `scan_installed_skills()` SHALL return a list - /// containing exactly those subdirectory names. + // **Feature: skills-platform-mvp, Property 2: Installed Skills Discovery** + // **Validates: Requirements 2.1, 2.2, 2.3** + // + // *For any* valid ~/.proxycast/skills/ directory containing subdirectories + // with SKILL.md files, calling `scan_installed_skills()` SHALL return a list + // containing exactly those subdirectory names. proptest! { #![proptest_config(ProptestConfig::with_cases(100))] diff --git a/src-tauri/src/config/observer/traits.rs b/src-tauri/src/config/observer/traits.rs index e3dd20bbe..40ee3d486 100644 --- a/src-tauri/src/config/observer/traits.rs +++ b/src-tauri/src/config/observer/traits.rs @@ -46,6 +46,7 @@ pub trait ConfigObserver: Send + Sync { } /// 同步配置观察者 Trait(用于不需要异步的简单观察者) +#[allow(dead_code)] pub trait SyncConfigObserver: Send + Sync { /// 观察者名称 fn name(&self) -> &str; @@ -69,6 +70,7 @@ pub trait SyncConfigObserver: Send + Sync { } /// 将同步观察者包装为异步观察者 +#[allow(dead_code)] pub struct SyncObserverWrapper(pub Arc); #[async_trait] diff --git a/src-tauri/src/credential/tests.rs b/src-tauri/src/credential/tests.rs index a6982527a..05a6af675 100644 --- a/src-tauri/src/credential/tests.rs +++ b/src-tauri/src/credential/tests.rs @@ -2,6 +2,8 @@ //! //! 使用 proptest 进行属性测试 +#![allow(dead_code)] + use crate::credential::{ BalanceStrategy, Credential, CredentialData, CredentialPool, LoadBalancer, }; @@ -1861,7 +1863,7 @@ proptest! { active_count in 1usize..=5usize ) { // 创建两个管理器:一个立即过期,一个长时间冷却 - let expired_config = QuotaExceededConfig { + let _expired_config = QuotaExceededConfig { switch_project: true, switch_preview_model: true, cooldown_seconds: 0, // 立即过期 diff --git a/src-tauri/src/flow_monitor/code_exporter.rs b/src-tauri/src/flow_monitor/code_exporter.rs index 8409fdfaa..0dbd31001 100644 --- a/src-tauri/src/flow_monitor/code_exporter.rs +++ b/src-tauri/src/flow_monitor/code_exporter.rs @@ -609,8 +609,8 @@ mod tests { mod property_tests { use super::*; use crate::flow_monitor::{ - FlowAnnotations, FlowMetadata, FlowState, FlowTimestamps, FlowType, Message, - MessageContent, MessageRole, RequestParameters, RoutingInfo, + FlowAnnotations, FlowMetadata, FlowState, FlowTimestamps, FlowType, RequestParameters, + RoutingInfo, }; use crate::ProviderType; use chrono::Utc; diff --git a/src-tauri/src/flow_monitor/diff.rs b/src-tauri/src/flow_monitor/diff.rs index 53ba7e960..9af4b70c7 100644 --- a/src-tauri/src/flow_monitor/diff.rs +++ b/src-tauri/src/flow_monitor/diff.rs @@ -1141,8 +1141,8 @@ mod tests { mod property_tests { use super::*; use crate::flow_monitor::models::{ - FlowAnnotations, FlowMetadata, FlowState, FlowTimestamps, FlowType, LLMRequest, - LLMResponse, Message, MessageRole, RequestParameters, TokenUsage, + FlowMetadata, FlowType, LLMRequest, LLMResponse, Message, MessageRole, RequestParameters, + TokenUsage, }; use crate::ProviderType; use chrono::Utc; diff --git a/src-tauri/src/flow_monitor/filter_parser.rs b/src-tauri/src/flow_monitor/filter_parser.rs index 7100f7782..12efecddf 100644 --- a/src-tauri/src/flow_monitor/filter_parser.rs +++ b/src-tauri/src/flow_monitor/filter_parser.rs @@ -915,8 +915,7 @@ pub fn get_filter_help() -> String { mod tests { use super::*; use crate::flow_monitor::models::{ - FlowAnnotations, FlowMetadata, FlowTimestamps, FlowType, LLMRequest, LLMResponse, - RequestParameters, TokenUsage, + FlowMetadata, FlowType, LLMRequest, LLMResponse, RequestParameters, TokenUsage, }; use crate::ProviderType; @@ -1261,8 +1260,7 @@ mod tests { mod property_tests { use super::*; use crate::flow_monitor::models::{ - FlowAnnotations, FlowError, FlowErrorType, FlowMetadata, FlowTimestamps, FlowType, - FunctionCall, LLMRequest, LLMResponse, Message, MessageContent, MessageRole, + FlowError, FlowErrorType, FlowMetadata, FlowType, FunctionCall, LLMRequest, LLMResponse, RequestParameters, ThinkingContent, TokenUsage, ToolCall, }; use crate::ProviderType; diff --git a/src-tauri/src/flow_monitor/interceptor.rs b/src-tauri/src/flow_monitor/interceptor.rs index 51c7f1655..29b013fa6 100644 --- a/src-tauri/src/flow_monitor/interceptor.rs +++ b/src-tauri/src/flow_monitor/interceptor.rs @@ -1009,10 +1009,10 @@ mod tests { #[cfg(test)] mod property_tests { + #![allow(dead_code)] use super::*; use crate::flow_monitor::models::{ - FlowAnnotations, FlowError, FlowErrorType, FlowMetadata, FlowTimestamps, FlowType, - FunctionCall, LLMRequest, LLMResponse, Message, MessageContent, MessageRole, + FlowError, FlowErrorType, FlowMetadata, FlowType, FunctionCall, LLMRequest, LLMResponse, RequestParameters, ThinkingContent, TokenUsage, ToolCall, }; use crate::ProviderType; diff --git a/src-tauri/src/flow_monitor/memory_store.rs b/src-tauri/src/flow_monitor/memory_store.rs index 93d98c9b3..c5fb2d790 100644 --- a/src-tauri/src/flow_monitor/memory_store.rs +++ b/src-tauri/src/flow_monitor/memory_store.rs @@ -571,9 +571,7 @@ impl FlowMemoryStore { #[cfg(test)] mod tests { use super::*; - use crate::flow_monitor::models::{ - FlowMetadata, FlowTimestamps, LLMRequest, RequestParameters, - }; + use crate::flow_monitor::models::{FlowMetadata, LLMRequest, RequestParameters}; /// 创建测试用的 Flow fn create_test_flow(id: &str, model: &str, provider: ProviderType) -> LLMFlow { @@ -852,11 +850,9 @@ mod tests { #[cfg(test)] mod property_tests { + #![allow(dead_code)] use super::*; - use crate::flow_monitor::models::{ - FlowAnnotations, FlowError, FlowErrorType, FlowMetadata, FlowTimestamps, LLMRequest, - LLMResponse, RequestParameters, ThinkingContent, TokenUsage, - }; + use crate::flow_monitor::models::{FlowMetadata, LLMRequest, RequestParameters}; use proptest::prelude::*; // ======================================================================== diff --git a/src-tauri/src/flow_monitor/query_service.rs b/src-tauri/src/flow_monitor/query_service.rs index caa18e9b6..6ac5ac0e5 100644 --- a/src-tauri/src/flow_monitor/query_service.rs +++ b/src-tauri/src/flow_monitor/query_service.rs @@ -1019,6 +1019,7 @@ mod tests { #[cfg(test)] mod property_tests { + #![allow(dead_code)] use super::*; use crate::flow_monitor::models::{ FlowMetadata, FlowType, LLMRequest, LLMResponse, RequestParameters, TokenUsage, diff --git a/src-tauri/src/middleware/tests.rs b/src-tauri/src/middleware/tests.rs index 0e917026e..9920c60cc 100644 --- a/src-tauri/src/middleware/tests.rs +++ b/src-tauri/src/middleware/tests.rs @@ -2,10 +2,11 @@ //! //! 使用 proptest 进行属性测试 +#![allow(dead_code)] + use crate::config::RemoteManagementConfig; use crate::middleware::management_auth::{ clear_auth_failure_state, clear_auth_failure_state_for, ManagementAuthLayer, - ManagementAuthService, }; use axum::{ body::Body, diff --git a/src-tauri/src/models/anthropic.rs b/src-tauri/src/models/anthropic.rs index 8990fb569..87926833f 100644 --- a/src-tauri/src/models/anthropic.rs +++ b/src-tauri/src/models/anthropic.rs @@ -76,6 +76,7 @@ pub struct AnthropicUsage { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[allow(dead_code)] pub struct AnthropicMessagesResponse { pub id: String, #[serde(rename = "type")] diff --git a/src-tauri/src/models/machine_id.rs b/src-tauri/src/models/machine_id.rs index 04e9d41d8..0bc295d26 100644 --- a/src-tauri/src/models/machine_id.rs +++ b/src-tauri/src/models/machine_id.rs @@ -93,6 +93,7 @@ pub struct MachineIdHistory { /// 机器码操作类型 #[derive(Debug, Clone, Serialize, Deserialize)] +#[allow(dead_code)] pub enum MachineIdOperation { /// 获取当前机器码 Get, diff --git a/src-tauri/src/models/model_registry.rs b/src-tauri/src/models/model_registry.rs index ad5afa7f3..7ad37f36b 100644 --- a/src-tauri/src/models/model_registry.rs +++ b/src-tauri/src/models/model_registry.rs @@ -443,6 +443,7 @@ impl ProviderAliasConfig { /// models.dev API 响应中的 Provider 结构 #[derive(Debug, Clone, Serialize, Deserialize)] +#[allow(dead_code)] pub struct ModelsDevProvider { pub id: String, pub name: String, diff --git a/src-tauri/src/models/skill_model.rs b/src-tauri/src/models/skill_model.rs index 75e558866..09c69d9eb 100644 --- a/src-tauri/src/models/skill_model.rs +++ b/src-tauri/src/models/skill_model.rs @@ -130,11 +130,11 @@ mod tests { assert!(first_repo.enabled, "ProxyCast 官方仓库应默认启用"); } - /// Property 1: Default Repositories Include ProxyCast Official (Property-Based Test) - /// For any call to get_default_skill_repos(), the returned list SHALL contain - /// a SkillRepo with owner="proxycast", name="skills", branch="main", and enabled=true, - /// and this repo SHALL be the first item in the list. - /// Validates: Requirements 1.1, 1.2, 1.3 + // Property 1: Default Repositories Include ProxyCast Official (Property-Based Test) + // For any call to get_default_skill_repos(), the returned list SHALL contain + // a SkillRepo with owner="proxycast", name="skills", branch="main", and enabled=true, + // and this repo SHALL be the first item in the list. + // Validates: Requirements 1.1, 1.2, 1.3 proptest! { #[test] fn prop_default_repos_proxycast_first(_seed in 0u64..1000) { diff --git a/src-tauri/src/plugin/installer/downloader.rs b/src-tauri/src/plugin/installer/downloader.rs index 5206038c2..8525a49c3 100644 --- a/src-tauri/src/plugin/installer/downloader.rs +++ b/src-tauri/src/plugin/installer/downloader.rs @@ -312,6 +312,7 @@ mod tests { /// **验证需求: 2.4, 3.1, 3.2** #[cfg(test)] mod property_tests { + #![allow(dead_code)] use super::*; use crate::plugin::installer::InstallStage; use proptest::prelude::*; @@ -375,7 +376,7 @@ mod property_tests { "[a-z][a-z0-9_-]{0,99}", // repo "v[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}", // tag ) - .prop_map(|(owner, repo, tag)| { + .prop_map(|(owner, repo, _tag)| { format!("{}/@{}", owner, repo) .replace("/@", &format!("/{}@", repo.chars().next().unwrap_or('r'))) }) diff --git a/src-tauri/src/plugin/tests.rs b/src-tauri/src/plugin/tests.rs index 6d584aecc..2fac07b2a 100644 --- a/src-tauri/src/plugin/tests.rs +++ b/src-tauri/src/plugin/tests.rs @@ -181,7 +181,7 @@ use proptest::prelude::*; mod property_tests { use super::*; use crate::plugin::manager::{PluginManager, PluginManagerConfig}; - use std::path::PathBuf; + use tempfile::TempDir; /// 生成随机的请求 JSON diff --git a/src-tauri/src/providers/tests.rs b/src-tauri/src/providers/tests.rs index 0bce416e8..a1f9e8167 100644 --- a/src-tauri/src/providers/tests.rs +++ b/src-tauri/src/providers/tests.rs @@ -5,8 +5,8 @@ use chrono::{Duration, Utc}; use proptest::prelude::*; -use crate::providers::codex::{CodexCredentials, CodexProvider}; -use crate::providers::iflow::{IFlowCredentials, IFlowProvider}; +use crate::providers::codex::CodexProvider; +use crate::providers::iflow::IFlowProvider; use crate::providers::vertex::VertexProvider; /// Generate a random lead time in minutes (1 to 30 minutes) @@ -22,6 +22,7 @@ fn arb_time_offset_secs() -> impl Strategy { /// 生成不会与 lead_time 边界冲突的时间偏移 /// 避免 time_offset_secs 恰好等于 lead_time_mins * 60 的情况 +#[allow(dead_code)] fn arb_time_offset_avoiding_boundary(lead_time_mins: i64) -> impl Strategy { let boundary = lead_time_mins * 60; // 生成不等于边界值的时间偏移 @@ -477,6 +478,7 @@ fn arb_model_name() -> impl Strategy { } /// Generate a random exclusion pattern +#[allow(dead_code)] fn arb_exclusion_pattern() -> impl Strategy { prop_oneof![ // Exact model names @@ -491,6 +493,7 @@ fn arb_exclusion_pattern() -> impl Strategy { } /// Generate a list of exclusion patterns +#[allow(dead_code)] fn arb_exclusion_patterns() -> impl Strategy> { proptest::collection::vec(arb_exclusion_pattern(), 0..5) } diff --git a/src-tauri/src/proxy/tests.rs b/src-tauri/src/proxy/tests.rs index 4533d6619..8e0e7334f 100644 --- a/src-tauri/src/proxy/tests.rs +++ b/src-tauri/src/proxy/tests.rs @@ -2,6 +2,8 @@ //! //! 使用 proptest 进行属性测试 +#![allow(dead_code)] + use crate::proxy::{ProxyClientFactory, ProxyError, ProxyProtocol}; use proptest::prelude::*; diff --git a/src-tauri/src/screenshot/capture.rs b/src-tauri/src/screenshot/capture.rs index c3c795394..298de470b 100644 --- a/src-tauri/src/screenshot/capture.rs +++ b/src-tauri/src/screenshot/capture.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use tauri::AppHandle; -use tracing::{debug, error, info, warn}; +use tracing::{debug, error, info}; /// 截图错误类型 #[derive(Debug, thiserror::Error)] @@ -229,7 +229,6 @@ pub fn cleanup_temp_file(path: &PathBuf) { #[cfg(test)] mod tests { - use super::*; #[test] fn test_temp_path_generation() { diff --git a/src-tauri/src/screenshot/window.rs b/src-tauri/src/screenshot/window.rs index da2f69051..2b7b573ff 100644 --- a/src-tauri/src/screenshot/window.rs +++ b/src-tauri/src/screenshot/window.rs @@ -5,7 +5,7 @@ use mouse_position::mouse_position::Mouse; use std::path::Path; use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindowBuilder}; -use tracing::{debug, info, warn}; +use tracing::{debug, info}; #[cfg(target_os = "macos")] use cocoa::appkit::{NSColor, NSWindow}; @@ -202,17 +202,18 @@ pub fn open_floating_window(app: &AppHandle, image_path: &Path) -> Result<(), Wi let (x, y) = calculate_window_position(app); // 创建悬浮窗口(启用透明) - let window = WebviewWindowBuilder::new(app, FLOATING_WINDOW_LABEL, WebviewUrl::App(url.into())) - .inner_size(WINDOW_WIDTH, WINDOW_HEIGHT) - .position(x, y) - .decorations(false) - .always_on_top(true) - .skip_taskbar(true) - .visible(true) - .focused(true) - .transparent(true) - .build() - .map_err(|e| WindowError::CreateFailed(format!("{}", e)))?; + let _window = + WebviewWindowBuilder::new(app, FLOATING_WINDOW_LABEL, WebviewUrl::App(url.into())) + .inner_size(WINDOW_WIDTH, WINDOW_HEIGHT) + .position(x, y) + .decorations(false) + .always_on_top(true) + .skip_taskbar(true) + .visible(true) + .focused(true) + .transparent(true) + .build() + .map_err(|e| WindowError::CreateFailed(format!("{}", e)))?; // macOS: 设置窗口和 webview 背景透明 #[cfg(target_os = "macos")] diff --git a/src-tauri/src/server_utils.rs b/src-tauri/src/server_utils.rs index 144348aa5..05c4bf362 100644 --- a/src-tauri/src/server_utils.rs +++ b/src-tauri/src/server_utils.rs @@ -785,7 +785,7 @@ mod property_tests { let response = build_anthropic_response(&model, &parsed); // 获取响应体 - let (parts, body) = response.into_parts(); + let (parts, _body) = response.into_parts(); // 验证状态码为 200 prop_assert_eq!(parts.status, StatusCode::OK); @@ -1073,6 +1073,7 @@ mod property_tests { // ======================================================================== /// 获取模型名称映射的预期结果 + #[allow(dead_code)] fn get_expected_model_mapping(model: &str) -> &str { match model { "gemini-2.5-computer-use-preview-10-2025" => "rev19-uic3-1p", diff --git a/src-tauri/src/services/kiro_event_service.rs b/src-tauri/src/services/kiro_event_service.rs index 58ebd5236..49323af20 100644 --- a/src-tauri/src/services/kiro_event_service.rs +++ b/src-tauri/src/services/kiro_event_service.rs @@ -273,7 +273,6 @@ impl Default for KiroEventService { #[cfg(test)] mod tests { use super::*; - use tokio::time::{sleep, Duration}; #[tokio::test] async fn test_credential_status_update_event() { diff --git a/src-tauri/src/services/live_sync_tests.rs b/src-tauri/src/services/live_sync_tests.rs index e35f0ad96..0e652aca3 100644 --- a/src-tauri/src/services/live_sync_tests.rs +++ b/src-tauri/src/services/live_sync_tests.rs @@ -8,6 +8,7 @@ #[cfg(test)] mod tests { + #![allow(dead_code)] use super::super::*; use serde_json::json; use std::fs; @@ -288,7 +289,6 @@ mod tests { #[cfg(test)] mod shell_config_write_tests { - use super::*; /// **Feature: shell-write, Property 1: 特殊字符转义** #[test] @@ -307,7 +307,7 @@ mod tests { // 这个测试验证特殊字符转义逻辑 // 实际的 write_env_to_shell_config 会写入真实的 shell 配置文件 // 在单元测试中,我们只验证转义逻辑是正确的 - for (key, value) in &env_vars { + for (_key, value) in &env_vars { // 验证值包含特殊字符 assert!( value.contains('"') || value.contains('\\'), diff --git a/src-tauri/src/services/update_check_service.rs b/src-tauri/src/services/update_check_service.rs index ac06cdc36..4a69dd0be 100644 --- a/src-tauri/src/services/update_check_service.rs +++ b/src-tauri/src/services/update_check_service.rs @@ -256,28 +256,33 @@ impl Default for UpdateCheckService { /// 发送系统通知(跨平台) /// /// 使用 Tauri 的通知 API 发送原生系统通知 -#[cfg(feature = "notification")] -pub async fn send_update_notification( - app_handle: &tauri::AppHandle, - update_info: &UpdateInfo, -) -> Result<(), String> { - use tauri::api::notification::Notification; - - if !update_info.has_update { - return Ok(()); - } - - let latest = update_info.latest_version.as_deref().unwrap_or("未知版本"); - - Notification::new(&app_handle.config().tauri.bundle.identifier) - .title("ProxyCast 有新版本可用") - .body(&format!( - "新版本 {} 已发布,当前版本 {}", - latest, update_info.current_version - )) - .show() - .map_err(|e| format!("发送通知失败: {}", e)) -} +/// +/// TODO: 此功能暂时禁用,需要迁移到 Tauri v2 的通知插件 API +/// 参考:https://v2.tauri.app/plugin/notification/ +// #[cfg(feature = "notification")] +// pub async fn send_update_notification( +// app_handle: &tauri::AppHandle, +// update_info: &UpdateInfo, +// ) -> Result<(), String> { +// use tauri_plugin_notification::NotificationExt; +// +// if !update_info.has_update { +// return Ok(()); +// } +// +// let latest = update_info.latest_version.as_deref().unwrap_or("未知版本"); +// +// app_handle +// .notification() +// .builder() +// .title("ProxyCast 有新版本可用") +// .body(&format!( +// "新版本 {} 已发布,当前版本 {}", +// latest, update_info.current_version +// )) +// .show() +// .map_err(|e| format!("发送通知失败: {}", e)) +// } /// 更新检查服务状态包装器(用于 Tauri 状态管理) pub struct UpdateCheckServiceState(pub Arc>); diff --git a/src-tauri/src/services/update_window.rs b/src-tauri/src/services/update_window.rs index 8de30f5c3..c931acdf7 100644 --- a/src-tauri/src/services/update_window.rs +++ b/src-tauri/src/services/update_window.rs @@ -164,7 +164,7 @@ pub fn open_update_window( let (x, y) = calculate_window_position(app); - let window = WebviewWindowBuilder::new(app, UPDATE_WINDOW_LABEL, WebviewUrl::App(url.into())) + let _window = WebviewWindowBuilder::new(app, UPDATE_WINDOW_LABEL, WebviewUrl::App(url.into())) .inner_size(WINDOW_WIDTH, WINDOW_HEIGHT) .position(x, y) .decorations(false) diff --git a/src-tauri/src/streaming/aws_parser.rs b/src-tauri/src/streaming/aws_parser.rs index 0858c80de..30fc9a8c7 100644 --- a/src-tauri/src/streaming/aws_parser.rs +++ b/src-tauri/src/streaming/aws_parser.rs @@ -1311,6 +1311,7 @@ mod error_recovery_tests { #[cfg(test)] mod property_tests { + #![allow(dead_code)] use super::*; use proptest::prelude::*; diff --git a/src-tauri/src/streaming/converter.rs b/src-tauri/src/streaming/converter.rs index de77c0fbf..1796183e9 100644 --- a/src-tauri/src/streaming/converter.rs +++ b/src-tauri/src/streaming/converter.rs @@ -1193,9 +1193,7 @@ mod tests { #[cfg(test)] mod property_tests { use super::*; - use crate::streaming::aws_parser::{ - extract_content, extract_tool_calls, serialize_event, AwsEvent, - }; + use crate::streaming::aws_parser::{extract_content, serialize_event, AwsEvent}; use proptest::prelude::*; // ======================================================================== diff --git a/src-tauri/src/translator/kiro/openai/response.rs b/src-tauri/src/translator/kiro/openai/response.rs index 66539d6d9..a04def48d 100644 --- a/src-tauri/src/translator/kiro/openai/response.rs +++ b/src-tauri/src/translator/kiro/openai/response.rs @@ -74,7 +74,7 @@ impl SseResponseTranslator for OpenAiResponseTranslator { #[cfg(test)] mod tests { use super::*; - use crate::stream::{ContentBlockType, StopReason}; + use crate::stream::StopReason; #[test] fn test_translate_text_delta() { diff --git a/src-tauri/src/websocket/tests.rs b/src-tauri/src/websocket/tests.rs index 7916d533b..8f6284312 100644 --- a/src-tauri/src/websocket/tests.rs +++ b/src-tauri/src/websocket/tests.rs @@ -1,5 +1,7 @@ //! WebSocket 模块测试 +#![allow(dead_code)] + use super::*; #[test] diff --git a/src-tauri/tests/api_key_provider_tests.rs b/src-tauri/tests/api_key_provider_tests.rs index dda2ca3dc..d54cc8e4d 100644 --- a/src-tauri/tests/api_key_provider_tests.rs +++ b/src-tauri/tests/api_key_provider_tests.rs @@ -12,11 +12,12 @@ use tempfile::TempDir; use proxycast_lib::database::dao::api_key_provider::{ ApiKeyEntry, ApiKeyProvider, ApiKeyProviderDao, ApiProviderType, ProviderGroup, }; -use proxycast_lib::database::{init_database, DbConnection}; +use proxycast_lib::database::DbConnection; use proxycast_lib::services::api_key_provider_service::ApiKeyProviderService; use rusqlite::Connection; /// 测试上下文 +#[allow(dead_code)] struct TestContext { pub temp_dir: TempDir, pub db: DbConnection, diff --git a/src-tauri/tests/end_to_end_tests.rs b/src-tauri/tests/end_to_end_tests.rs index 6438fef36..b9ff48bca 100644 --- a/src-tauri/tests/end_to_end_tests.rs +++ b/src-tauri/tests/end_to_end_tests.rs @@ -21,6 +21,7 @@ use proxycast_lib::flow_monitor::{ use std::collections::HashMap; /// 端到端测试上下文 +#[allow(dead_code)] struct E2ETestContext { pub temp_dir: TempDir, pub flow_monitor: Arc,