[codex] structure desktop IPC registration errors#3291
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
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)
Comment |
ApprovabilityVerdict: 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. |
Summary
Verification
vp test apps/desktop/src/ipc/DesktopIpc.test.tsvp check(0 errors; 20 existing warnings)vp run typecheckNote
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
DesktopIpcRegistrationErrorvalues (handler kind, channel, original cause) instead of opaque sync throws. Scoped cleanup wrapsremoveHandler/removeAllListenersinEffect.tryand maps failures toDesktopIpcUnregistrationError, which become defects viaEffect.orDiewhen the scope finalizer runs.Adds a
DesktopIpcErrorunion plusisDesktopIpcError, 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
DesktopIpcDesktopIpcRegistrationErrorandDesktopIpcUnregistrationErrortagged error classes, each carryinghandlerKind('invoke' | 'sync'),channel, andcausefields.DesktopIpc.handleandDesktopIpc.handleSyncnow wrapipcMainregistration calls inEffect.try, surfacing failures asDesktopIpcRegistrationErrorinstead of being infallible.DesktopIpcUnregistrationErrorand converted to defects viaEffect.orDie.DesktopIpc.handleandDesktopIpc.handleSyncerror type changes fromnevertoDesktopIpcRegistrationError, which may require call sites to handle the new failure channel.Macroscope summarized 9970537.