Repository navigation
test(terminal): 写删 dashboard secret 的测试在围栏没生效时拒跑 - #2976
Merged
Merged
Conversation
test/terminal-url.test.ts 与 test/worker-terminal-read-auth.integration.test.ts 会写入并删除 dashboardSecretPath()(由 homedir() 推导)。2026-11-06 一次绕过 setupFiles 的 vitest 全量运行(0 字节配置)里,这两处写删落在了真实的 ~/.botmux/.dashboard-secret 上,决策看板和会话内 botmux board 因此失效。 - 两个文件都以 require-fenced-data-dir 作为第一个 import:围栏没执行时整文件拒跑; - 写/删 secret 一律走 fencedSecretPath():路径不在本文件的测试围栏里就抛错。 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
Owner
Author
|
已合并,感谢 🙏 一个复审中实测发现的同类既存面,供后续围栏加固系列跟进(不影响本 PR):
PR 描述「同类线索」一节列的其余文件(opencode hook 安装测试、codex 历史/会话写入、recall-frozen-cards 的 ~/.claude/projects、两个 durable 测试的 ~/temp)也建议一并纳入后续覆盖。 |
|
🚀 Released in v3.58.0 |
This was referenced Nov 7, 2026
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/terminal-url.test.ts和test/worker-terminal-read-auth.integration.test.ts会写入并删除dashboardSecretPath()。这个路径由homedir()推导,平时由 unit-setup / bun-test-fence 围到临时 HOME。那次运行里它指向了真实的~/.botmux/.dashboard-secret:terminal-url.test.ts先用测试值覆盖它,用例结束再删掉。之后:daemon IPC secret is missing or empty;botmux board …报origin_unproven。改了什么(只改测试)
./helpers/require-fenced-data-dir.js(fix(vc-meeting): 读文件出错不再误隔离会议状态,普通 @ 消息不再因此丢弃 #2937 引入)作为第一个 import:围栏没执行时,整个文件在加载阶段就拒跑。fencedSecretPath():路径不在本文件的测试围栏(__TEST_DATA_DIR_FENCE)里就抛错,不读也不写。影响面
只改这两个测试文件,生产代码不变。围栏正常时行为不变。
验证
npx vitest run --project unit test/terminal-url.test.ts test/worker-terminal-read-auth.integration.test.ts:34/34 通过。bun test --timeout=180000 ./test/worker-terminal-read-auth.integration.test.ts:5/5 通过。terminal-url.test.ts在裸bun test下报importOriginal is not a function,未改动的 master 上同样如此,是既有现象。test/test-hygiene.test.ts:通过。事故场景对比:用 0 字节 vitest 配置、在临时 HOME 下运行(HOME 里预先放一个哨兵 secret):
拒跑信息:
refusing to run: data-dir fence not active (__TEST_DATA_DIR_FENCE=<unset>, …)。同类线索(未在本 PR 处理)
同一次运行里还有这些测试往真实 HOME 写过东西,都已从线上目录清理:
~/.config/opencode/plugin/botmux-ask.js;worker-codex-model-migration-picker.integration:~/.codex/history.jsonl、~/.codex/sessions;recall-frozen-cards:~/.claude/projects;durable-lark-canonical-dispatch/durable-session-primary:~/temp;🤖 Generated with Claude Code