Skip to content

Embed mobile bridge adapter and add Platform backend abstraction#73

Open
dominicletz wants to merge 6 commits into
mainfrom
feat/platform-backends-and-mobile-bridge
Open

Embed mobile bridge adapter and add Platform backend abstraction#73
dominicletz wants to merge 6 commits into
mainfrom
feat/platform-backends-and-mobile-bridge

Conversation

@dominicletz

Copy link
Copy Markdown
Collaborator

Summary

  • Introduces a Desktop.Platform layer with domain behaviours (Window, Content, Notification, Media, System) routed to three backends: Desktop.Backend.Wx, Desktop.Backend.Json, and Desktop.Backend.Browser
  • Embeds the mobile JSON/TCP bridge as Desktop.Bridge.Transport, removing the separate {:wx, hex: :bridge} dependency on Android/iOS
  • Adds optional config :desktop, :backend, :auto | :wx | :json | :browser override, 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 wx
  • xvfb-run -a mix test.wx — wx backend tests
  • mix test.guard — platform abstraction regression guards
  • mix lint — compile, format, credo, dialyzer
  • Verify mobile Json backend with BRIDGE_PORT against a native host
  • Verify Browser backend with NO_WX=1 on headless Linux

Made with Cursor

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/desktop/bridge/transport.ex
Comment thread lib/desktop/bridge/transport.ex
Comment thread lib/desktop/platform/server.ex
Comment thread lib/desktop/backend/wx.ex Outdated
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant