Skip to content

refactor(desktop): effect-electron-ipc PoC#2563

Draft
juliusmarminge wants to merge 9 commits intomainfrom
t3code/effect-rpc-electron-ipc
Draft

refactor(desktop): effect-electron-ipc PoC#2563
juliusmarminge wants to merge 9 commits intomainfrom
t3code/effect-rpc-electron-ipc

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented May 6, 2026

Just curious


Note

Medium Risk
Introduces a new IPC transport path between renderer and main (including a contextBridge preload 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 wiring RpcClient.Protocol (renderer side) and RpcServer.Protocol (main side) implementations.

Includes an Electron preload bridge (effectRpcIpcPoc/preload.ts) exposed via contextBridge, 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

  • Adds a typed IPC envelope in ipc.ts with frame interfaces, channel constants, and runtime type guards for both directions.
  • Implements a main-process protocol in main.ts that multiplexes multiple renderer clients over Electron IPC, routing requests and handling disconnects via webContents destroyed events.
  • Implements a renderer-side protocol in client.ts using an Effect Queue to buffer incoming frames and forward responses to the RPC client.
  • Exposes a preload bridge in preload.ts via contextBridge.exposeInMainWorld that validates frames in both directions.
  • Defines RPC methods (getRuntimeInfo, echo, subscribeTicks) with schemas and handlers in protocol.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).

- 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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 80f73553-3bbf-48d1-ac70-c677c4b3d0ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/effect-rpc-electron-ipc

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels May 6, 2026
@juliusmarminge juliusmarminge changed the title Add Electron IPC Effect RPC proof of concept refactor(desktop): effect-electron-ipc PoC May 6, 2026
- 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
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels May 6, 2026
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant