Repository navigation
test(cli-adapters): 写 ~/.botmux 的适配器测试在围栏没生效时拒跑 - #2977
Merged
Merged
Conversation
test/cli-adapters.test.ts 有用例会写 homedir() 推导的目录: materializePiTurnBoundaryExtension() 写 PI_PLUGIN_DIR/extensions,dsh question bridge 用例写 ~/.botmux/dsh-question-bridge。2026-11-06 一次绕过 setupFiles 的 vitest 全量运行(0 字节配置)里,这两处写入落在了真实的 ~/.botmux 下。 - 以 require-fenced-data-dir 作为第一个 import:围栏没执行时整文件拒跑; - pi 扩展用例写入前确认 PI_PLUGIN_DIR 在本文件的测试围栏里。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 6, 2026 22:39
|
🚀 Released in v3.58.0 |
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.
背景
2026-11-06 16:13–16:17,一次 vitest 全量运行绕过了仓库的全部测试围栏:配置文件是 0 字节,没有 setupFiles,HOME 也没有被重定向。
test/cli-adapters.test.ts里有两类用例会写由homedir()推导的目录:materializePiTurnBoundaryExtension()写PI_PLUGIN_DIR/extensions/pi-turn-boundary-extension.js。PI_PLUGIN_DIR在模块加载时就算好了,即~/.botmux/pi-skills。~/.botmux/dsh-question-bridge/<hash>/,内容里引用了跑测试那个 worktree 的源码路径。那次运行把这两处都写进了真实的
~/.botmux下。改了什么(只改测试)
./helpers/require-fenced-data-dir.js(fix(vc-meeting): 读文件出错不再误隔离会议状态,普通 @ 消息不再因此丢弃 #2937 引入)作为第一个 import:围栏没执行时,整个文件在加载阶段就拒跑。这一条覆盖文件里所有写 HOME 的用例。PI_PLUGIN_DIR落在本文件的测试围栏里。影响面
只改这一个测试文件,生产代码不变。围栏正常时行为不变。
验证
npx vitest run --project unit test/cli-adapters.test.ts:498 passed、3 failed、2 skipped。失败的 3 条和未改动的 master 完全一致,都是本机已知的 dsh question bridge 宿主环境问题,与本改动无关。bun test --timeout=180000 ./test/cli-adapters.test.ts:同样 498 pass、3 fail,与 master 一致。事故场景对比:用 0 字节 vitest 配置、在临时 HOME 下运行本文件,跑完看临时 HOME:
pi-skills/extensions/…jsdsh-question-bridge/🤖 Generated with Claude Code