背景
CLAUDE.md 明确写 "Rust side has no `cargo test` targets yet"。commands.rs 有少量 #[cfg(test)] 测试(~100 行),但 coordinator / hotkey / insertion / recorder 等核心模块完全没有测试。
当前风险
coordinator.rs 3,842 行状态机仅靠人工验证
- 一次重构引入逻辑 bug 的概率不低
- 没有单元测试做安全网,未来重构(如 issue 拆 coordinator)门槛高
建议
按优先级补单元测试:
coordinator.rs — begin_session / stop_dictation / cancel_session 状态机表驱动测试
hotkey.rs — modifier 边沿解析(mac CGEventTap / win WH_KEYBOARD_LL adapter 用 mock)
recorder.rs — 重采样 / RMS 计算(cpal stream 用 mock buffer)
insertion.rs — clipboard restore、AX 直写降级路径
来源
工程审计基线 docs/audit-2026-05-06.md §1.2 / §1.4 高风险 #1
背景
CLAUDE.md 明确写 "Rust side has no `cargo test` targets yet"。
commands.rs有少量#[cfg(test)]测试(~100 行),但 coordinator / hotkey / insertion / recorder 等核心模块完全没有测试。当前风险
coordinator.rs3,842 行状态机仅靠人工验证建议
按优先级补单元测试:
coordinator.rs—begin_session/stop_dictation/cancel_session状态机表驱动测试hotkey.rs— modifier 边沿解析(mac CGEventTap / win WH_KEYBOARD_LL adapter 用 mock)recorder.rs— 重采样 / RMS 计算(cpal stream 用 mock buffer)insertion.rs— clipboard restore、AX 直写降级路径来源
工程审计基线
docs/audit-2026-05-06.md§1.2 / §1.4 高风险 #1