Menghuan1918
53c13638cd
fix(search-engines,e2e): Windows 路径推导按入参平台、fixture 换合法元字符、展开断言改为预取感知
集成批 17556fd 在 CI 上暴露三处红(Ubuntu `ci` 绿、Windows 测试红 2 条、挂载 lane 红 1 条),
逐条根因与修法:
1) tests/search-engines.spec.ts > bundledRgCandidates > walks every node_modules level
above the CLI entry (argv[1])(仅 Windows 红)
CI: AssertionError: expected [ …(8) ] to include '\Applications\Dsh.app\Contents\Resour…'
根因:bundledRgCandidates() 按「传入的 platform」推导候选,内部却用宿主的 sep / dirname / join。
测试传的是 POSIX 路径(/Applications/Dsh.app/…),Windows runner 上 sep === '\\' →
endsWith('<sep>node_modules') 永不成立 → argv[1] 走查一个 root 都产不出,期望项缺失。
修法(修源头,不改测试语义):按 platform 选 node:path 方言
(`const P = platform === 'win32' ? win32 : posix`),walkRoots 与 %APPDATA% / execPath /
profile / 候选拼装一律走 P.dirname / P.join / P.sep。函数自此是入参的纯函数:darwin 在任何
宿主上都产出 '/'-joined 候选,win32 都产出 '\'-joined 候选。
测试同步:darwin 用例期望改用 posix.join、win32 用例改用 win32.join——宿主 join 正是
Windows 上把 POSIX 期望拼成反斜杠、POSIX 上又把 win32 期望拼成混合分隔符的原因;
argv[1] 那条补齐 win32 反向断言(在 macOS 上直接跑出真实反斜杠形状),%APPDATA%、
~/.dsh profile、APPDATA 缺席三条从「结构包含」收紧为精确 pin win32 形状。
2) tests/search-engines.spec.ts > real engines (only when installed) > matches literals,
splits dirs, skips noise when an engine is installed(仅 Windows 红)
CI: Error: ENOENT: no such file or directory, open
'C:\Users\RUNNER~1\AppData\Local\Temp\dsh-sidebar-engine-real-oCa7RG\a*b.ts'
(tests/search-engines.spec.ts:432)
根因:为验证「模式里的元字符按字面处理」而真建了一个叫 a*b.ts 的文件——'*'(连同 ? : " < > |)
是 Windows 非法文件名字符,fixture 自己就 ENOENT,一条断言都没跑到。
修法:按 platform 选一对「两平台都合法、且非字面解读必然命中诱饵」的见证。POSIX 保留
query 'a*b' / literal 'a*b.ts' / decoy 'anb.ts';win32 改用 '[' ']'(Windows 合法文件名
字符)——query 'a[b]' / literal 'a[b].ts' / decoy 'ab.ts'。'a[b]' 是 glob 字符组,漏转义时
匹配的是 'ab.ts' 而不是字面文件(实测 rg 15.2.0:未转义 '*a[b]*' 返回 ab.ts,转义
'*a\[b\]*' 返回 a[b].ts)。刻意不用未闭合的 'a[b':rg 直接拒绝该 glob(unclosed character
class),引擎被判 broken 后回退普通 walk,断言会被兜底意外满足。整条用例不跳过、
「元字符不当通配符」的断言不削弱。
3) tests/e2e/zz-expand-refresh.e2e.ts > a folder toggle re-lists that folder and nothing else
(挂载 lane 红)
CI: Expected: "fs.trees[bravo]" / Received: undefined,同用例 phase dump:
D-expand-bravo: requests: [], domAdded: 1, ...
A-expand-big: requests: ["fs.trees[big]"], domAdded: 41, ...
根因(是预期行为,不是缺陷):src/fs-tree.ts 的 probeCompactRows 明确把「唯一子项是文件」的
目录也标 compact(客户端据此预取并稳定折叠标签),而 bravo 恰好只有一个文件;FileTree.tsx
的 loadLevels(compactLoadTargets(...)) 在**层级缓存变化时**就列了 bravo(根层到货即可触发),
阶段 D 的展开直接命中缓存 → 零请求,但子行确实出现。旧断言
sibling.requests[0] === 'fs.trees[bravo]' 编码的是「展开必然发请求」这条已不成立的前提。
修法:断言改为预取感知——允许 0 或恰好该层级两种取值,且必须同时证明不存在更大范围的
fs.trees 请求(requests.length ≤ 1 且每一条 === 'fs.trees[bravo]'),并要求子行出现
(added ≥ 1);注释写明「零请求是预取命中,不是没展开」以及「预取发生在层级缓存变化时」,
免得后人又把它当 bug 改回去。展开 big(40 子项、非 compact)仍必须恰好发 fs.trees[big]
(防「重列整个可见集」的主守卫保留),tree body 不被替换、socket 不新增、collapse 无
killed rows、拓扑/展开语义等既有守卫一律保留。
门禁(本地,最终状态):
pnpm typecheck → exit 0
pnpm exec vitest run --maxWorkers=3 tests/search-engines.spec.ts tests/fs-search.spec.ts \
tests/fs-tree-compact.spec.ts tests/exclude-patterns.spec.ts → 4 files / 71 tests passed, exit 0
pnpm exec vitest run --maxWorkers=3 → 172 files / 1943 passed | 13 skipped, exit 0
pnpm lint → exit 0
pnpm check:engines → exit 0(本机无 fd:SKIPPED,rg 实跑通过)
未验证:真机 fd(本机未安装,win32 fixture 分支用真实 rg 在同一台机器上端到端验过)与
plugin-mount lane(挂载 lane 需下载真实 DSH + Playwright,未在本地运行,交由 CI 验证)。
Refs #303
Refs #264
2026-10-05 02:58:04 +08:00
..
2026-10-05 02:58:04 +08:00
2026-08-18 20:29:14 +08:00
2026-10-05 02:35:18 +08:00
2026-09-03 20:29:50 +08:00
2026-08-27 21:44:04 +08:00
2026-08-15 00:28:59 +08:00
2026-10-05 02:22:03 +08:00
2026-09-09 11:15:30 +08:00
2026-10-05 02:22:03 +08:00
2026-08-21 23:49:13 +08:00
2026-08-12 18:27:28 +08:00
2026-10-05 02:22:03 +08:00
2026-10-05 02:38:21 +08:00
2026-09-21 20:35:11 +08:00
2026-09-09 23:09:48 +08:00
2026-09-28 18:20:08 +08:00
2026-10-05 02:19:58 +08:00
2026-09-27 22:18:19 +08:00
2026-10-05 02:22:03 +08:00
2026-10-05 02:19:58 +08:00
2026-10-05 02:19:58 +08:00
2026-09-21 20:35:11 +08:00
2026-09-07 18:52:18 +08:00
2026-08-21 01:28:17 +08:00
2026-09-14 00:08:38 +08:00
2026-09-03 12:04:35 +08:00
2026-09-07 23:51:10 +08:00
2026-09-28 00:27:31 +08:00
2026-09-01 23:05:26 +08:00
2026-10-05 01:29:00 +08:00
2026-09-29 17:54:53 +08:00
2026-09-03 17:32:04 +08:00
2026-09-15 10:42:46 +08:00
2026-10-01 17:22:00 +08:00
2026-08-11 11:16:36 +08:00
2026-09-09 15:18:06 +08:00
2026-09-21 02:14:46 +08:00
2026-10-05 01:58:18 +08:00
2026-10-05 02:13:53 +08:00
2026-09-11 15:28:49 +08:00
2026-10-01 17:21:10 +08:00
2026-09-30 01:52:59 +08:00
2026-09-30 01:56:11 +08:00
2026-10-05 02:13:53 +08:00
2026-10-05 02:13:53 +08:00
2026-10-05 02:22:03 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-10-01 17:13:10 +08:00
2026-10-01 17:15:49 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-02 10:55:03 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-09-29 17:04:42 +08:00
2026-08-18 18:05:01 +08:00
2026-09-27 22:18:57 +08:00
2026-08-22 22:50:13 +08:00
2026-09-28 20:37:56 +08:00
2026-10-01 18:41:27 +08:00
2026-10-05 02:37:39 +08:00
2026-10-05 02:13:53 +08:00
2026-10-05 02:13:53 +08:00
2026-08-16 23:35:57 +08:00
2026-09-28 20:37:56 +08:00
2026-09-28 20:37:56 +08:00
2026-10-01 17:26:29 +08:00
2026-10-05 01:58:18 +08:00
2026-10-05 02:41:34 +08:00
2026-10-05 02:41:34 +08:00
2026-09-14 00:08:38 +08:00
2026-10-05 02:19:58 +08:00
2026-10-05 02:19:58 +08:00
2026-09-03 10:42:56 +08:00
2026-10-04 21:47:17 +08:00
2026-09-12 17:30:58 +08:00
2026-10-01 18:41:27 +08:00
2026-10-05 01:54:17 +08:00
2026-09-11 12:02:41 +08:00
2026-09-01 16:01:34 +08:00
2026-09-09 15:18:06 +08:00
2026-09-21 20:35:11 +08:00
2026-09-22 17:09:08 +08:00
2026-09-27 22:18:35 +08:00
2026-09-27 22:18:19 +08:00
2026-08-13 10:26:57 +08:00
2026-09-02 23:15:19 +08:00
2026-10-05 02:22:03 +08:00
2026-08-24 12:05:14 +08:00
2026-08-23 22:02:47 +08:00
2026-09-09 15:18:06 +08:00
2026-09-28 21:21:45 +08:00
2026-09-03 12:04:35 +08:00
2026-09-28 18:08:21 +08:00
2026-08-18 01:22:28 +08:00
2026-09-23 22:24:56 +08:00
2026-08-18 01:22:28 +08:00
2026-09-28 11:09:30 +08:00
2026-10-01 17:25:16 +08:00
2026-10-05 02:19:58 +08:00
2026-09-13 18:36:46 +08:00
2026-09-03 19:59:00 +08:00
2026-10-05 02:22:03 +08:00
2026-10-05 01:53:26 +08:00
2026-09-28 00:27:31 +08:00
2026-09-28 18:08:21 +08:00
2026-09-28 18:20:08 +08:00
2026-09-21 20:35:11 +08:00
2026-09-28 11:17:03 +08:00
2026-10-01 22:05:56 +08:00
2026-10-05 02:22:03 +08:00
2026-08-16 23:35:57 +08:00
2026-09-03 19:59:00 +08:00
2026-09-23 20:46:11 +08:00
2026-09-28 20:37:56 +08:00
2026-10-05 02:13:53 +08:00
2026-09-23 22:36:05 +08:00
2026-09-27 22:18:35 +08:00
2026-09-27 22:18:35 +08:00
2026-09-06 23:46:46 +08:00
2026-10-05 01:55:36 +08:00
2026-10-05 01:55:36 +08:00
2026-09-09 23:09:48 +08:00
2026-10-05 02:22:03 +08:00
2026-10-05 02:58:04 +08:00
2026-08-13 01:39:59 +08:00
2026-09-03 12:04:35 +08:00
2026-09-28 20:11:46 +08:00
2026-10-01 18:41:27 +08:00
2026-08-16 16:24:28 +08:00
2026-09-09 11:15:30 +08:00
2026-09-03 19:59:00 +08:00
2026-09-21 20:35:11 +08:00
2026-10-05 02:13:53 +08:00
2026-09-27 22:18:57 +08:00
2026-10-01 17:08:18 +08:00
2026-09-09 15:18:06 +08:00
2026-09-07 18:52:18 +08:00
2026-10-05 00:56:36 +08:00
2026-10-01 17:18:08 +08:00
2026-10-01 17:17:57 +08:00
2026-09-22 17:09:08 +08:00
2026-10-05 01:41:40 +08:00
2026-10-05 02:13:53 +08:00
2026-10-05 00:53:09 +08:00
2026-09-22 17:09:08 +08:00
2026-09-27 22:19:05 +08:00
2026-09-27 22:18:35 +08:00
2026-09-27 22:18:35 +08:00
2026-09-27 22:18:35 +08:00
2026-09-21 20:35:11 +08:00
2026-09-09 15:18:06 +08:00
2026-10-01 16:03:14 +08:00
2026-09-09 15:18:06 +08:00
2026-09-21 20:35:11 +08:00
2026-09-27 22:18:35 +08:00
2026-09-27 22:19:05 +08:00
2026-10-05 00:54:34 +08:00
2026-09-30 02:24:36 +08:00
2026-09-27 22:19:05 +08:00
2026-09-03 12:04:24 +08:00
2026-09-09 09:05:19 +08:00
2026-10-05 01:58:18 +08:00
2026-10-03 20:54:00 +00:00
2026-10-05 01:42:41 +08:00
2026-09-27 22:18:57 +08:00
2026-08-21 01:28:17 +08:00
2026-10-01 17:18:31 +08:00
2026-09-28 18:20:08 +08:00
2026-08-20 18:28:57 +08:00
2026-08-21 01:28:17 +08:00
2026-09-27 22:18:14 +08:00
2026-09-27 22:18:14 +08:00
2026-10-05 02:22:03 +08:00