Repository navigation
test(sandbox): 真实进程握手等内容完整再读,消除 credential/strict-env 两处 CI flake - #1934
Merged
Merged
Conversation
与 #1926 同族:被测子进程用 shell 重定向/truncate-write 发布结果, 先建空文件、字节稍后落地;测试侧轮询到文件「存在」即立刻消费内容, CI 高负载读到建文件与写入之间的空窗。 - credential-only-send-authority: waitForFile 改为等到内容非空再返回 (调用方仍对具体值 toBe,错值/泄漏照旧确定性红,只越过空窗); 修 CI flake: expected 'unset'/outbox 路径,实得 ''。 - strict-env-process: report 把 JSON.parse 纳入 waitFor 谓词,等报告 可解析再断言(key=false 可解析,仍由逐键断言精确捕获); 修 bun-test flake: JSON.parse Unexpected EOF。 纯测试、零生产码。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 14, 2026 16:28
…view-pr-1934-cd # Conflicts: # test/strict-env-process.test.ts
|
🚀 Released in v3.45.0 |
This was referenced Oct 26, 2026
deepcoldy
pushed a commit
that referenced
this pull request
Nov 5, 2026
复审 P3:条目原写「新建 helper」会催生第三份逐字拷贝——strict-env-worker.integration.test.ts:30 与 session-env-worker.integration.test.ts:26 已有相同的 waitForJsonReport(注释引 #1934/#2386),credential-only-send-authority.test.ts:336 有纯文本变体 waitForFile;改为要求抽公共件时收编这三处并统一超时语义(null 返回 vs undefined/抛错)。补入同形竞态的 CI 咬红史对照(config-dir 注释、#1934、#2386)。校准三处行号:kimi 注释 46-51、worker-tmux-pane-launch 注释 71、kimi 竞态注释 16-17;补记已闭合的 codex-actor-launcher 85-86。仅文档。 Co-Authored-By: Claude Code <[email protected]>
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.
改了什么 / 为什么
#1926 合入后的 master push CI 又暴露两处真实进程握手 flake(不同用例,但与 #1926 同族)。均为纯测试竞态、零生产码:被测子进程用 shell 重定向 /
fs.writeFileSync(truncate-write,非 rename 原子)发布结果——先建空文件、字节稍后落地,测试侧轮询到文件「存在」就立刻消费内容,CI 高负载读到建文件与写入之间的空窗。test/credential-only-send-authority.test.ts(vitest 分片实红)waitForFile一存在即readFileSync返回:expected '' to be 'unset'(outbox 路径那处同理)。改为等到内容非空再返回;调用方对具体值的toBe不变,错值/泄漏照旧确定性红,只越过空窗。test/strict-env-process.test.ts(bun-test 分片实红)report先vi.waitFor(existsSync)、再在 waitFor 外JSON.parse(readFileSync),空文件 →SyntaxError: Unexpected EOF。把 parse 纳入 waitFor 谓词,等报告可解析再断言;key === false仍可解析,由逐键断言精确捕获,不会把真隔离问题拖成超时。其余文件里的
existsSync等待只用于 ready/go 等信号文件、不读内容,不是本类 flake 源,未改动。测试验证(真实 tmux/bwrap/bun 进程)
变异(把生产者放大成「建空文件 → sleep 0.5s → 再写内容」):
expected '' to be 'unset';保留新 helper + 宽窗口 → 绿;Unexpected EOF(含 CI 红的 zmx 用例);保留新 report + 宽窗口 → 7/7 绿。bun run build通过;改动行无新增 tsc 错误(该测试文件 master 上既有一条 unused-import,与本 PR 无关,未顺带改)。非回归:两处文件在 #1926 父提交(不含其改动)上行为一致;#1926 只动另外两个测试文件(vitest/bun 按文件独立运行时隔离)。
影响面:仅 2 个 linux 真实进程测试文件,不改生产代码,其它 CLI/后端/平台不受影响。
🤖 Generated with Claude Code