Repository navigation
test(reports): wait for post-rebuild refreshes before checking increments - #40
Merged
Merged
Conversation
…ents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
问题
tests/view-service.test.ts中「a price change rebuilds in the background…」偶发失败(近 100 次 CI 中 2 次,2026-09-28 的 CI 与 0.9.11 的 Release),都停在最后一步:写入第二条用量后报表计数一直为 1。价格重建完成后,缓存里的查询按最近使用顺序逐个刷新。测试只等到了分页查询刷新完毕,默认查询可能仍在刷新。此时写入增量并读取,读取遇到进行中的刷新不会再发起刷新,而进行中的刷新可能已在写入前读过数据库;之后的观察读取(
refresh=false)也不触发刷新,所以等待多久都停在 1。失败日志中重建在 29.527 秒完成,随后 2 秒内没有任何刷新,与此吻合。产品侧没有丢数:页面的定时刷新和下一次读取都会补上,最多晚一个刷新周期。
改动
写入增量前,等默认查询也换成新价格版本且不在刷新中,再验证增量。断言没有放宽。
验证
bun test tests全部通过;该文件连续运行 10 次无失败。🤖 Generated with Claude Code