Skip to content

[codex] structure desktop IPC registration errors#3291

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/desktop-ipc-registration-errors
Jun 20, 2026
Merged

[codex] structure desktop IPC registration errors#3291
juliusmarminge merged 1 commit into
mainfrom
codex/desktop-ipc-registration-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • return schema-backed registration failures with IPC handler kind, channel, and original cause
  • preserve the same context as a structured defect when scoped handler cleanup fails
  • add focused coverage for typed acquisition failure and finalizer failure semantics

Verification

  • vp test apps/desktop/src/ipc/DesktopIpc.test.ts
  • vp check (0 errors; 20 existing warnings)
  • vp run typecheck

Note

Low Risk
Localized desktop IPC wiring and error typing with new tests; no auth, data, or API surface changes beyond clearer Effect error channels.

Overview
Desktop IPC invoke and sync handler registration now surfaces failures as typed DesktopIpcRegistrationError values (handler kind, channel, original cause) instead of opaque sync throws. Scoped cleanup wraps removeHandler / removeAllListeners in Effect.try and maps failures to DesktopIpcUnregistrationError, which become defects via Effect.orDie when the scope finalizer runs.

Adds a DesktopIpcError union plus isDesktopIpcError, and new tests that assert registration failures and sync unregistration failures preserve channel, kind, and cause without leaking the raw cause message into the public error string.

Reviewed by Cursor Bugbot for commit 9970537. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure IPC handler registration and unregistration errors in DesktopIpc

  • Introduces DesktopIpcRegistrationError and DesktopIpcUnregistrationError tagged error classes, each carrying handlerKind ('invoke' | 'sync'), channel, and cause fields.
  • DesktopIpc.handle and DesktopIpc.handleSync now wrap ipcMain registration calls in Effect.try, surfacing failures as DesktopIpcRegistrationError instead of being infallible.
  • Unregistration failures during scope finalization are mapped to DesktopIpcUnregistrationError and converted to defects via Effect.orDie.
  • Behavioral Change: DesktopIpc.handle and DesktopIpc.handleSync error type changes from never to DesktopIpcRegistrationError, which may require call sites to handle the new failure channel.

Macroscope summarized 9970537.

Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Jun 20, 2026
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

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: f630117e-65e2-4d18-bb13-5cf646bc2828

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 codex/desktop-ipc-registration-errors

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

@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured error classes for IPC handler registration/unregistration, wrapping previously unstructured errors with typed context (channel, handler kind, cause). The core IPC logic is unchanged; only error handling is improved, with accompanying unit tests.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit f4ef356 into main Jun 20, 2026
17 checks passed
@juliusmarminge
juliusmarminge deleted the codex/desktop-ipc-registration-errors branch June 20, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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