From 92ac32b6ace6d9dd27b1867e1337f1d769700f26 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Sat, 21 Nov 2026 03:51:05 -0800 Subject: [PATCH] fix(settings): report unreadable settings and the backup path [skip ci] --- ...6-11-16-settings-failed-load-protection.md | 6 +- desktop/internal/i18n/shared.generated.go | 8 +++ desktop/internal/store/store.go | 31 +++++++--- desktop/internal/workbench/app.go | 8 ++- .../workbench/notifications_visual_test.go | 61 +++++++++++++++++++ desktop/internal/workbench/settings_kept.go | 21 +++++++ .../internal/workbench/settings_kept_test.go | 52 ++++++++++++++++ shared/i18n/locales/en-US.json | 4 ++ shared/i18n/locales/zh-CN.json | 4 ++ shared/i18n/messages.json | 31 ++++++++++ .../features/application-settings.json | 4 +- 11 files changed, 218 insertions(+), 12 deletions(-) diff --git a/.agents/notes/implemented/bug-fix/2026-11-16-settings-failed-load-protection.md b/.agents/notes/implemented/bug-fix/2026-11-16-settings-failed-load-protection.md index 0c8c14cd7d..ca47c25fca 100644 --- a/.agents/notes/implemented/bug-fix/2026-11-16-settings-failed-load-protection.md +++ b/.agents/notes/implemented/bug-fix/2026-11-16-settings-failed-load-protection.md @@ -4,7 +4,7 @@ ## 先说结论 -桌面端用默认值继续启动,不等于磁盘上的偏好文件可以被默认值替换。`store.Load` 读取或解码某个文件失败后,同一个 Store 下一次 `Save` 这个文件时,先把原文件改名为 `<名称>.unreadable-`(`store.SetAsideName`),再正常写入新值。原内容一字节不丢,之后的保存照常进行。 +桌面端用默认值继续启动,不等于磁盘上的偏好文件可以被默认值替换。`store.Load` 读取或解码某个文件失败后,同一个 Store 下一次 `Save` 这个文件时,先把原文件改名为 `<名称>.unreadable-`(`store.SetAsideName`),再正常写入新值。原内容一字节不丢,之后的保存照常进行。设置无法读取时,桌面端启动后提示当前使用默认设置。首次保存移走原文件后,通知显示实际备份路径。 ## 问题 @@ -40,12 +40,14 @@ - 原内容保存在同目录的 `.unreadable-*` 文件里,用户可以对照修复后放回。 - 每次致命读取失败最多产生一个另存文件;文件不再被读取,不增加后台任务。 -- 启动时提示设置文件无法读取、另存文件在哪里,仍待 #1943 后续补齐。 +- 启动提示保留在通知历史。备份路径取自存储层实际完成的改名,因此替换文件写入失败时用户也能找到原内容。 ## 验证 - `scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1` +- `scripts/desktop/desktop-go.sh test -tags vivahead ./internal/workbench -run TestUnreadableSettingsWarnAtStartupAndIdentifyTheBackupOnSave -count=1` + ## 适用范围 - `desktop/internal/store/store.go` diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index 9f25783d05..2b9c017d46 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -2178,6 +2178,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.settings.aiGeneration.sourceUnavailable": "{source}: no usable provider with a key", "desktop.settings.aiGeneration.title": "Generation options", "desktop.settings.appearanceHelp": "The appearance mode applies to every Lithe window at once", + "desktop.settings.backup.detail": "You can find the original settings file at {path}.", + "desktop.settings.backup.title": "Original settings backed up", "desktop.settings.categories": "Settings pages", "desktop.settings.editor.tabLimit": "Tab limit", "desktop.settings.editor.tabLimitCount": "Maximum open file tabs", @@ -2315,6 +2317,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.settings.terminalShellHelp": "The shell a new terminal runs, including the one the Terminal tool window opens by itself. The ⌄ menu beside + opens a terminal in another installed shell.", "desktop.settings.terminalShellMissing": "{path} (not found)", "desktop.settings.unknownKept": "The settings file has {count} settings this version does not recognize ({keys}). This version ignores them but keeps them, so they still apply when you switch back to a version that knows them.", + "desktop.settings.unreadable.detail": "Lithe is using default settings. Lithe will back up the original file the next time settings are saved.", + "desktop.settings.unreadable.title": "Could not read settings", "desktop.settings.updates.applying": "Building Lithe {version} from the delta update…", "desktop.settings.updates.auto": "Check for updates automatically", "desktop.settings.updates.autoHelp": "Checks 5 seconds after launch, then every hour. Checks pause while the window is in the background and catch up when it returns. The update server sees your IP address when Lithe checks.", @@ -5806,6 +5810,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.settings.aiGeneration.sourceUnavailable": "{source}:没有带密钥的可用服务商", "desktop.settings.aiGeneration.title": "生成选项", "desktop.settings.appearanceHelp": "外观模式会同时应用到 Lithe 的所有窗口", + "desktop.settings.backup.detail": "原设置文件的备份位于 {path}。", + "desktop.settings.backup.title": "已备份原设置", "desktop.settings.categories": "设置页面", "desktop.settings.editor.tabLimit": "标签数量上限", "desktop.settings.editor.tabLimitCount": "最多打开的文件标签", @@ -5943,6 +5949,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.settings.terminalShellHelp": "新建终端时运行的 Shell,也包括终端工具窗口自动打开的那个。+ 旁边的 ⌄ 菜单可以用其他已安装的 Shell 新建终端。", "desktop.settings.terminalShellMissing": "{path}(未找到)", "desktop.settings.unknownKept": "设置文件中有 {count} 项此版本无法识别的设置({keys})。此版本不会使用它们,但会原样保留,换回能识别它们的版本时仍然有效。", + "desktop.settings.unreadable.detail": "Lithe 正在使用默认设置。下次保存设置时,Lithe 会备份原文件。", + "desktop.settings.unreadable.title": "无法读取设置", "desktop.settings.updates.applying": "正在用增量更新生成 Lithe {version}…", "desktop.settings.updates.auto": "自动检查更新", "desktop.settings.updates.autoHelp": "启动 5 秒后检查一次,之后每小时一次;窗口在后台时暂停,回到前台再补查。检查时更新服务器会看到你的 IP 地址。", diff --git a/desktop/internal/store/store.go b/desktop/internal/store/store.go index 2ff03e560c..3fed1d833f 100644 --- a/desktop/internal/store/store.go +++ b/desktop/internal/store/store.go @@ -178,9 +178,21 @@ func (store *Store) Unknown(name string) []string { // the file is first moved aside to SetAsideName(name, time), so a save never destroys content a // load could not read, and the file that holds the new value works again from this save on. func (store *Store) Save(name string, value any) error { - if err := store.setAside(name); err != nil { - return err + _, err := store.SaveWithBackup(name, value) + return err +} + +// SaveWithBackup also returns the path of an unreadable file moved aside by this save. +// The path is returned even if writing its replacement fails. +func (store *Store) SaveWithBackup(name string, value any) (string, error) { + backup, err := store.setAside(name) + if err != nil { + return "", err } + return backup, store.saveJSON(name, value) +} + +func (store *Store) saveJSON(name string, value any) error { store.mu.Lock() kept := store.kept[name] store.mu.Unlock() @@ -215,20 +227,25 @@ func SetAsideName(name string, at time.Time) string { // check, the rename and clearing the failure happen under one lock, so concurrent saves never move // the file a first save has just written. A file already gone has nothing to keep. A rename that // fails keeps the failure and fails the save, so the unreadable file stays where it was. -func (store *Store) setAside(name string) error { +func (store *Store) setAside(name string) (string, error) { store.mu.Lock() defer store.mu.Unlock() failed := store.failedLoad[name] if failed == nil { - return nil + return "", nil } path := filepath.Join(store.dir, name) aside := filepath.Join(store.dir, SetAsideName(name, store.now())) - if err := os.Rename(path, aside); err != nil && !errors.Is(err, fs.ErrNotExist) { - return fmt.Errorf("move unreadable %s aside before saving: %w", name, errors.Join(err, failed)) + err := os.Rename(path, aside) + if errors.Is(err, fs.ErrNotExist) { + delete(store.failedLoad, name) + return "", nil + } + if err != nil { + return "", fmt.Errorf("move unreadable %s aside before saving: %w", name, errors.Join(err, failed)) } delete(store.failedLoad, name) - return nil + return aside, nil } // Path is where the file name lives, for a reader that streams it instead of loading it whole, diff --git a/desktop/internal/workbench/app.go b/desktop/internal/workbench/app.go index 80a917285c..f067abe4a7 100644 --- a/desktop/internal/workbench/app.go +++ b/desktop/internal/workbench/app.go @@ -1040,6 +1040,8 @@ func New(options Options) *App { // After the background is restored: the notice saves the settings, which would // otherwise save no background. a.noticeUnknownSettings() + } else { + a.noticeUnreadableSettings() } } return a @@ -1468,7 +1470,11 @@ func (a *App) saveSettings() { // The background is the window's, which another tab may have changed since this one loaded. a.settings.WorkbenchBackground = a.savedBackgroundState() a.updates.store(&a.settings) - if err := a.store.Save(settingsFile, a.settings); err != nil { + backup, err := a.store.SaveWithBackup(settingsFile, a.settings) + if backup != "" { + a.noticeSettingsBackup(backup) + } + if err != nil { a.operationFailed("settings_save", documentLogError(err)) a.notifyError(a.text.Errors.SaveFailed(err.Error())) } diff --git a/desktop/internal/workbench/notifications_visual_test.go b/desktop/internal/workbench/notifications_visual_test.go index 113d29b4ea..5e42c2b0c2 100644 --- a/desktop/internal/workbench/notifications_visual_test.go +++ b/desktop/internal/workbench/notifications_visual_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/store" "github.com/vivaui/viva/app" "github.com/vivaui/viva/headless" @@ -67,3 +68,63 @@ func TestVisualNotificationsToolWindow(t *testing.T) { }) } } + +func TestVisualSettingsRecoveryNotifications(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR") + } + if err := os.MkdirAll(out, 0o755); err != nil { + t.Fatal(err) + } + system, err := app.NewDriver(app.Config{}, nil) + if err != nil { + t.Fatal(err) + } + t.Cleanup(system.Close) + for _, scene := range []struct { + theme themeChoice + language string + }{{"light", "en-US"}, {"dark", "zh-CN"}} { + name := string(scene.theme) + "-" + scene.language + t.Run(name, func(t *testing.T) { + system.SetSystemAppearance(nativeAppearance(scene.theme)) + dir := t.TempDir() + if err := os.WriteFile(filepath.Join(dir, settingsFile), []byte("{"), 0o600); err != nil { + t.Fatal(err) + } + var session *headless.Session + h := newHarnessWithDriver(t, Options{ + Kernel: &testKernel{Client: core.NewClient()}, Store: store.At(dir), Languages: []string{scene.language}, + }, func(config app.Config) (*app.Driver, func(), error) { + config.Width, config.Height = 1438, 900 + var err error + session, err = headless.Open(config, nil, headless.Options{Scale: 1}) + if err != nil { + return nil, nil, err + } + return session.Driver(), session.Close, nil + }) + capture := func(stage, titleKey string) { + t.Helper() + h.settle() + if err := session.Resize(1439, 900); err != nil { + t.Fatal(err) + } + if err := session.Resize(1440, 900); err != nil { + t.Fatal(err) + } + if !h.shows(i18n.Shared(h.app.language(), titleKey)) { + t.Fatalf("the %s notification did not paint", stage) + } + if err := session.Screenshot(filepath.Join(out, "settings-recovery-"+stage+"-"+name+".png")); err != nil { + t.Fatal(err) + } + } + capture("startup", "desktop.settings.unreadable.title") + h.app.overlay.toaster.Close(h.app.notifications.list[0].toast) + h.app.setTheme(scene.theme) + capture("backup", "desktop.settings.backup.title") + }) + } +} diff --git a/desktop/internal/workbench/settings_kept.go b/desktop/internal/workbench/settings_kept.go index 3425a48b00..b37ca5a4fd 100644 --- a/desktop/internal/workbench/settings_kept.go +++ b/desktop/internal/workbench/settings_kept.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/vivaui/viva/ui" ) // The stable channel and AutoBuild share one settings file, so the build that runs may meet @@ -53,3 +54,23 @@ func unknownSettingsFingerprint(keys []string) string { sum := sha256.Sum256([]byte(strings.Join(keys, "\n"))) return hex.EncodeToString(sum[:8]) } + +// noticeUnreadableSettings explains the fallback while the original file is still in place. +func (a *App) noticeUnreadableSettings() { + language := a.language() + a.notifyActions( + i18n.Shared(language, "desktop.settings.unreadable.title"), + i18n.Shared(language, "desktop.settings.unreadable.detail"), + ui.ToastWarning, "", nil, "", nil, + ) +} + +// noticeSettingsBackup reports the actual path once the store has moved the original file. +func (a *App) noticeSettingsBackup(path string) { + language := a.language() + a.notifyActions( + i18n.Shared(language, "desktop.settings.backup.title"), + i18n.SharedFormat(language, "desktop.settings.backup.detail", map[string]string{"path": path}), + ui.ToastInfo, "", nil, "", nil, + ) +} diff --git a/desktop/internal/workbench/settings_kept_test.go b/desktop/internal/workbench/settings_kept_test.go index 92a7a05093..85e15de26b 100644 --- a/desktop/internal/workbench/settings_kept_test.go +++ b/desktop/internal/workbench/settings_kept_test.go @@ -9,6 +9,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/store" + "github.com/vivaui/viva/app" ) // keptNotices is the notices that told about settings this version does not read. @@ -104,3 +105,54 @@ func TestAnEditorSessionANewerVersionShapedDifferentlyIsLogged(t *testing.T) { t.Fatalf("background failures = %v, want one for the editor session read", operations) } } + +func TestUnreadableSettingsWarnAtStartupAndIdentifyTheBackupOnSave(t *testing.T) { + // Invalid settings follow system appearance before the workbench driver + // exists. Open Viva's headless driver first to supply that setting. + system, err := app.NewDriver(app.Config{}, nil) + if err != nil { + t.Fatal(err) + } + t.Cleanup(system.Close) + dir := t.TempDir() + original := []byte(`{"theme":"dark","incomplete":`) + path := filepath.Join(dir, settingsFile) + if err := os.WriteFile(path, original, 0o600); err != nil { + t.Fatal(err) + } + h := newHarnessWithOptions(t, Options{ + Kernel: &testKernel{Client: core.NewClient()}, Store: store.At(dir), Languages: []string{"en"}, + }) + notices := h.app.notifications.list + if len(notices) != 1 || !strings.Contains(notices[0].text, "Could not read settings") || !strings.Contains(notices[0].detail, "default settings") { + t.Fatalf("startup did not explain that default settings are in use: %+v", notices) + } + backups, err := filepath.Glob(path + ".unreadable-*") + if err != nil || len(backups) != 0 { + t.Fatalf("startup changed the backup files: %v, %v", backups, err) + } + if actual, err := os.ReadFile(path); err != nil || string(actual) != string(original) { + t.Fatalf("startup changed the settings file: %q, %v", actual, err) + } + + h.app.setTheme("dark") + backups, err = filepath.Glob(path + ".unreadable-*") + if err != nil || len(backups) != 1 { + t.Fatalf("after saving, backups = %v, %v", backups, err) + } + if backup, err := os.ReadFile(backups[0]); err != nil || string(backup) != string(original) { + t.Fatalf("backup = %q, %v, want original settings bytes", backup, err) + } + notices = h.app.notifications.list + if len(notices) != 2 || !strings.Contains(notices[0].detail, backups[0]) { + t.Fatalf("saving did not report the backup path: %+v", notices) + } + var restored settings + if found, err := store.At(dir).Load(settingsFile, &restored); err != nil || !found || restored.Theme != "dark" { + t.Fatalf("new settings theme = %q, found = %v, err = %v", restored.Theme, found, err) + } + h.app.saveSettings() + if got := len(h.app.notifications.list); got != 2 { + t.Fatalf("second save produced a notice, got %d notices", got) + } +} diff --git a/shared/i18n/locales/en-US.json b/shared/i18n/locales/en-US.json index 9770e8203f..95383f3430 100644 --- a/shared/i18n/locales/en-US.json +++ b/shared/i18n/locales/en-US.json @@ -11194,6 +11194,10 @@ "desktop.updates.dialog.download": "Download and Install", "desktop.updates.dialog.restart": "Restart and Update", "desktop.updates.dialog.downloads": "Open Downloads Page", + "desktop.settings.unreadable.title": "Could not read settings", + "desktop.settings.unreadable.detail": "Lithe is using default settings. Lithe will back up the original file the next time settings are saved.", + "desktop.settings.backup.title": "Original settings backed up", + "desktop.settings.backup.detail": "You can find the original settings file at {path}.", "desktop.settings.unknownKept": "The settings file has {count} settings this version does not recognize ({keys}). This version ignores them but keeps them, so they still apply when you switch back to a version that knows them.", "desktop.memory.status": "{total} · Lithe {lithe}", "desktop.memory.tooltip": "Memory: {total} in total, {lithe} of it in the Lithe main process.", diff --git a/shared/i18n/locales/zh-CN.json b/shared/i18n/locales/zh-CN.json index 830f837356..e828064c0a 100644 --- a/shared/i18n/locales/zh-CN.json +++ b/shared/i18n/locales/zh-CN.json @@ -11194,6 +11194,10 @@ "desktop.updates.dialog.download": "下载并安装", "desktop.updates.dialog.restart": "重启并更新", "desktop.updates.dialog.downloads": "打开下载页面", + "desktop.settings.unreadable.title": "无法读取设置", + "desktop.settings.unreadable.detail": "Lithe 正在使用默认设置。下次保存设置时,Lithe 会备份原文件。", + "desktop.settings.backup.title": "已备份原设置", + "desktop.settings.backup.detail": "原设置文件的备份位于 {path}。", "desktop.settings.unknownKept": "设置文件中有 {count} 项此版本无法识别的设置({keys})。此版本不会使用它们,但会原样保留,换回能识别它们的版本时仍然有效。", "desktop.memory.status": "{total} · Lithe {lithe}", "desktop.memory.tooltip": "内存:共 {total},其中 Lithe 主进程 {lithe}。", diff --git a/shared/i18n/messages.json b/shared/i18n/messages.json index 071652e332..ff59f14371 100644 --- a/shared/i18n/messages.json +++ b/shared/i18n/messages.json @@ -20631,6 +20631,37 @@ "desktop" ] }, + { + "id": "desktop.settings.unreadable.title", + "description": "Title of the startup warning for an unreadable application settings file.", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.settings.unreadable.detail", + "description": "Explains the startup fallback and when the unreadable file will be backed up.", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.settings.backup.title", + "description": "Title of the notice after moving an unreadable application settings file aside.", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.settings.backup.detail", + "description": "Shows the actual backup location after moving the original file aside.", + "platforms": [ + "desktop" + ], + "parameters": { + "path": "string" + } + }, { "id": "desktop.settings.unknownKept", "description": "Notice at launch when settings.json holds settings this version does not recognize, such as ones a newer build or the other update channel wrote. They are ignored but kept in the file. {count} is how many, {keys} names up to five of them.", diff --git a/shared/platform-feature-matrix/features/application-settings.json b/shared/platform-feature-matrix/features/application-settings.json index 868debfc10..418d724dc7 100644 --- a/shared/platform-feature-matrix/features/application-settings.json +++ b/shared/platform-feature-matrix/features/application-settings.json @@ -68,8 +68,8 @@ ] }, "owner": "Settings", - "notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准初始窗口(当时 900×700,2026-11-21 起默认 1270×700)、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable- 另存,再写入新值,原内容不被默认值覆盖;启动时提示另存位置仍待补齐。macOS/Windows 共用 Go 实现,实机验收保持 pending。 2026-11-18:设置窗口的 ⓘ 和工作台、日志窗口一致,只用悬停提示;点击不再弹出会固定的白色说明卡片,因此 Escape 关闭卡片、键盘 Space/Return 打开说明也一并取消。键盘聚焦不显示提示(Viva ui 层未开放 ShowOnFocus),辅助技术仍能读出说明。 2026-11-18:删除外观与行为下的“更新”页,自动检查、更新渠道、发布源和立即检查整体迁入“关于”的更新卡片,侧栏少一行;自动化:TestDefaultSidebarListsTheTopLevelWithAppearanceExpanded、TestAboutPageNamesTheRunningVersionAsItIsReleased。 Viva 2026-11-18(构建设置重构):“构建、执行、部署”改为分组,选中时显示目录页,固定子页为“工具链”“调试器”,插件声明的页面按种类(构建工具、编译器)额外聚合到这里,插件详情的「设置」标签仍保留同一份设置和草稿;每个种类在侧栏只占一行并显示页面数,点开与“工具链”“调试器”一样分栏:左侧列出这一类的页面和提供插件,可按名称或插件筛选,右侧是选中页面的设置,再次打开回到上次看的页面;插件页只在搜索命中时单独出现在侧栏;目录页每个种类列出前 3 个名称并计数其余。只有 Build 页面或有草稿时页脚才显示“应用”,没有草稿时“好”直接关闭。自动化:TestBuildKindIsOneRowThatOpensItsPage、TestBuildKindFilterKeepsThePagesItMatchesAndTheKindRemembersOne、TestBuildPageNamesAKindAndOpensItsPage、TestSearchListsOnlyTheKindPagesItMatches,TestVisualSettings 的 32/33/34 场景生成截图。原生与 Windows 验收仍 pending。 2026-11-21:Viva 设置窗口默认尺寸改为 1270×700(最小仍为 900×668);用户调整后的尺寸会被记住,下次打开按该尺寸显示:窗口关闭时尺寸与打开时不同才写入应用设置(settingsWindowWidth/settingsWindowHeight),拖动过程中不写盘;工作台退出或关闭标签页连带关闭设置窗口时,先同步取走尺寸再关闭;同一窗口的各项目标签页共用这个尺寸,从哪个标签页打开都按它显示,其他标签页保存设置时也不会写回旧尺寸。全屏、最大化和最小化时的尺寸不记住(Viva 在这些状态不上报窗口帧),窗口位置不记住;记住的尺寸小于最小尺寸时按最小尺寸打开。自动化:TestWindowOpensAtTheSizeTheUserLastGaveIt、TestClosingKeepsTheSizeTheUserGaveTheWindow、TestResizedWindowGivesTheSizeBeforeTheWindowCloses、TestSettingsWindowSizePersistsWithOtherSettings、TestSettingsWindowSizeIsEveryProjectTabs,TestVisualSettings 生成 1270×700 截图。macOS 原生与 Windows 实机验收仍 pending。 2026-11-21:“语言与框架”在有插件贡献子页时成为分组,此前点它只显示“新桌面端暂未提供此页面”;现在与“构建、执行、部署”一样有自己的目录页:列出插件声明在它下面的每个页面(名称、提供插件,语言页另显示第一个提供插件的语言服务状态),单击或回车打开该页,方向键只移动;列表虚拟化,插件多时同样只绘制可见行;插件页上方的面包屑“语言与框架”可点回目录;点侧栏这一行同时展开分组;没有插件贡献页面时说明页面来源并提供“浏览插件市场”。宿主不为任何语言写专门页面,每一行都来自插件声明。打开的语言页不重复目录行:只有一个插件贡献时不显示插件选择器和语言服务状态卡,直接是插件设置;两个以上插件贡献时保留选择器。自动化:TestLanguagesPageListsItsPagesAndOpensThem、TestLanguagesPageWithoutPluginPages、TestLanguagePageDoesNotRepeatItsDirectoryRow,TestVisualLanguagesPage 生成深浅色、空页面和 Go 语言页截图。macOS 原生与 Windows 实机验收仍 pending。 2026-11-21:“控制台”“可信位置”从“构建、执行、部署”移到“工具”,工具分组依次为终端、搜索、控制台、可信位置;“构建、执行、部署”目录页只列工具链、调试器和插件声明的种类。“版本控制”改为分组:原来的全部开关(GitHub 账号、变更标记、行尾 Blame、变更列表、Git 日志上限、Git 控制台)搬到它下面的“Git”子页,点“版本控制”打开与“语言与框架”一样的目录页,列出 Git 一行和它包含的设置,单击打开;Git 页面包屑里的“版本控制”可点回目录;Git 控制台和 Git 日志里的设置按钮直接打开 Git 页。自动化:TestVersionControlPageListsGitAndOpensIt、TestGitIsTheOnePageOfTheVersionControlGroup、TestToolsGroupHoldsTerminalSearchConsoleAndTrustedLocations、TestBuildDirectoryListsOnlyItsOwnPages、TestConsoleEncodingPageBelongsToToolsAndMatchesSearch,TestVisualSettingsGroups 生成深浅色截图。macOS 原生与 Windows 实机验收仍 pending。", - "verification": "无头窗口覆盖 ⓘ 说明只在指针停留时以客户端共享提示气泡显示在图标右侧(右侧放不下时换到左侧)、点击图标只收起提示而不再固定白色说明卡片、辅助技术把说明读作图标描述,窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。 2026-11-21 设置窗口尺寸:首次打开(无已存尺寸)确认为 1270×700;拖动调整到其他尺寸后点“好”、“取消”或标题栏关闭,再打开确认按上次尺寸显示,重启应用后仍保持;调整尺寸后直接退出应用或关闭项目标签页,重开设置确认尺寸已保存;打开两个项目标签页,在一个标签页调整尺寸后关闭,从另一个标签页打开确认按新尺寸显示;只移动窗口不改尺寸、或改回打开时的尺寸,不写设置文件;全屏或最大化后关闭,确认下次按全屏前的尺寸打开。运行 scripts/desktop/desktop-go.sh test -race ./internal/settingswindow ./internal/workbench -run 'TestWindowOpensAtTheSizeTheUserLastGaveIt|TestClosingKeepsTheSizeTheUserGaveTheWindow|TestResizedWindowGivesTheSizeBeforeTheWindowCloses|TestBaselineSettingsControlsFitReferenceWindow|TestSettingsWindowSizePersistsWithOtherSettings|TestSettingsWindowSizeIsEveryProjectTabs' -count=1。 2026-11-21 语言与框架目录页:安装两个以上语言插件,点侧栏“语言与框架”确认显示目录页而不是“暂未提供此页面”,分组同时展开;每行显示页面名称、提供插件和语言服务状态;单击一行打开该语言页,点面包屑“语言与框架”回到目录;在目录列表上用方向键移动、回车打开;禁用所有语言插件后确认显示空页面,点“浏览插件市场”跳到插件市场标签;只有一个插件贡献的语言页顶部没有插件选择器和语言服务状态卡。运行 scripts/desktop/desktop-go.sh test ./internal/settingswindow -run 'TestLanguagesPage|TestLanguagePage' -count=1。", + "notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准初始窗口(当时 900×700,2026-11-21 起默认 1270×700)、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable- 另存,再写入新值,原内容不被默认值覆盖;启动时提示当前使用默认设置以及首次保存会备份原文件,备份成功后通知实际路径。macOS/Windows 共用 Go 实现,实机验收保持 pending。 2026-11-18:设置窗口的 ⓘ 和工作台、日志窗口一致,只用悬停提示;点击不再弹出会固定的白色说明卡片,因此 Escape 关闭卡片、键盘 Space/Return 打开说明也一并取消。键盘聚焦不显示提示(Viva ui 层未开放 ShowOnFocus),辅助技术仍能读出说明。 2026-11-18:删除外观与行为下的“更新”页,自动检查、更新渠道、发布源和立即检查整体迁入“关于”的更新卡片,侧栏少一行;自动化:TestDefaultSidebarListsTheTopLevelWithAppearanceExpanded、TestAboutPageNamesTheRunningVersionAsItIsReleased。 Viva 2026-11-18(构建设置重构):“构建、执行、部署”改为分组,选中时显示目录页,固定子页为“工具链”“调试器”,插件声明的页面按种类(构建工具、编译器)额外聚合到这里,插件详情的「设置」标签仍保留同一份设置和草稿;每个种类在侧栏只占一行并显示页面数,点开与“工具链”“调试器”一样分栏:左侧列出这一类的页面和提供插件,可按名称或插件筛选,右侧是选中页面的设置,再次打开回到上次看的页面;插件页只在搜索命中时单独出现在侧栏;目录页每个种类列出前 3 个名称并计数其余。只有 Build 页面或有草稿时页脚才显示“应用”,没有草稿时“好”直接关闭。自动化:TestBuildKindIsOneRowThatOpensItsPage、TestBuildKindFilterKeepsThePagesItMatchesAndTheKindRemembersOne、TestBuildPageNamesAKindAndOpensItsPage、TestSearchListsOnlyTheKindPagesItMatches,TestVisualSettings 的 32/33/34 场景生成截图。原生与 Windows 验收仍 pending。 2026-11-21:Viva 设置窗口默认尺寸改为 1270×700(最小仍为 900×668);用户调整后的尺寸会被记住,下次打开按该尺寸显示:窗口关闭时尺寸与打开时不同才写入应用设置(settingsWindowWidth/settingsWindowHeight),拖动过程中不写盘;工作台退出或关闭标签页连带关闭设置窗口时,先同步取走尺寸再关闭;同一窗口的各项目标签页共用这个尺寸,从哪个标签页打开都按它显示,其他标签页保存设置时也不会写回旧尺寸。全屏、最大化和最小化时的尺寸不记住(Viva 在这些状态不上报窗口帧),窗口位置不记住;记住的尺寸小于最小尺寸时按最小尺寸打开。自动化:TestWindowOpensAtTheSizeTheUserLastGaveIt、TestClosingKeepsTheSizeTheUserGaveTheWindow、TestResizedWindowGivesTheSizeBeforeTheWindowCloses、TestSettingsWindowSizePersistsWithOtherSettings、TestSettingsWindowSizeIsEveryProjectTabs,TestVisualSettings 生成 1270×700 截图。macOS 原生与 Windows 实机验收仍 pending。 2026-11-21:“语言与框架”在有插件贡献子页时成为分组,此前点它只显示“新桌面端暂未提供此页面”;现在与“构建、执行、部署”一样有自己的目录页:列出插件声明在它下面的每个页面(名称、提供插件,语言页另显示第一个提供插件的语言服务状态),单击或回车打开该页,方向键只移动;列表虚拟化,插件多时同样只绘制可见行;插件页上方的面包屑“语言与框架”可点回目录;点侧栏这一行同时展开分组;没有插件贡献页面时说明页面来源并提供“浏览插件市场”。宿主不为任何语言写专门页面,每一行都来自插件声明。打开的语言页不重复目录行:只有一个插件贡献时不显示插件选择器和语言服务状态卡,直接是插件设置;两个以上插件贡献时保留选择器。自动化:TestLanguagesPageListsItsPagesAndOpensThem、TestLanguagesPageWithoutPluginPages、TestLanguagePageDoesNotRepeatItsDirectoryRow,TestVisualLanguagesPage 生成深浅色、空页面和 Go 语言页截图。macOS 原生与 Windows 实机验收仍 pending。 2026-11-21:“控制台”“可信位置”从“构建、执行、部署”移到“工具”,工具分组依次为终端、搜索、控制台、可信位置;“构建、执行、部署”目录页只列工具链、调试器和插件声明的种类。“版本控制”改为分组:原来的全部开关(GitHub 账号、变更标记、行尾 Blame、变更列表、Git 日志上限、Git 控制台)搬到它下面的“Git”子页,点“版本控制”打开与“语言与框架”一样的目录页,列出 Git 一行和它包含的设置,单击打开;Git 页面包屑里的“版本控制”可点回目录;Git 控制台和 Git 日志里的设置按钮直接打开 Git 页。自动化:TestVersionControlPageListsGitAndOpensIt、TestGitIsTheOnePageOfTheVersionControlGroup、TestToolsGroupHoldsTerminalSearchConsoleAndTrustedLocations、TestBuildDirectoryListsOnlyItsOwnPages、TestConsoleEncodingPageBelongsToToolsAndMatchesSearch,TestVisualSettingsGroups 生成深浅色截图。macOS 原生与 Windows 实机验收仍 pending。", + "verification": "无头窗口覆盖 ⓘ 说明只在指针停留时以客户端共享提示气泡显示在图标右侧(右侧放不下时换到左侧)、点击图标只收起提示而不再固定白色说明卡片、辅助技术把说明读作图标描述,窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;TestUnreadableSettingsWarnAtStartupAndIdentifyTheBackupOnSave 覆盖启动提示、备份路径和二次保存不重复提示;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。 2026-11-21 设置窗口尺寸:首次打开(无已存尺寸)确认为 1270×700;拖动调整到其他尺寸后点“好”、“取消”或标题栏关闭,再打开确认按上次尺寸显示,重启应用后仍保持;调整尺寸后直接退出应用或关闭项目标签页,重开设置确认尺寸已保存;打开两个项目标签页,在一个标签页调整尺寸后关闭,从另一个标签页打开确认按新尺寸显示;只移动窗口不改尺寸、或改回打开时的尺寸,不写设置文件;全屏或最大化后关闭,确认下次按全屏前的尺寸打开。运行 scripts/desktop/desktop-go.sh test -race ./internal/settingswindow ./internal/workbench -run 'TestWindowOpensAtTheSizeTheUserLastGaveIt|TestClosingKeepsTheSizeTheUserGaveTheWindow|TestResizedWindowGivesTheSizeBeforeTheWindowCloses|TestBaselineSettingsControlsFitReferenceWindow|TestSettingsWindowSizePersistsWithOtherSettings|TestSettingsWindowSizeIsEveryProjectTabs' -count=1。 2026-11-21 语言与框架目录页:安装两个以上语言插件,点侧栏“语言与框架”确认显示目录页而不是“暂未提供此页面”,分组同时展开;每行显示页面名称、提供插件和语言服务状态;单击一行打开该语言页,点面包屑“语言与框架”回到目录;在目录列表上用方向键移动、回车打开;禁用所有语言插件后确认显示空页面,点“浏览插件市场”跳到插件市场标签;只有一个插件贡献的语言页顶部没有插件选择器和语言服务状态卡。运行 scripts/desktop/desktop-go.sh test ./internal/settingswindow -run 'TestLanguagesPage|TestLanguagePage' -count=1。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": {