Repository navigation
test(group-context): 按阈值自动淘汰用例改为真正覆盖 maxRows 条数淘汰 - #2849
Merged
deepcoldy merged 1 commit intoNov 5, 2026
Merged
Conversation
夹具改用保留窗口内的时间并注入受控 now,避免按年龄分支先把行删光; 断言收紧为 count=20、prunedCount=10,并校验留下的是最新 20 条。 Closes deepcoldy#2818
MoonBall
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
November 5, 2026 10:22
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
|
🚀 Released in v3.57.2 |
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/group-context-store.test.ts中「upsert 会按阈值自动触发淘汰」用例:1000 + i改为保留窗口内的now - i * 1000,并显式注入now,按年龄淘汰分支不再参与;count <= 20/prunedCount > 0收紧为count === 20、prunedCount === 10,并校验留下的正好是最新的 20 条(om_1..om_20);retentionGap断言。为什么
原用例的行龄远超默认 30 天窗口,每次写入都被按年龄分支整批删光(
count=0),count <= 20恒成立,实际没覆盖maxRows条数淘汰。详见 #2818。影响面
仅测试文件,不涉及生产代码。
测试验证
npx vitest run test/group-context-store.test.ts:65 passedbun test test/group-context-store.test.ts(bun 1.4.3):65 pass / 0 failtsc --noEmit:通过pruneGroupContext的按条数分支 → 本用例变红(同时还有另外 3 个 maxRows 用例变红)Closes #2818