fix(audit): Batch 2 生产代码 unwrap 替换 (20 处)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
P0 修复:
- viking_commands.rs: URI 路径构建 unwrap → ok_or_else 错误传播
- clip.rs: 临时文件路径 unwrap → ok_or_else (防 Windows 中文路径 panic)
P1 修复:
- personality_detector.rs: Mutex lock unwrap → unwrap_or_else 防中毒传播
- pptx.rs: HashMap.get unwrap → expect (来自 keys() 迭代)
P2 修复:
- 4 处 SystemTime.unwrap → expect("system clock is valid")
- 4 处 dev_server URL.parse.unwrap → expect("hardcoded URL is valid")
- 9 处 nl_schedule Regex.unwrap → expect("static regex is valid")
- 5 处 data_masking Regex.unwrap → expect("static regex is valid")
- 2 处 pipeline/state Regex.unwrap → expect("static regex is valid")
全量测试通过: 719 passed, 0 failed
This commit is contained in:
@@ -339,12 +339,12 @@ fn personality_store() -> &'static Mutex<std::collections::HashMap<String, Perso
|
||||
/// Load personality config for a given agent.
|
||||
/// Returns default config if none is stored.
|
||||
pub fn load_personality_config(agent_id: &str) -> PersonalityConfig {
|
||||
let store = personality_store().lock().unwrap();
|
||||
let store = personality_store().lock().unwrap_or_else(|e| e.into_inner());
|
||||
store.get(agent_id).cloned().unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Save personality config for a given agent.
|
||||
pub fn save_personality_config(agent_id: &str, config: &PersonalityConfig) {
|
||||
let mut store = personality_store().lock().unwrap();
|
||||
let mut store = personality_store().lock().unwrap_or_else(|e| e.into_inner());
|
||||
store.insert(agent_id.to_string(), config.clone());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user