refactor(desktop): effect-electron-ipc PoC#2563
Conversation
- Wire Effect RPC client/server over Electron preload and main IPC - Add in-memory tests for unary and streaming round-trips - Define shared IPC envelope and desktop POC protocol
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
- Move the core IPC protocol and transport helpers into a library layout - Add Electron and browser example entrypoints for the RPC PoC - Update the proof-of-concept test to exercise the end-to-end example
- Split the Electron example into dedicated main, preload, renderer, and RPC server modules - Update the POC to create a real BrowserWindow and render the RPC snapshot
- Move the Electron IPC bridge and protocol helpers into `effect-electron-rpc` - Update the desktop POC to consume the new shared package - Add transport coverage for renderer/main round-tripping
- Rename the workspace package and update all imports - Update the desktop IPC proof-of-concept to use the new transport name
- Extract the effect-electron IPC PoC RPC schemas and group into `packages/contracts` - Update the desktop example to import shared contracts and add the web renderer example - Wire in the `effect-electron-ipc` dependency for the web app
- Load the renderer bridge from `globalThis` instead of passing it through helpers - Simplify the snapshot/client APIs and update the test harness accordingly - Align the web example atoms with the new effect-based client wiring
- Add a typed echo error to the IPC contract and server - Migrate the desktop/web POC to AtomRpc-backed queries and mutations - Add coverage for round-tripping app-level RPC failures
- Move the POC RPC group and methods to `@t3tools/contracts` - Inline the renderer client setup in the IPC test and remove obsolete example files - Update the main window placeholder copy
Just curious
Note
Medium Risk
Introduces a new IPC transport path between renderer and main (including a
contextBridgepreload exposure) and client tracking/disconnect handling, which could affect desktop IPC behavior if integrated. Changes are mostly additive and POC-scoped but touch security-sensitive IPC boundaries.Overview
Adds a proof-of-concept Effect RPC transport over Electron IPC by defining a shared framed envelope (
effectRpcIpcPoc/ipc.ts) and wiringRpcClient.Protocol(renderer side) andRpcServer.Protocol(main side) implementations.Includes an Electron preload bridge (
effectRpcIpcPoc/preload.ts) exposed viacontextBridge, plus main-side port adapters and client/disconnect tracking (effectRpcIpcPoc/main.ts). Adds a small demo RPC group (effectRpcIpcPoc/protocol.ts) and Vitest coverage that verifies unary round-trips and streaming semantics end-to-end using an in-memory IPC harness.Reviewed by Cursor Bugbot for commit 1a3dec4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Effect RPC over Electron IPC proof-of-concept transport
ipc.tswith frame interfaces, channel constants, and runtime type guards for both directions.main.tsthat multiplexes multiple renderer clients over Electron IPC, routing requests and handling disconnects viawebContentsdestroyed events.client.tsusing an EffectQueueto buffer incoming frames and forward responses to the RPC client.preload.tsviacontextBridge.exposeInMainWorldthat validates frames in both directions.getRuntimeInfo,echo,subscribeTicks) with schemas and handlers inprotocol.ts, validated by integration tests covering unary and streaming round-trips.Macroscope summarized 1a3dec4. (Automatic summaries will resume when PR exits draft mode or review begins).