Repository navigation
perf(mobile): trust healthy session tab streams - #10134
Conversation
b1123ed to
2dd97f7
Compare
📝 WalkthroughWalkthroughAdds a mobile session-tab reconciliation controller and React hook for stream subscriptions, list polling, recovery, generation fencing, and application-revision handling. Session screens now use the hook and shared accepted-result effects for browser focus and markdown staleness. Tests cover reconciliation, lifecycle transitions, recovery, and subscription stability. Relay RPC streams now deliver connection and RPC failures to listeners and prevent late callbacks after cancellation or cleanup, with corresponding tests. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b5b9857e-bd4d-4cba-84b7-d8f9921893c9
📒 Files selected for processing (10)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/session/mobile-session-startup-source.test.tsmobile/src/session/mobile-session-tabs-accepted-effects.test.tsmobile/src/session/mobile-session-tabs-accepted-effects.tsmobile/src/session/mobile-session-tabs-stream-health.test.tsmobile/src/session/mobile-session-tabs-stream-health.tsmobile/src/session/use-mobile-session-tabs-reconciliation.test.tsmobile/src/session/use-mobile-session-tabs-reconciliation.tsmobile/src/transport/mobile-relay-rpc-streams.test.tsmobile/src/transport/mobile-relay-rpc-streams.ts
Description
session.tabs.subscribeonly after an accepted fullupdatedframe or alist request physically begun after the subscription snapshot.
session.tabs.listfallback while thatstream is certified and no close/browser recovery is pending.
requirement, route lifetime, and accepted-application revision; coalesce one
physical request cohort while preserving a required post-mutation trailing list.
tombstone-filtered snapshots.
Keep
terminal.list, unsubscribe behavior, and terminal lifetime handlingunchanged.
ELI5
The phone used to ask the desktop for the whole tab list every two seconds even
while the desktop was already sending every tab change live. It now stops the
duplicate question only after proving the live feed is trustworthy. If the feed
ends, reconnects, or local close/focus work is unfinished, the old safety poll
automatically resumes.
Proof of zero regression
platform/integration reviews found no remaining issues.
git diff --checkpassed.initial snapshot creates a new barrier, the old result is discarded, and a
distinct post-snapshot list must apply. An accepted full
updatedframe maycertify immediately.
rejected snapshots, and results superseded by any accepted application cannot
mutate current UI state.
mutation requirement arrives during the request, that promise remains pending
until its one trailing physical list settles; failures wait for the next tick
rather than spinning.
foreground resume, reconnect, and stable connected-to-connected generation
cutover invalidate prior health and reconcile immediately or on the current
generation's next frame/tick.
focus resolves from either list or stream effective tabs. Rejected snapshots
perform no browser, markdown, tombstone, or reconciliation side effects.
{ type: 'error', message, error }frame and fence late callbacks. Existingunsubscribe behavior is unchanged for mixed-version compatibility.
contract. The change adds no host path, process, Git, shell, or native-module
assumptions.
60 tests skipped by the existing suite.
orca-clirevision-9append-only manifest blocker after oxlint, switch-exhaustiveness, reliability,
max-lines, and bundled-guide checks pass. Direct localization catalog and
coverage checks also pass. This diff changes no skill files.
Proof of performance improvement
60 seconds:
session.tabs.list+ 30terminal.listRPCs.session.tabs.list+ exactly 30terminal.listRPCs.listMobileSessionTabsexecutions per focused idle minute.none after accepted expiry processing.
requirement creates one trailing physical list instead of parallel duplicates.
inventories: the justified
terminal.listrequest intentionally remains everytwo seconds.
deterministic production-hook request budget plus transport/controller tests.