From b559d0a0af988c3d30eac9a24acb72e9efd9af4d Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Wed, 18 Nov 2026 00:12:20 +0800 Subject: [PATCH] docs: record the WSL git, LAN tab-id, start-page switch and find fixes Covers #1206 (contributor @llwinty), #1166, #1212, #1159, #1214, #1165. --- CHANGELOG.md | 12 ++++++++++++ CHANGELOG_EN.md | 12 ++++++++++++ CONTRIBUTORS.md | 1 + 3 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45966df3..eda00378 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ ### 未发布 +- 🧩 **局域网明文 HTTP 下侧边对话与底部终端页签恢复正常**([#1166](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1166)):浏览器只在**安全上下文**(https 或 localhost)暴露 `crypto.randomUUID`;用 `http://<局域网 IP>:<端口>` 打开 GUI 时它是 `undefined`,而新开侧边对话页签、新开底部终端都直接调用它——异常发生在宿主创建页签的过程中,界面只剩一个空面板。现在这三处改为一个内部 `freshId()`:有 `randomUUID` 就用它,否则用 `crypto.getRandomValues`(不受安全上下文限制)取 64 位随机数 + 毫秒时间戳兜底,id 仍然唯一。 + - 🧪 测试:`tests/builtins.spec.ts` 在删掉 `crypto.randomUUID` 的全局环境下驱动真实 `createTab` 工厂,断言侧边对话与终端各自产出非空且互不相同的 id。 + +- ⚙️ **开始页「调整顺序」里关掉的卡片能重新打开了**([#1212](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1212)):宿主设置路由对嵌套普通对象做**深合并**,所以「把 key 删掉」表达不了「显示」——存下来的 `true` 会存活下来,开关自己弹回关。现在两处写入(开始页弹窗与设置页)都改为发送**该 key 的显式布尔值** `{ guideHidden: { : false } }`;读取侧一律按 `=== true` 判断,所以存下来的 `false` 天然表示显示,不需要额外的形状归一。 + - 🧪 测试:`tests/native-guide.spec.tsx` 驱动真实 `NativeGuide` 走「更多 → 调整顺序 → 重新打开卡片」,断言线上参数确实是 `{ guideHidden: { a: false } }`。 + +- ⏱️ **设置读得慢时,侧边卡片的开关不再被永久忽略**([#1159](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1159)):启动时用「2 秒首绘预算」抢设置文档,超时就按默认值挂载。但抢输的那次读取结果被直接丢弃,而 `settings/document-updated` 只在文档**变更**时触发、不会为一次迟到的读触发——于是 `tabsEnabled: { : false }` 整个会话都没被看见,被禁用的第三方页签一直留在「+ / 更多工具」里,直到用户在设置里开一次再关一次。现在超时后仍会接住**同一次读取**的迟到结果并应用(带 generation 守卫,避免覆盖更新的设置更新;dispose 后不再触碰 store)。首绘预算与「先按默认值挂载」的行为都不变。 + - 🧪 测试:`tests/prefs.spec.ts` 新增「启动决策超时」两例:迟到结果只回调一次并带上禁用项与 suspended 标记;准时返回时迟到回调永不执行。 + +- 🐧 **WSL 工作区里 Git 页签不再恒显示「加载失败」**(贡献者 PR [#1206](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1206) @llwinty):`git rev-parse --show-toplevel` 是在发行版**内部**跑的,因此返回发行版里的 POSIX 路径(`/home/...`);而后续每条 git 命令都靠 UNC 拼写(`\\wsl.localhost\<发行版>\...`)反推发行版,于是拿到这个 POSIX 根的每条命令都掉回 Windows 侧 git,以 `cannot change to '/home/...'` 失败,整页没有任何分支/分组/提交框。现在发现到的根(以及 worktree 清单里的每个 linked checkout)会按发现它的 cwd 重新拼回同一 share 的 UNC 拼写。贡献者已在本机 Windows + 真实 WSL 仓库上做过修复前后 A/B,并把修复后的 `lib/index.js` 换进已安装包做过端到端验证。 + - 🧪 测试:`tests/git-spawn.spec.ts` 覆盖根的重新拼写、linked checkout、非 WSL 路径不受影响,以及后续命令确实经 `wsl.exe` 执行。 + - 🔍 **宿主接管页头时也有「查找」入口了**([#1214](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1214)):v0.32.1 给编辑器自带工具条加的查找按钮,在侧栏真实的合并式页头(`EditorHost` 以 `toolbar: 'host'` 接管)下整行不渲染,markdown / html / jsonl 预览态更是没有任何查找入口,只剩可能被第三方插件全局截获的 Cmd/Ctrl+F。现在内置编辑器把查找命令注册给宿主页头:文件可编辑时页头显示查找按钮,点击与自带工具条按钮走同一套逻辑——预览态先切到编辑,再打开 CodeMirror 的查找面板(含替换行)。没有查找面的 viewer 不注册该命令,页头也就不显示按钮。 - 🧪 测试:`tests/editor-host.spec.tsx` 用真实 `TextEditor` 走「页头查找按钮 → 搜索面板打开 + markdown 预览切编辑」;`tests/editor-find.spec.tsx` 增加 host 模式命令测试。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index d8019213..5ec5dddb 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -6,6 +6,18 @@ ### Unreleased +- 🧩 **Side Chat and the bottom terminal work again over plain-HTTP LAN** ([#1166](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1166)): browsers expose `crypto.randomUUID` only in a **secure context** (https or localhost); opened as `http://:` it is `undefined`, and minting a new Side Chat tab or a new bottom terminal called it unguarded — the throw happened inside the host's tab creation, leaving an empty pane. Those three sites now go through an internal `freshId()`: `randomUUID` when available, otherwise `crypto.getRandomValues` (not restricted to secure contexts) for 64 random bits plus a millisecond timestamp, so the ids stay unique. + - 🧪 `tests/builtins.spec.ts` drives the real `createTab` factories with `crypto.randomUUID` deleted and asserts non-empty, mutually distinct ids for both tabs. + +- ⚙️ **A start-page card turned off in "Reorder" can be turned back on** ([#1212](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1212)): the host settings route **deep-merges** nested plain objects, so deleting a key cannot express "shown" — the stored `true` survives and the switch flips itself back off. Both writers (the start-page dialog and the settings page) now send the **explicit boolean for that key** (`{ guideHidden: { : false } }`); every reader asks `=== true`, so a stored `false` already reads as shown and no shape normalization is needed. + - 🧪 `tests/native-guide.spec.tsx` drives the real `NativeGuide` through "more → Reorder → re-show the card" and asserts the wire argument is exactly `{ guideHidden: { a: false } }`. + +- ⏱️ **A slow settings read no longer strands the side-card switches for the whole session** ([#1159](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1159)): boot races the settings document against a 2 s first-paint budget and mounts on the defaults when it loses — but the losing read's answer was discarded, and `settings/document-updated` only fires on a document **change**, never for a late read. A persisted `tabsEnabled: { : false }` was therefore never seen, and a disabled third-party tab stayed in "+ / more tools" until the user toggled it off and on. The timeout path now keeps watching the **same read** and adopts its answer when it lands (generation-guarded so it cannot overwrite a newer settings update, and inert after dispose). The budget and the "mount on the defaults first" behaviour are unchanged. + - 🧪 `tests/prefs.spec.ts` gains two "boot decision timeout" cases: the late answer reaches the callback exactly once with the disabled tabs and the suspended flag; an in-time answer means the late callback never runs. + +- 🐧 **The Git tab no longer reads "failed to load" in a WSL workspace** (contributor PR [#1206](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1206) @llwinty): `git rev-parse --show-toplevel` runs **inside** the distribution, so it answers with a distribution-side POSIX path (`/home/...`), while every later command identifies the distribution from the UNC spelling (`\\wsl.localhost\\...`). Every command on that POSIX root therefore fell back to the Windows git and died with `cannot change to '/home/...'` — no branch, no groups, no commit box. The discovered root (and every linked checkout in the worktree list) is now re-spelled back onto the same share it was discovered from. The contributor A/B-checked before/after on a real Windows + WSL repository and installed the patched `lib/index.js` into a real package for an end-to-end check. + - 🧪 `tests/git-spawn.spec.ts` covers the re-spelling, linked checkouts, non-WSL paths staying untouched, and the follow-up commands actually running through `wsl.exe`. + - 🔍 **Find is available when the host owns the editor header** ([#1214](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1214)): the find button added to the editor's own toolbar in v0.32.1 never rendered in the real sidebar, where `EditorHost` takes the header over with `toolbar: 'host'` and the whole self-toolbar row is skipped — and a markdown/html/jsonl preview had no find entry at all, leaving Cmd/Ctrl+F as the only way, which a third-party plugin can capture globally. The built-in text editor now registers its find command with the host header: the button appears while the file is editable and runs the same logic as the toolbar one — flip a preview to edit first, then open CodeMirror's search panel (replace row included). A viewer with no find surface omits the command, so no button appears for it. - 🧪 `tests/editor-host.spec.tsx` drives the real `TextEditor` through "header find button → panel opens + markdown preview flips to edit"; `tests/editor-find.spec.tsx` covers the host-mode command. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f1cbe7ec..2827d5cc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -24,5 +24,6 @@ dsh-better-sidebar is built with the community. This file records the PR authors | @pennxiang | Side-chat page mode: shared default plus independent per-thread native pages with exact bindings | [#1115](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1115) | | @iasiv5 | Responsive multi-repo switcher with location labels | [#1130](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1130) | | @wang-kaopu | Clickable absolute Markdown paths in chat | [#882](https://github.com/omdsh-dev/DSH-better-sidebar/pull/882) | +| @llwinty | WSL repository roots keep their UNC spelling, so the Git tab loads | [#1206](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1206) | Maintainer-authored work in the same cycle (issue implementations, fixes, integration and tests) is recorded in the changelog. Add a row here when integrating a contributor PR; the release note is the authoritative, versioned copy.