chore: codebase cleanup + behavior-preserving refactor (Aura removal, dead-code, RELEASING.md, issue fixes)#693
Merged
Merged
Conversation
集中式 reject_hotkey_collisions 已校验 coding_agent_voice_hotkey,但 set_dictation/translation/switch_style/open_app_hotkey(hotkeys.rs)与 set_qa_hotkey(qa.rs)这 5 个单键 setter 全部漏掉 less_computer 校验—— 用户可经单键面板把任一动作键设成与 Less Computer 键相同而不被拒,随后 完整保存又被 reject_hotkey_collisions 拒绝,两条路径不一致。 把早已存在但未接线的 reject_*_less_computer_hotkey_overlap 接进这 5 个 setter(与现有 pairwise 校验同模式);reject_qa_less_computer_hotkey_overlap 提升为 pub(crate) 供 qa.rs 调用。附 reject_hotkey_collisions 碰撞矩阵单测。
组合听写键 setter 同样把组合键写进 dictation_hotkey 却漏校验 less_computer, 补上 reject_dictation_less_computer_hotkey_overlap,与其余 5 个 setter 一致。
) #470 曾用 fab9651(+4824080) 给 Windows 录音胶囊加了「四边 clamp + 工作区(rcWork, 避开任务栏)定位」,但 Android 移植 commit 1ea467a 把它回退成只夹上边: ForegroundMonitor 丢了 work_* 字段(不再读 rcWork),position_capsule_bottom_center 退回 y.max(mon.top) + set_position(x, clamped_y)(x/下/右都不夹、不避任务栏), clamp_to_monitor 沦为只被 test import 引用的死码,专用单测被删。 多显示器 / 负坐标 / 异常 DPI 下胶囊因此可能定位到屏幕外或压在任务栏上——正是 #470 想排查的「胶囊定位到屏幕外」子嫌疑。 按 fab9651 原样恢复(单一职责,纯 Windows 作用域,不影响 Android 的 overlay 路径): - ForegroundMonitor 重新加回 work_left/top/right/bottom,foreground_window_monitor 从 mi.rcWork 填充; - position_capsule_bottom_center 改回用 clamp_to_monitor 四边夹工作区(取不到 rcWork 退回整屏); - 恢复 clamp_to_monitor 的 5 个纯函数单测(on-screen 不动 / 右下溢出收回 / 负原点 / 避让任务栏工作区 / 病态窄屏不 panic)。 验证:cargo test --lib clamp_to_monitor 5 passed(三平台跑纯函数)。Windows 结构 + rcWork 由 Windows CI 编译验证(本机 macOS 无法交叉编译 ring 的 C 依赖)。
run_download 此前仅凭 dest.exists() 判定文件已下完并 continue,不比对 file.size。 上一次下载被中断或文件被外部损坏后仍残留为目标文件时,会被当成完整跳过,模型加载 时才以含糊错误失败,用户难自查。 抽纯函数 existing_file_is_complete(actual, expected):大小一致→完整;不符(截断/超大) →不完整;expected==0(HF 未给大小)→退回旧行为「存在即信任」,避免对未知大小文件反复 重下。run_download 在 dest.exists() 时按它判定:完整才跳过,否则删除残留重下; already_done_bytes 进度基线也用同一判定,保持一致。 验证:existing_file_is_complete 真值表单测 4 passed(一致/截断/超大/未知大小), cargo test --lib 全绿。
send_with_transient_retry 的文档明确「is_timeout() 故意不重试——超时时服务端可能已在 处理并扣费」,但重试臂 guard 是 e.is_connect() || e.is_request()。reqwest 把「请求体 写出阶段超时」归类为 is_request()(有时同时 is_timeout()),这类错误会先命中重试臂、 到不了 timeout 分支,于是重发已发出的非幂等 chat/completions → 重复 completion + 重复插入文本 + 供应商双重计费,与文档意图及 net.rs 的 send_with_retry(仅 is_connect) 矛盾。 抽纯函数 should_retry_transient(is_connect, is_request, is_timeout) = (connect||request) && !timeout,重试 guard 改用它,使超时类错误一律不重试。纯函数便于单测(reqwest::Error 无法在测试里构造任意 flag 组合)。 验证:retries_connect_or_request_only_when_not_timeout 单测覆盖 6 组组合 passed, cargo test --lib 全绿。
两处独立改动,同属 coordinator/dictation 听写收尾路径: #691(remote):remote_server 的 WS handler 订阅了 "remote:result"(mod.rs:614)并把 最终文字转发给手机,H5 也准备好显示,但全仓从未 emit 过这个事件,导致手机端结果区永远空。 在听写 finalize(history.append_with_retention 之后)按已有 vocab:updated 同模式 emit polished 到 "remote:result";非空才发,无手机连接时无人转发 = 无害空操作。 #678(perf, P1):对话上下文感知润色把「最近 N 分钟内的全部历史轮」前置进 LLM,时间窗口 只限「多久内」不限「多少条」,eligible_polish_context_turns 末尾直接 .collect() 无上限。 5 分钟内堆积几十条历史时输入 token 暴涨、首字延迟(TTFT)显著变长,影响全体用户。 给该函数加 MAX_POLISH_CONTEXT_TURNS=2 上限(sessions newest-first,.take 取最近 2 轮, build_polish_history_messages 仍 .rev() 成时间正序),保留代词/续写所需的连续性,把上下文 token 控制在常数量级。 验证:polish_context_caps_at_max_turns_keeping_most_recent 单测 passed,cargo test --lib 全绿;#691 需手机真机验证结果区出现最终文字。
历史页顶部搜索区此前是静态 div(只显示「共 N 条 · 显示 M」统计),无法点击聚焦、无法输入, 外观像搜索框却不可交互。设计稿与全部 5 个 locale 早已备好 history.searchPlaceholder / searchNoMatch(含 ⌘K 提示)翻译,只是从未接线。 仿 Marketplace 搜索框: - 静态 span 改为 <input type="search">,query 状态 + 300ms 防抖(debouncedQuery); - filtered 在 mode 过滤基础上叠加按 rawTranscript / finalText 不区分大小写匹配; - 清空搜索词恢复显示全部(当前 mode 下); - ⌘K / Ctrl+K 聚焦搜索框(设计稿提示); - 搜索无结果时显示 searchNoMatch 而非误导性的「无历史」空态。 复用既有 i18n key,无新增翻译。验证:tsc --noEmit 通过,npm run build 通过, 三个 contract 脚本(aura-skin / macos-capsule-spaces / hotkey-injection)全绿。
…earance unchanged Aura skin 整体弃用。删除脚手架与去掉 --ol-aura-* 设计令牌层,渲染外观(明/暗)保持完全一致—— 纯重命名/清理,无视觉变化。 删除: - docs/superpowers/plans/2026-06-05-openless-aura-skin.md - docs/superpowers/specs/2026-06-05-openless-aura-skin-design.md - scripts/aura-skin-contract.test.mjs 及 package.json 的 check:aura-skin 脚本 令牌层(视觉中性): - 把 --ol-panel-bg/border/shadow、--ol-card-shadow 这几个 light 别名里对 --ol-aura-* 的 引用就地内联为其解析后的字面值(dark 别名本就不引用 aura,原样不动); - --ol-aura-surface(FloatingShell 主区玻璃背景,需主题感知)重命名为 --ol-panel-glass-bg, 明/暗取值原样保留; - 删除其余未被消费的 --ol-aura-* 定义(surface-2/solid、line*、glass-blur 等)。 类名层(视觉中性重命名): - .ol-aura-panel→.ol-panel-surface、.ol-aura-card→.ol-card-surface、 .ol-aura-settings→.ol-settings-surface,及 FloatingShell 的 ol-aura-sidebar→ol-sidebar-surface (该类无 CSS 规则,纯 no-op className)。 验证:grep -ri aura src 无输出;check:aura-skin 脚本已不存在;npx tsc --noEmit 通过; npm run build 通过;check:macos-capsule-spaces / check:hotkey-injection 仍全绿。明/暗两套 别名解析值与改前逐一比对一致。
…rs — never wired to any hotkey/dispatch; cargo check still green (98→97 warnings)
…still green (97→90 warnings) - polish.rs: drop unused config() getters on OpenAICompatibleLLMProvider/CodexOAuthLLMProvider - volcengine.rs: drop unused is_connected() getter + unconstructed AuthenticationFailed variant (superseded by AuthRejected) - types.rs: drop unused StyleSystemPrompts::is_default_for_mode - permissions.rs: drop unused legacy request_accessibility_with_prompt shim - persistence.rs: drop unused HistoryStore::append wrapper (callers use append_with_retention) All confirmed no callers across cfg/test/frontend; no serde/FFI/JNI/command exposure.
…rt() signature-alignment params — cargo check still green (90→87 warnings)
…it still green, no rendered output changed - Capsule.tsx: drop unused useRef import - themeMode.ts: drop unused detectOS import - Marketplace.tsx: drop never-attached useAutoAnimate listRef (no-op) + unused dismissActionMsg callback + orphaned import - Style.tsx: drop unused derived locals activePack/builtinCount/importedCount/enabledCount
…ordinator/hotkey_loops.rs — behavior unchanged, 446 tests green Pure move of 39 free functions (hotkey supervisor loops, bridge loops, shortcut wiring, window-hotkey fallback) from coordinator.rs into a new sibling submodule. Functions made pub(super) and reached from the parent via 'use hotkey_loops::*;' (same convention as dictation/qa/resources). No logic, signature, or public-API changes; coordinator.rs 6961→5807 lines. cargo check: 0 errors, 87 warnings (unchanged) cargo clippy --no-deps: 0 errors cargo test --lib: 446 passed tsc --noEmit / npm run build: green
…_wiring.rs — behavior unchanged, 446 tests green Pure move of 23 free functions + 2 enums (QaAsrStart, AsrReleaseSession) covering credential/permission gates, local-ASR release scheduling, provider helpers, and build_qa_asr_start, from coordinator.rs into a new sibling submodule. Functions and QaAsrStart impl methods made pub(super); reached from the parent via 'use asr_wiring::*;'. No logic/signature/public-API changes; coordinator.rs 5807→5285 lines. cargo check: 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…ordinator/polish_flow.rs — behavior unchanged, 446 tests green Pure move of the StreamingPolishOutcome enum + polish_or_passthrough_streaming / polish_or_passthrough / polish_text / translate_text / polish_and_translate_or_passthrough and the polish-translate marker consts/helpers, from coordinator.rs into a new sibling submodule. Made pub(super); reached from the parent and from dictation.rs via 'use polish_flow::*;'. No logic/signature/public-API changes; coordinator.rs 5285→4934 lines. cargo check: 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…ordinator/capsule_focus.rs — behavior unchanged, 446 tests green Pure move of 20 free functions (incl. cfg-variant focus/frontmost-app capture, capsule window show/hide/position, emit_capsule) + CapsuleLayoutState, from coordinator.rs into a new sibling submodule. Made pub(super); reached from the parent and sibling submodules via 'use capsule_focus::*;'. DeferredAsrBridge intentionally left in the parent (shared ASR-bridge type, not focus/capsule). No logic/signature/ public-API changes; coordinator.rs 4934→4298 lines. cargo check: 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…coordinator/qa_session.rs — behavior unchanged, 446 tests green Pure move of 12 async/free functions (finalize_dictation_as_qa_question, begin/end/ cancel_qa_session, overlay transcription, answer_chat_dispatch, etc.) from coordinator.rs into a new sibling submodule. Made pub(super); reached from the parent and sibling 'qa' submodule via 'use qa_session::*;'. No logic/signature/public-API changes; coordinator.rs 4298→3081 lines. cargo check: 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…larization — behavior unchanged Prepares for splitting the ~3497-line page into focused files under LocalAsr/. Pure move + relative-import depth fix (../ -> ../../, ./_atoms -> ../_atoms); external import '../LocalAsr' resolves to LocalAsr/index.tsx unchanged. Vite output bundle hashes identical to before. tsc --noEmit / npm run build: green.
… — behavior unchanged Pure move of 8 stateless helpers (isFoundryAlias/isSherpaAlias, language-hint & runtime-source normalizers, isWindowsLikePlatform, formatFoundrySizeMb, formatBytes) out of index.tsx into a dedicated module; imported back unchanged. No rendered-output or behavior change. tsc --noEmit / npm run build: green (bundle sizes identical).
…Asr/components.tsx — behavior unchanged Pure move of 4 props-driven sub-components (FoundryPrepareProgressBlock, DownloadProgressBlock, ModelRow, TestResultBlock) + ModelRowProps into LocalAsr/components.tsx, and the shared RemoteSize type into LocalAsr/types.ts. Imported back into index.tsx unchanged; no rendered-output or behavior change. index.tsx 3497→2921 lines. tsc --noEmit / npm run build: green (bundle sizes identical).
…cleaning.rs — behavior unchanged, 446 tests green Pure move of 9 functions + 2 consts (clean_polish_output, strip_thinking_blocks, <think>/markdown-fence/boilerplate strippers) and their 4 unit tests out of polish.rs into a child module. clean_polish_output stays pub(crate) and is re-exported via 'pub(crate) use output_cleaning::*;'. Dropped the now-unused 'use std::borrow::Cow' in polish.rs (the only Cow user moved with the code). No logic/signature/public-API changes; polish.rs 3663→3436 lines. cargo check: 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…se.rs — behavior unchanged, 446 tests green Pure move of 8 functions (context_premise, compose_polish/translate/qa prompts, assemble_polish_system_prompt, hotword-block builders) out of polish.rs into a child module. References the parent 'prompts' module + PolishSystemPromptAssembly via 'use super::*;'; pub(crate) fns re-exported via 'pub(crate) use prompt_compose::*;'. No logic/signature/public-API changes; polish.rs 3436→3157 lines. cargo check (+--tests): 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
…hotkey.rs — behavior unchanged, 446 tests green Pure move of 15 types (ShortcutBinding, QaHotkeyBinding, ComboBinding, HotkeyTrigger/ Mode/AdapterKind, HotkeyKey/Binding, HotkeyCapability/InstallError/Status, WindowsIme*, PlatformCapabilities, HotkeyStatusState) + their 13 impls + 4 private helper fns out of types.rs into a child module. Re-exported via 'pub use hotkey::*;' so every 'crate::types::Hotkey*' import across the codebase keeps resolving — serde contract and public API byte-identical. types.rs 2900→2300 lines. cargo check (+--tests): 0 errors, 87 warnings (unchanged) · clippy: 0 errors cargo test --lib: 446 passed · tsc / npm run build: green
Documents that only repository admins may create version tags (v*-tauri / v*-beta-tauri) and publish releases; contributors (including AI agents) must request an admin to cut a release, and release automation must be admin-triggered only. Captures the existing beta/main channel model and the five-file version-sync gate.
Contributor
PR Reviewer Guide 🔍(Review updated until commit 0e80a50)Here are some key observations to aid the review process:
|
…/capsule_focus.rs after refactor The 板块化 refactor moved show_capsule_window_no_activate and the capsule show/hide/position helpers out of coordinator.rs into coordinator/capsule_focus.rs (pub(super)). The static contract scripts still grepped coordinator.rs and failed CI (Check macOS capsule Spaces contract). Point them at the new module; windows-ui now searches the coordinator.rs + capsule_focus.rs union. Behavior unchanged.
Contributor
|
Persistent review updated to latest commit 0e80a50 |
…o types/hotkey.rs — behavior unchanged, 446 tests green" This reverts commit c08d83f.
This was referenced Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
Audit-driven cleanup + behavior-preserving refactor of the OpenLess desktop app (
openless-all/app). Public IPC/contract and UI are unchanged; all gates green.Structural refactor (behavior-preserving — the main event)
coordinator.rs6961 → 3083 lines — extracted 5 submodules:coordinator/{hotkey_loops, asr_wiring, polish_flow, capsule_focus, qa_session}.rsLocalAsr.tsx3497 →LocalAsr/folder (index.tsx+components.tsx+helpers.ts+types.ts)polish.rs3663 → 3157 (polish/{output_cleaning, prompt_compose}.rs)types.rs2900 → 2300 (types/hotkey.rs, contract re-exported — serde byte-identical)Cleanup
check:aura-skinscript, dead--ol-aura-*tokens). Appearance unchanged — token values inlined for both light & dark.cfg/platform/test-only kept).Policy
RELEASING.md— only repo admins may create version tags (v*-tauri) / publish releases.Issue fixes
This branch sits on top of the #684 fixes and re-implements fixes for issues that already have open PRs:
Those fix commits appear here because the refactor was layered on top of them. Recommended reconciliation: this PR is effectively a superset (equivalent fixes + cleanup + refactor), so either (a) merge this and close the 6 duplicates, or (b) merge the small PRs first then rebase this branch — the duplicate commits drop out automatically. The implementations differ from the standalone PRs, so it's the reviewer's call.
Verification (final state)
cargo test --lib: 446 passed, 0 failedcargo check: EXIT 0 (87 warnings — all pre-existing cfg/FFI false-positives)cargo clippy --no-deps: 0 errorsnpx tsc --noEmit: EXIT 0npm run build: EXIT 0Not included
The user's in-progress #684 follow-up edits to
hotkeys.rsare intentionally left as local WIP (not committed/pushed).🤖 Generated with Claude Code
PR Type
Enhancement, Bug fix, Documentation, Other
Description
Refactor coordinator.rs into 5 submodules
Extract polish.rs submodules, fix retry logic
Fix bugs: hotkey collision, capsule clamp, remote:result, download, history
Remove dead code, Aura skin; add RELEASING.md
Diagram Walkthrough
File Walkthrough
14 files
Extract 5 submodules + remove dead codeExtract output_cleaning and prompt_compose submodulesNew file for hotkey supervisor loopsNew file for ASR wiring helpersNew file for polish flow and streamingNew file for capsule focus helpersNew file for QA session logicNew file for output cleaning utilitiesNew file for prompt compositionExtract hotkey submodule, re-export contractsNew file for hotkey typesRefactor LocalAsr into folder structureExtract components for LocalAsr pageExtract helpers for LocalAsr page5 files
Fix Less Computer collision check for setter hotkeysFix QA hotkey collision checkAdd file size verification before skip downloadAdd remote:result emit, fix polish context limitFix search box to be editable input1 files
Add release policy document20 files