Repository navigation
fix(test): dashboard-ipc-probe 不再假定被占端口 +1 一定空闲 - #2941
Merged
Merged
Conversation
startIpcServer 的约定是 EADDRINUSE 时向上找下一个空闲端口。用例先在随机临时 端口上起第一个 IPC server,再断言第二个恰好落在 +1——共享 runner 上 +1 可能已被 无关 socket 占用,CI 的 bun-test 因此出现 Expected 36542 / Received 36543。 改为断言「比被占端口大、且在 DEFAULT_PROBE_SPAN 之内」。复现:人为占住 +1 时 旧断言失败、新断言通过;把探测去掉(maxProbe=0)时新断言仍然变红。 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 12:44
|
🚀 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.
改了什么
test/dashboard-ipc-probe.test.ts的断言从「第二个 IPC server 恰好落在被占端口 +1」改为「端口比被占端口大,且在DEFAULT_PROBE_SPAN之内」。只改测试,不改 src。为什么
startIpcServer的约定是:遇到 EADDRINUSE 时向上找下一个空闲端口,不保证一定是 +1。用例的第一个 server 绑在随机临时端口上,共享 runner 上 +1 可能已经被无关 socket 占用。#2937 的 bun-test 就是这样红的:Expected: 36542 / Received: 36543,也就是 +1 被占用、实际落在了 +2。这是测试本身的偶发问题,与 #2937 的改动无关。按合码标准,挡在 PR 上的偶发要先另开 PR 根治,所以单独提这个 PR。影响面
只改了一个测试文件,生产代码和行为都不变。
验证
bunx vitest run --project unit test/dashboard-ipc-probe.test.ts:1/1 通过;bun test test/dashboard-ipc-probe.test.ts:0 fail。first.port + 1再起第二个 server。旧断言toBe(first.port + 1)失败,和 CI 的失败形态一致;新断言通过。临时用例已删除。startIpcServer改成不向上探测(maxProbe: 0),新断言仍然变红,报listen EADDRINUSE。🤖 Generated with Claude Code