Repository navigation
test(event-dispatcher): 撤回消息 reverify 用例改分档推进假定时器,消除高负载时序 flake - #3736
Merged
Merged
Conversation
CI 高负载分片下该用例一次性 advanceTimersByTimeAsync(16_000) 跨完三档 重试梯,撤回终止的微任务链可能来不及落地就被后续档位接续,实测回读 mock 被调 3 次(期望 1 次)。改为与同 describe 重试梯用例同款的 2.5s/7s/16s 分档推进,每档 settle 并断言仍为 1 次,断言更严格。 只改测试,生产链路静态保证撤回消息首次回读即走 elsewhere 终止。 Closes #3735 Co-Authored-By: Claude Fable 5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 23, 2026 12:27
deepcoldy
commented
Nov 23, 2026
deepcoldy
left a comment
Owner
Author
There was a problem hiding this comment.
复审结论:代码侧可合,未发现需要修改的问题;剩余合入条件是 CI 首跑全绿。
- 核对 head:
772e82d66492b5ed6d8868868e7acbfb3b843163,仅test/event-dispatcher.test.ts11 additions / 1 deletion,零生产代码改动。 - 分档实际覆盖 2.5s → 4.5s → 9s,每档
settle()后都断言回读仍为 1 次;最终继续断言 pending 为 0、未派发、无放弃告警。没有放松原断言,反而覆盖了每个重试档边界。 - 与同 describe 的假定时器节奏一致;撤回消息仍在首次
'elsewhere'终止时,后续任意档位出现额外回读都会立即失败。 - 本地用 PR 的精确测试文件执行
bunx vitest run --project unit test/event-dispatcher.test.ts --maxWorkers=2:758/758 通过。
发布时 CI 首跑仍处于 queued,未把代码通过误报为 CI 已通过。
This was referenced Nov 23, 2026
|
🚀 Released in v3.59.30 |
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/event-dispatcher.test.ts的「撤回消息一次回读即终止、不发放弃告警」用例,把一次性vi.advanceTimersByTimeAsync(16_000)跨完三档重试梯,改成与同 describe 重试梯用例同款的分档推进(2.5s → 7s → 16s),每档后settle()并断言回读 mock 仍只被调用 1 次。只改测试,不碰任何生产代码,11 行改动。为什么
CI run https://github.com/deepcoldy/botmux/actions/runs/45157132340/job/137632833768 的
test (1/4)分片该用例间歇失败:expected "vi.fn()" to be called 1 times, but got 3 times(失败发生在 job 启动后 18s 的 import 高峰,分片总时长 1400s)。判定为测试时序问题而非生产缺陷,依据:
runMentionReverifyReadback对撤回行(deleted=true、无 mentions、正文无@_user_N占位符)静态保证mentionSettledElsewhere恒真,首次回读必走'elsewhere'终止并释放 pending,链式重试不会被排定;真实定时器档间间隔 4.5s/9s,不存在跑完三档的时序。分档后每档都断言调用次数为 1,比原单步断言更严格,不是放松测试。
影响面
验证
bun run build(tsc)通过bunx vitest run --project unit test/event-dispatcher.test.ts:758/758 通过'elsewhere'终止改成'retry',硬化后的用例在第一档即咬红;还原后恢复全绿Closes #3735
🤖 Generated with Claude Code