修复 Style 总开关关闭后的兜底风格#383
Merged
H-Chris233 merged 2 commits intoMay 9, 2026
Merged
Conversation
Style 页总开关关闭时沿用现有注释语义:保留 raw 和当前 default mode,避免把 enabledModes 持久化为空集合。\n\n将 master toggle 的 off 判定抽到 stylePrefs,确保仅剩 raw/default 时 UI 仍显示为关闭,并用现有手写测试覆盖最终保存值。\n\nConstraint: Issue Open-Less#312 要求总开关实现与注释一致,并覆盖关闭后的 enabledModes。\nRejected: 保持 enabledModes=[] 仅改注释 | 会让切换风格热键面对空集合,偏离 raw/default 兜底语义。\nConfidence: high\nScope-risk: narrow\nTested: cd openless-all/app && npx tsx src/lib/stylePrefs.test.ts\nTested: cd openless-all/app && npm run build\nNot-tested: Real Tauri UI click path on macOS/Windows.\nRelated: https://github.com/appergb/openless/issues/312\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
PR Reviewer Guide 🔍(Review updated until commit 6341f19)Here are some key observations to aid the review process:
|
Review noted that changing defaultMode after turning Style master off made the switch look on again because enabledModes still reflected the old fallback pair.\n\nWhen master is already off, default-mode changes now persist the whole style preference set through setSettings so enabledModes is recomputed to raw plus the new default. Normal enabled master behavior still uses the narrower setDefaultPolishMode IPC.\n\nConstraint: Issue Open-Less#312 selected raw/default fallback semantics for master-off state.\nRejected: Add a separate persisted masterEnabled flag | broader schema and migration change for a narrow UI consistency bug.\nConfidence: high\nScope-risk: narrow\nTested: cd openless-all/app && npx tsx src/lib/stylePrefs.test.ts\nTested: cd openless-all/app && npm run build\nNot-tested: Manual Style page click flow in packaged Tauri app.\nRelated: https://github.com/appergb/openless/pull/383\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit 6341f19 |
appergb
pushed a commit
that referenced
this pull request
May 10, 2026
CI ci.yml "Verify version sync across all 5 files" 步骤要求 5 处版本号一致: package.json / package-lock.json (root + nested) / tauri.conf.json / Cargo.toml / Cargo.lock 的 [openless] 包。上一个 commit (568d30d) 漏改了 package-lock.json 两处 → Linux + macOS CI fail。 修法跟 PR #383 后续 commit 941542c 同形:手动同步两处 'version' 字段到 1.2.24-7。下次正确流程是用 scripts/bump-version.sh 一把过。
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
摘要
raw和当前defaultMode,不再持久化空的enabledModes。stylePrefs,避免 UI 状态和保存值再次分叉。enabledModes。Closes #312
验证
cd openless-all/app && npx tsx src/lib/stylePrefs.test.tscd openless-all/app && npm run build备注
coordinator.rs中enabled_modes目前用于切换风格热键过滤;听写主流程仍读取default_mode。因此本修复避免空集合让风格热键无可选项,同时保持主听写路径行为稳定。PR Type
Bug fix, Tests
Description
Preserve raw/default fallback modes
Keep master-off state stable
Recompute saved modes after default changes
Add regression coverage for toggle and rollback
Diagram Walkthrough
File Walkthrough
stylePrefs.ts
Centralize style master fallback and rollback logicopenless-all/app/src/lib/stylePrefs.ts
styleMasterFallbackModesto deriverawplus the current defaultmode.
isStyleMasterEnabledandstyleMasterOffPreferencestocentralize master-toggle state.
master switch is off.
rollbackDefaultAndEnabledChangeplus a set-comparison helper foroff-state rollbacks.
Style.tsx
Use shared helpers for Style page stateopenless-all/app/src/pages/Style.tsx
preference helpers.
keeping
enabledModesin sync.enabledModes.lengthchecks with semanticmaster-enabled detection.
rawand the current defaultmode.
stylePrefs.test.ts
Extend style preference regression testsopenless-all/app/src/lib/stylePrefs.test.ts
detection.
rawdefault edge case so fallback mode lists are notduplicated.
enabledModescorrectly.