fix(mobile): 限制首页过期快照的无界重拉 - #3729
Draft
sakiko-toyokawa wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Codex <codex@users.noreply.github.com>
sakiko-toyokawa
marked this pull request as ready for review
September 1, 2026 07:59
|
| Filename | Overview |
|---|---|
| apps/mobile/app/devices/index.tsx | 为会话快照失效后的尾随重拉加入计数上限、指数退避、单次调度保护和状态收口。 |
| apps/mobile/src/tests/homeDesktopFirst.test.ts | 更新 Home 同步源码契约断言,以反映新增的重拉上限、退避和 idle 状态处理。 |
Reviews (2): Last reviewed commit: "fix(mobile): bound stale home hydration ..." | Re-trigger Greptile
Comment on lines
+519
to
523
| expect(source).toContain("updateDeviceConnectionState(device.deviceId, 'idle');"); | ||
| expect(source).toContain('setTimeout(() => {'); | ||
| expect(source).toContain('homeDeviceSyncLimiterRef.current.run'); | ||
| const hydrateSource = source.slice( | ||
| source.indexOf('const hydrateDeviceSessions = useCallback'), |
There was a problem hiding this comment.
这些新增断言只验证限次、退避和 setTimeout 等源码片段存在,没有执行连续快照失效、计数传递和定时器调度;控制流回归后测试仍能通过,无法防止无界重拉问题再次出现。建议使用 fake timers 和可控的 hydrate 结果验证最多两次尾随重拉、100/200ms 退避以及最终 idle 收口。
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/src/__tests__/homeDesktopFirst.test.ts
Line: 519-523
Comment:
**重拉调度仅做源码断言**
这些新增断言只验证限次、退避和 `setTimeout` 等源码片段存在,没有执行连续快照失效、计数传递和定时器调度;控制流回归后测试仍能通过,无法防止无界重拉问题再次出现。建议使用 fake timers 和可控的 hydrate 结果验证最多两次尾随重拉、100/200ms 退避以及最终 idle 收口。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
sakiko-toyokawa
marked this pull request as draft
September 1, 2026 08:04
DavidShenXD
marked this pull request as ready for review
September 1, 2026 10:15
DavidShenXD
marked this pull request as draft
September 1, 2026 10:16
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.
这次改了什么
摘要
修复 Mobile 首页设备会话全量快照在持续收到
sessions推送时可能形成的无界尾随重拉。v0.1.70 诊断报告已经确认:快照拉取期间 mutation epoch 一旦失效,原实现会立即再次执行
local-db:sessions:list,没有退避和次数上限。桌面端有活跃流式消息时,连续的sessions:patched/ usage 推送可能让这条路径反复执行,叠加分组切换的大量行重挂载后造成 Android JS/UI 线程压力、卡顿,甚至 ANR。本 PR 不把该缺陷表述为已确认的唯一根因,只收敛代码已直接证明的无界 rerun 风险。
修补措施
rerunScheduled防护,同一 in-flight entry 只调度一次尾随任务。idle,避免 UI 永久停留在“同步中”。变更类型
fix缺陷修复范围
Fixes #3728
UI 变化
怎么验证的
自动验证
手工验证
尚未在报告中的 M2007J1SC(小米 10 青春版)或同等级 Android 真机上验证。该项必须在正式发布前完成。
未执行的验证
风险
风险分类
影响与回滚
正式发布前的下一步
local-db:sessions:list调用次数。SwipeableSessionRow替换为 plain View,用于确认 Expo 57 / RN 0.86 / RNGH / Reanimated 栈下的单行挂载成本回归。提交前检查