Repository navigation
feat(desktop): 设置 › 工具 › 远程工作区:SSH 程序与断线重连时长 (#2231) - #2289
Merged
Merged
Conversation
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.
关联 Issue / Linked issue
remote.preferences/remote.editPreferences,已合入 main 49fb750,本 PR 固定该提交)PR 类型 / Type
改动说明 / What changes
背景 / Why
#2231 要求设置里单独有“工具 › 远程工作区”。在这之前,远程连接用的 SSH 程序只能是 PATH 上的
ssh,断线后的重连写死在桌面端(6 次,1–30 秒退避),用户改不了,也看不到实际生效的值。Core #158 把偏好文档的读取、校验和默认值放进了crates/remote。这个 PR 在桌面端接上它:设置页能看、能改这两项;每次启动 OpenSSH 都带上偏好,断线重连的间隔也由 Core 给出。改动 / Changes
设置页(
settingswindow/remote_workspace_view.go、remote_preferences_state.go、model.go、window_view.go、toolchains_state.go)~/.ssh/config路径,文件不存在时在路径后注明“不存在”。remote/preferences.json;还没有这个文件时,注明“修改后才创建”。remote.preferences调用,所以即使保存了其他值,也能显示自动时会用什么。应用(
settingswindow/build_apply.go)remote.editPreferences改一个字段。写完重新读取,再显示结果。偏好文件(
remoteconn/preferences.go)remote/preferences.json,和已保存的连接放在一起;路径和大小上限(16 KiB)都以 Core 给出的为准。ReadPreferences、PreferencesDocument、Preferences.Edit、Path()和Exists()。连接时带上偏好(
workbench/remote_preferences.go、remote.go、remote_list.go、remote_browse.go、remote_import.go、remote_workspace.go)remote.connect);remote.probe);remote.effectiveSettings);remote.sshConfigHosts)。断线重连(
workbench/remote_workspace.go)remoteReconnectAttempts、remoteReconnectFirstPause、remoteReconnectMaxPause和remoteReconnectPause。Core 客户端(
internal/core/remote_preferences.go、remote.go、remote_helpers.go、remote_session.go)RemotePreferences(remote.preferences)和EditRemotePreferences(remote.editPreferences)。RemoteConnectRequest新增Preferences。RemoteProbe、RemoteEffectiveSettings和RemoteSSHConfigHosts都新增一个preferences参数。固定 Core 修订(
scripts/desktop/build-desktop-core.sh)PINNED_CORE_REVISION指向 Core main 49fb750(Bundle JDTLS with packaged applications #158 已合入,代码树与分支提交 07ad14e 相同)。日志
remote_preferences_settings_load和remote_preferences_settings_save。remote.preferences.edit动作;重连前读不到偏好时,记remote_reconnect_preferences。documentLogError),不记路径。文案、截图与矩阵
shared/i18n/features/remote-settings.json新增本页的中英词条,并已重新生成。docs/assets/remote-settings/新增“自动值”和“草稿”两个场景的截图,各有浅色英文和深色中文两版,另附说明 README。remote-workspace.json更新了四处:remote.preferences和remote.editPreferences。测试
settingswindow/remote_workspace_view_test.go里有 4 个测试,都经真实的 Core 客户端运行:remoteconn/preferences_test.go覆盖读取、编辑、冲突和损坏。settingswindow/remote_workspace_visual_test.go是无头截图测试。fireReconnect辅助函数,它确认重连前的第一次停顿是 Core 给出的 1 秒。原来的退避循环改为每次先等只剩一个计时器,再触发它。TestExpandedToolsGroupListsTerminal改为期望 19 行,“工具”下五页。不在本 PR 范围内 / Out of scope
类型专属:feat
多平台对齐
范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json,改了能力描述、证据、验证动作和说明。两端证据都有新增的源文件,macOS 证据另有三份测试。原生窗口验收没做,验证状态没有提前改成通过。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD,都通过.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;没有写插件的构建步骤或资源路径UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow/... -run 'TestVisualRemoteWorkspace$' -count=1/Users/example。“自动(/usr/bin/ssh)”是本机 Core 实际解析出的路径。自动值(打开页面只读取;SSH 配置文件不存在;保存位置还没有文件)
草稿(选了 SSH 程序和 5 分钟重连时长;侧栏圆点,底部显示 2 项未应用)
统一日志系统 / Structured logging
recordFailure,动作走现有的performedIn,重连前读偏好失败走现有的backgroundFailed;没有print,也没有直接写 stderrdocumentLogError)界面文案 / i18n
shared/i18n/features/remote-settings.json(中英),运行了node scripts/i18n/generate-i18n.mjs并提交了生成结果node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过逻辑归属 / Logic placement
crates/remote):性能与内存 / Performance and memory
设置 / Settings
~/.ssh/config只读显示路径,不在这里编辑;这里没有需要隐藏的敏感字段2026-10-15-macos-settings-hierarchy.md:远程工作区属于“工具”插件契约 / Plugin contract
N/A:只依赖 Core 的远程 API(
remote.preferences、remote.editPreferences,以及 connect、probe、effectiveSettings、sshConfigHosts 新增的preferences字段),不涉及插件契约、能力版本或宿主方法。发行包与资源 / Bundle and resources
remote/preferences.json),由本机用户拥有,第一次修改时创建;它不影响代码签名或 Sparkle 增量包,生命周期写在remoteconn/preferences.go的注释里./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过无用代码与重构 / Dead code and refactoring
remoteReconnectPause已删除,改用 Core 给出的间隔验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/workbench/... ./internal/settingswindow/... -count=1scripts/desktop/desktop-go.sh test ./internal/core/... ./internal/remoteconn/... -count=1scripts/desktop/desktop-go.sh vet,用在改动的包上,另外带-tags 'vivahead lithevisual'跑一遍gofmt -l检查 workbench、core、remoteconn、settingswindowTestVisualRemoteWorkspace(vivahead lithevisual)node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/desktop/verify/verify-runtime-bundle-immutability.shrg未能执行的检查和原因:
提交前确认 / Final checks
main(818cdd428)创建,目标分支main/Users/example