Repository navigation
Conversation
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR changes the production mobile connection adapter to share connectivity and wakeup observation across environment supervisors, altering native listener lifetimes, event fan-out, and resume handling. Although the extensive tests cover the intended lifecycle cases, the cross-environment runtime semantics are substantial enough for human review. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared connectivity and wakeup streams apps/mobile/src/connection/platform.ts, apps/mobile/src/connection/platform.test.ts |
The platform provides shared connectivity and wakeup streams with unbounded buffering and no replay. Tests cover shared native acquisition, late readers, event ordering, cleanup and reacquisition, read failures, and reader delivery. |
Per-connection resume classification apps/mobile/src/connection/platform.ts, apps/mobile/src/connection/platform.test.ts |
Application-active wakeups are acquired per connection and merged with shared wakeup changes. Tests cover short and long resumes and readers joining while the app is backgrounded or inactive. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Possibly related issues
- pingdotgg/t3code issue 24796 — The change shares native listeners and status reads, which relates to the issue’s concern about unnecessary Android client work. The change does not establish an effect on battery use.
Possibly related PRs
- pingdotgg/t3code#24783 — Both PRs change mobile connection lifecycle wakeups and use AppState behavior.
- pingdotgg/t3code#19426 — Both PRs change application-active wakeup behavior and rely on wakeup classification.
Suggested labels: size:M
Suggested reviewers: macroscopeapp
Merge Risk: 
Minimal · up to b6184
-
The shared observations are wired into the mobile runtime, with no identified issue that needs resolution before merging.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description includes all required sections and clearly explains the problem, implementation, scope, verification results, measured impact, limitations, and related work. It links issue
#189and explains the focused scope, although it does not include an explicit maintainer approval comment.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Problem
Each mobile environment independently acquires connectivity and network-path observation. With several environments, the same native event fans out through duplicate registrations and repeats network-state reads on resume.
Change
Share live connectivity and account/path changes within the mobile runtime, with reference-counted acquisition, no replay and no idle grace. Keep status reads fresh and application resume timing local to each subscriber, so a newly opened connection retains its own probe/reconnect decision. Final release removes observation; later readers acquire it again.
Scope and approval
This is a focused reduction of duplicate work in the existing mobile connection adapter. It adds no setting, protocol or retry policy. Audit tracker: #189.
Verification
CI=true vp run check:changed f0dd86f16482595c6cfffe0ac64dc12bffb634f9: passed, including affected typecheck and all ten focused tests.The same harness also checks one and three supervisor-shaped readers. Every current reader receives the expected short-resume and path-change events, and final scope release leaves zero registrations. Fresh startup status reads are excluded from this count. These are JS API calls and registrations, not independent OS monitors or physical battery measurements.
A separate probe runs the actual
EnvironmentSupervisor.makewith a healthy mocked transport. A connection opened one second before resume stays open and receives a health probe on both baseline and candidate:Native APIs and transport are mocked; device, full-registry and physical-energy behavior were not measured. No visible UI change is intended. Independent review ran against the preceding base; the only intervening upstream change is a web callback fix, and the full contribution bytes remain unchanged.
The separate Android lifecycle work in #24783 remains unmerged. When combining it, its fresh suspension read and per-subscriber initial reconciliation must remain local alongside application resume classification, outside the no-replay share. This PR does not establish combined-stack correctness.
Implemented and independently reviewed in separate GPT-6.1 Sol/high sessions through Codex in T3 Code.