refactor(mobile-remote): add platform adapter boundary - #1220
Draft
beruro wants to merge 1 commit into
Draft
Conversation
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.
Problem
Mobile Remote currently mixes shared chat/session behavior with browser-only globals for OAuth, Web Storage, WebSocket construction, timers, visibility, navigation, and randomness. That prevents a lightweight Tauri iOS shell from reusing the proven Web Remote UI and reducers without copying logic. The synchronous browser implementation also hides async Keychain/config races and keeps an established relay socket alive while the app is backgrounded.
Solution
Introduce an injected
MobileRemotePlatformboundary with runtime, auth, connection, and client-identity ports. Both browser entry points now render the same platform-neutralMobileRemoteRoot; browser OAuth/storage/socket behavior lives only underplatform/browser.Move timer, visibility, UUID, persistence, and socket ownership behind the port while preserving the existing Desktop EventStore, round, event, and tool identity model. Serialize connection writes, generation-guard slow bootstrap and commits, sequence logout cleanup after stale auth work, close foreground sockets while hidden, reconnect once on visibility return, and reject stale socket close events. Missing server permission tiers now fail closed to read-only.
Add static import-boundary tests plus lifecycle and race coverage for async storage, auth logout, background transport release, reconnect ownership, RPC bounds, and exact initialize/send wire shapes.
Potential risks
WebSocketcontract for v1; a future native socket requirement would need a narrower transport interface.Verification
pnpm typecheck— passedpnpm lint— passed, including oxlint and ESLint with zero warningspnpm test -- src/modules/MobileRemote src/mobileRemoteEntry.test.ts src/modules/AppLogin/index.test.ts src/router/guards/AuthGuard.test.ts --reporter=dot— 33 files, 153 tests passedpnpm build— passed; webpack compiled successfullygit diff --check origin/junyu/mobile-remote-control...HEAD— passedNo screenshot is attached because this PR is an environment-boundary refactor with no intended visual change. Native iOS visual and real-device evidence belongs to the shell PR.
Audit
docs/architecture/mobile-remote-platform-boundary.mdStack
Base: #1150 (
junyu/mobile-remote-control)Next: Tauri iOS shell, OAuth callback, Keychain pairing, and device list.