Skip to content

feat(workbench): 完善起始页置顶、标签和远程最近项目 - #2457

Open
Mucheen wants to merge 4 commits into
1lck:mainfrom
Mucheen:codex/welcome-recent-projects
Open

Mucheen wants to merge 4 commits into
1lck:mainfrom
Mucheen:codex/welcome-recent-projects

Conversation

@Mucheen

@Mucheen Mucheen commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

关联 Issue / Linked issue

PR 类型 / Type

  • feat
  • fix
  • docs
  • release

改动说明 / What changes

背景 / Why

多个窗口各自缓存最近项目,后保存的窗口可能覆盖另一窗口刚写入的置顶状态。新固定的项目也可能排在已有置顶项下面。起始页缺少项目标签与按标签筛选,远程项目只出现在已保存连接的文件夹历史中。

改动 / Changes

  • 起始页固定最新项目到首位,取消固定后恢复按打开时间排序。写入前在跨进程锁内读取最新历史。菜单提交明确的固定或取消固定动作,旧窗口重复固定不会反转状态。
  • 通过项目菜单编辑多个标签。项目行显示标签,起始页提供标签下拉筛选,可叠加文字搜索。支持中文和英文逗号输入。列表行按置顶、标签和分支内容增高。
  • 成功打开的远程工作区加入起始页和标题栏最近项目。通过完整传输链和远端路径区分连接,点击历史条目复用当前连接配置、现有认证和信任流程。远程记录显示连接名和远端路径。
  • 历史首次保存时从旧文件导入到 recent-projects-v2.json。新版与旧版各自写各自的文件,降级不会抹掉新版的标签和远程身份。导入旧客户端历史、移除条目及保存失败都经过同一事务入口。
  • 桌面固定到 Core #205 的可拉取修订。Core 提供与两端共用的排序、标签校验、筛选与远程历史键规则。

不在本 PR 范围内 / Out of scope

已保存连接中的旧远程文件夹在下次成功打开后加入公共历史。其余 #2231 远程功能由原议题跟踪。桌面 PR 合并前请先合入 Core #205,并将固定修订更新为 Core 主线上的对应提交。

类型专属:feat

多平台对齐

  • 两端都具备:macOS 与 Windows 使用同一套 Viva 工作台和 Rust Core。Windows 原生交互待验收。

范围检查 / Scope checks

功能矩阵 / Feature matrix

  • 更新 onboarding-welcome、workspace-open-switch 和 remote-workspace,两端原生验证保持 pending。
  • 矩阵内容验证及相对 upstream/main 的变更门禁通过。
  • 生成的矩阵视图位于本地构建产物目录。
  • [N/A] 未更新矩阵的理由,已更新相关条目。

插件归属 / Plugin ownership

  • 宿主零依赖自查无匹配。
  • 测试使用临时项目和受控远程连接替身。
  • 矩阵仅记录宿主能力。
  • 新词条和资源说明均属于宿主。
  • [N/A] 插件通用扩展点未变更。

UI 验证 / UI evidence

  • Viva 无头场景覆盖最近列表、筛选结果和标签编辑。浅色中文、深色英文,1000 × 640。命令和截图见验证部分。
  • 截图已上传,见下方。
  • 界面截图覆盖本次实现,旧行为由复现和回归步骤记录。原生 macOS、Windows 窗口交互待验收。

统一日志系统 / Structured logging

  • 复用现有目录中的操作失败和状态读取失败事件。保存、读取和 Core 校验失败在处理边界记录。
  • 操作失败按结果记录一次。
  • 保存失败日志脱敏,远程历史及标签内容不进日志。
  • 旧日志使用门禁脚本已经移除,等价门禁未完成。

界面文案 / i18n

  • 宿主中英文词条通过共享入口生成。
  • 词条仅包含宿主文案。
  • i18n 校验、生成一致性和测试通过。

逻辑归属 / Logic placement

  • Rust Core 的 workspace.recentProjects.reduce 管理排序、数据规则、标签、筛选和远程历史身份,证据为 Core 的 rust/fixtures/workspace/recent-projects-v1.json。
  • 原有按路径过滤已迁入 Core。Viva 负责显示、收集意图,以及调用原生文件锁、存储和既有远程连接入口。
  • 沿用既有远程连接类型和认证流程。

性能与内存 / Performance and memory

  • 无空闲轮询。锁等待和文件读取由有界后台任务执行,事务完成即关闭句柄。筛选结果随列表或输入变化时更新。
  • 更新最近列表时的磁盘操作在后台执行。筛选投影只返回可见行索引和标签选项。
  • 旧版启动及搜索基线脚本已移除,原生性能基线未完成。

设置 / Settings

N/A,改动是起始页项目历史与标签编辑。

插件契约 / Plugin contract

N/A,共享变更属于应用 C ABI。配套命令文档、fixture 和 Core 固定修订已更新。

发行包与资源 / Bundle and resources

  • 历史及锁文件位于用户配置目录,安装包文件保持原样。运行了只读脚本及其测试。
  • docs/ci-builds.md 说明历史文件、锁文件和截图的归属、生命周期及工作树复制限制。

