Embed mobile bridge adapter and add Platform backend abstraction#73
Embed mobile bridge adapter and add Platform backend abstraction#73dominicletz wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the library to introduce a unified Desktop.Platform abstraction layer with dedicated backends for Wx, JSON bridge, and Browser-based environments, enabling compilation and execution on mobile and headless targets without OTP :wx. The review feedback highlights several critical reliability and concurrency issues: synchronous TCP connections in init/1 and blocking reconnection loops in Desktop.Bridge.Transport can block the GenServer indefinitely; delegated callbacks in Desktop.Platform.Server do not properly wrap standard GenServer return tuples, risking state corruption; and using spawn_link/1 to run external commands in Desktop.Backend.Wx can crash the main GUI process upon failure.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Connect to the mobile bridge asynchronously on startup, use non-blocking reconnect retries, wrap delegated GenServer return tuples in Platform.Server, and avoid spawn_link when raising macOS windows. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Desktop.Platformlayer with domain behaviours (Window, Content, Notification, Media, System) routed to three backends:Desktop.Backend.Wx,Desktop.Backend.Json, andDesktop.Backend.BrowserDesktop.Bridge.Transport, removing the separate{:wx, hex: :bridge}dependency on Android/iOSconfig :desktop, :backend, :auto | :wx | :json | :browseroverride, menu adapters for Json/Browser, compile-time wx stubs for builds without OTP:wx, and expanded test coverage (mix test.fast,mix test.wx,mix test.guard)Test plan
mix test.fast— fast tests without wxxvfb-run -a mix test.wx— wx backend testsmix test.guard— platform abstraction regression guardsmix lint— compile, format, credo, dialyzerBRIDGE_PORTagainst a native hostNO_WX=1on headless LinuxMade with Cursor