fix(macOS): 根治测试同步阻塞导致的 CI 超时 - #284
Merged
Merged
Conversation
Collaborator
Author
|
@lithe review |
Contributor
Lithe Review结论: ✅ 未发现明确问题(LGTM) 验证
|
Collaborator
Author
|
@lithe review |
Contributor
Lithe Review结论: ❓ 审查未完成 审查状态: |
Owner
|
ci也合到preview 我晚上合main |
Collaborator
Author
codex 给我自动推到 preview 了,我本来没打算推 main 的 |
1lck
reviewed
Aug 27, 2026
1lck
reviewed
Aug 27, 2026
1lck
reviewed
Aug 27, 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.
问题
macOS 测试与进程适配层存在多种会放大为 CI 卡死的同步边界:
Task.detached承载,可能占满 Swift cooperative executor。SIGTERM,随后仍可能无限等待忽略信号的子进程。SIGPIPE,直接终止测试进程。修改内容
测试同步与任务调度
TestGate,相关测试通过defer保证释放。macOS 进程生命周期
TestProcess,支持启动前取消、5 秒超时、SIGTERM后升级SIGKILL,continuation 只恢复一次。TestProcess和MacProcessRunner使用异步持续排空输出与有界 EOF 收尾,不再同步读取到 EOF。MacProcessRunner的 stdin 写入移到 GCD worker,使主线程仍能执行超时;超时后有界等待并强制终止。MacProcessRunner、MacRawProcessSession、MacStreamingProcess对输入管道启用F_SETNOSIGPIPE,把管道关闭转为普通写入错误。SIGTERM无效后升级为SIGKILL;手动停止也安排有界强制终止。CI 隔离
GitStatusObservationTests拆到独立 Swift 测试进程,隔离文件监听与 Git 子进程生命周期。静态审计
macos/Sources与macos/Tests中已无:waitUntilExit().wait()readDataToEndOfFile()剩余 semaphore、condition 和轮询均有明确的 200ms–5s 截止时间。新增补修全部位于
macos/。验证
SIGTERM、1 MiB 未消费 stdin、SIGPIPE 防护与强制终止。./scripts/verify-service-boundaries.sh通过。git diff --check通过。本 PR 仅修复 macOS,不修改 Windows/Rust,不修改 #269/#270,也不改写现有 Git 历史。