Mobile host: share the duplicated panel-stream session/coordinator shape - #10417
lawrencecchen wants to merge 2 commits into
Conversation
The browser and simulator stream stacks repeat the same shapes inside each file. Fold the repeats into one helper per file, with wire topics, payload shapes, and pacing untouched: - MobileSimulatorStreamCoordinator: one releaseOwnership(_:recording:) now owns the ownership-release + closed/stopped lifecycle record that stop, connectionClosed, and sessionEnded each duplicated, and local recordStream/currentOwnership wrappers replace eight 6-9 line MobileSimulatorDiagnostics call blocks (241 -> 202 lines). - MobileSimulatorStreamSession: a recordFrame wrapper binds the session's panelID for the seven frame-lifecycle records. - MobileBrowserStreamSession: scheduleAfter(_:_:) is the single bounded, cancellable sleep-then-act task that scheduleDeadline, scheduleIdleReconciliation, and scheduleStateEmission each inlined. Diagnostics keep identical event payloads; the only reorder is a lifecycle record now emitted before a cache prune that records nothing.
…ve deadline
The browser and simulator stream coordinators each declared an identical
private SessionKey {connectionID, panelID}. One file-scope
MobileStreamSessionKey (in MobileBrowserStreamCoordinator.swift, no new
pbxproj entry) now keys both session tables; call sites rename only.
MobileBrowserStreamSession.scheduleIdleReconciliation duplicated
scheduleDeadline except for one pacing.requestSettleReconciliation()
call, so scheduleDeadline gains a reconcile flag and the .idle case
passes idleReconcileInterval directly. Topics, payloads, and pacing
are untouched.
The audited cross-file candidates that would not pay were left alone:
the connectionClosed sweep helper (~9 lines for 4 deleted; the
simulator adds per-item ownership release plus a post-loop prune), the
stop(sendClosed:) shells (task sets, teardown, encoders, event types,
and topics all differ), and a shared single-flight loop type (~28
lines plus pbxproj registration against ~20 deleted, with different
drain gating between the two loops).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe mobile stream coordinators now share session keys. Browser sessions centralize cancellable deadline scheduling. Simulator coordinators and sessions centralize ownership, lifecycle, and frame diagnostics. ChangesMobile stream coordination
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR consolidates duplicated mobile panel-stream bookkeeping without reported contract changes or actionable merge-blocking risk; it is merge-ready after normal checks and review. Possibly related PRs
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (23 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Extracts the panel-stream session bookkeeping that the mobile host duplicated per stream kind into one shared session/coordinator shape, and folds the idle reconcile pass into the existing drive deadline instead of a separate path. Wire formats, event topic names, and JSON keys are unchanged. Net delta from git diff origin/main...HEAD --shortstat: 4 files changed, 112 insertions(+), 170 deletions(-).
Part of the mobile-sync rip-out wave 1.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Shares the duplicated mobile panel-stream session bookkeeping and routes idle reconciliation through the existing drive deadline to reduce code and keep behavior stable. Wire topics, payloads, pacing, and JSON keys are unchanged.
MobileStreamSessionKeyreused by both browser and simulator coordinators; removes per-fileSessionKey.MobileBrowserStreamSession, introducesscheduleAfter(...)and uses it for cadence/settle, idle reconciliation, and state coalescing;.idlenow schedulesscheduleDeadline(..., reconcile: true)instead of a separate task.releaseOwnership(_:recording:)andrecordStream/currentOwnershiphelpers; in session, addsrecordFrame(...). Diagnostics payloads are identical; one lifecycle record now emits before a no-op cache prune.Written for commit e7497b9. Summary will update on new commits.
Summary by CodeRabbit
Reliability Improvements
Diagnostics