无用代码与重构 / Dead code and refactoring

  • 删除了旧的最近项目保存入口和重复的文本过滤。
  • [N/A] 本次直接改动范围内未发现需要单独建单的重构项。

验证 / Verification

命令或操作 平台 结果
test-stability-macos.sh --package ./internal/core --package ./internal/workbench,vivahead,lithevisual,定向起始页及最近项目 macOS ARM64 43 项通过,最慢 3.24 秒
起始页相关 go test -race macOS ARM64 6 项通过
Core 项目 crate、C ABI 最近项目契约 macOS ARM64 104 项及契约 2 项通过
Core/Viva 固定版本、矩阵、i18n、Agent Note、安装包只读及其 Node 夹具 本机 通过

固定版本的桌面代码为 78827905a。用例包括跨窗口覆盖、旧窗口重复置顶、标签编辑筛选、旧版历史读取隔离、SSH 受控替身重开和安装包不变验证。

前一轮全量尝试出现 CLI 启动、zsh 与插件工具链相关失败。CLI 单独通过,未改动的主线终端包复现 zsh 失败。Windows 原生交互、真实 SSH、WSL 与容器尚未验收。

6 张最终截图

起始页置顶与远程最近项目

提交前确认 / Final checks

  • 分支基于最新检出的 upstream/main,目标为 main。
  • Draft 等待验证和 Core 依赖。
  • PR 提交中不含构建产物、凭据、个人路径或未脱敏日志。截图链接使用单独的素材分支。
  • 本次测试启动的客户端和测试进程已清理。

@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 27, 2026
@Mucheen
Mucheen marked this pull request as ready for review November 27, 2026 04:35

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +55 to +65
if remote.SSHConnectionID != "" {
saved := a.remote.entry(remote.SSHConnectionID)
if saved == nil {
a.remote.selectFirst()
a.operationRejected("remote_connect", "connection_removed")
if a.remote.readErr == "" {
a.remote.err = i18n.Shared(a.language(), "desktop.remote.hostSwitcher.connectionRemoved")
}
return
}
host.ssh = saved.Connection

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 SSH history opens the wrong host

After a saved SSH connection changes hosts, connectRecentRemote opens the old history entry’s folder on the new host. The connection keeps its ID, so a matching folder on the new host also inherits the old host’s pins and tags.

Learn more

saveRemote edits a saved SSH connection by its existing ID. The pinned Core’s connection save implementation keeps that ID but clears the connection’s own folder history when its target changes. recordRemoteRecent uses that same ID as the transport identity; the Core history key adds only the folder path. With no live tab, reopening therefore combines the old folder with the new host. openRecentRemote has the opposite problem when the old tab is still live: it activates that tab without checking the current target.

Example: Pin /srv/app on staging, then edit its saved connection to point at a replacement host that also has /srv/app. With the staging tab closed, clicking the staging recent opens the replacement host’s folder and retains the staging pin and tags.

Recommended fix: Bind history keys to a non-secret target identity as well as the saved connection ID and folder. Use Core’s target comparison rules to detect retargeting before opening or activating a tab, while still reading current settings and credentials for an unchanged target.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +80 to +81
edit.saving = true
a.changeRecent(core.SetRecentTags(edit.path, strings.FieldsFunc(edit.field.Text(), func(r rune) bool { return r == ',' || r == ',' })), func(_ core.RecentProjectsResult, err error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Saved tags overwritten across windows

When two windows edit the same project’s tags, saveWelcomeTags submits each draft without checking its starting tags. Saving the second draft silently removes tags added by the first save.

Learn more

editWelcomeTags copies the current tags into a text field. That draft does not change when finishRecent applies an updated history from another window. reduceStoredRecent rereads history under the file lock, but the tag action replaces the fresh tags rather than comparing them with the draft’s starting tags.

Example: Open Edit Tags for the same project in two windows while it has Work. In the first window, save Work, Research. After that save completes, save Work, Personal from the already-open second editor. The second save succeeds and Research disappears from disk.

Recommended fix: Capture the starting tags when opening the editor. Compare them with the latest entry inside the locked transaction before replacing them. On conflict, preserve the draft and tell the user that the saved tags changed.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +27 to +29
project := func(tag string) (core.RecentProjectsResult, error) {
return a.kernel.ReduceRecentProjects(ctx, a.recent, core.FilterRecent(query, tag), 0)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Search misses Greek project names

Searching for Σ through FilterRecent misses a project named ΟΣ. Core lowercases the query to σ but the matching letter in the project name to ς. The same mismatch can split case variants of a project tag.

Learn more

The pinned Core filter lowercases each whole string, then compares the resulting bytes. Rust lowercases capital sigma at the end of a Greek word differently from an isolated capital sigma. The previous desktop path search used Go’s context-independent strings.ToLower, so the same uppercase letter matched in both locations.

Example: Open a local folder named ΟΣ, return to the welcome page, and search for Σ. The folder appears before the Core migration but not after it.

Recommended fix: Use a context-independent Unicode case fold for search haystacks, queries, and tag keys in Core. Preserve the entered tag for display. Add a Core fixture for substring search and tag identity with Σ, σ, and ς.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant