[codex] Structure Electron menu failures#3317
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 wraps existing Electron menu operations with structured error handling, converting raw exceptions into typed You can customize Macroscope's approvability policy. Learn more. |
Summary
Validation
vp test apps/desktop/src/electron/ElectronMenu.test.ts(7 tests)vp checkvp run typecheckOverlap
The ElectronMenu source file also appears in unrelated feature PR #3177 (version control command center); the test file does not. No active error-audit PR overlaps this slice.
Note
Low Risk
Desktop-only error-handling around Electron menus; behavior on success is unchanged and failures remain defects as before, with richer structure for logging and audits.
Overview
Electron menu native calls now fail with a structured
ElectronMenuOperationErrorinstead of raw thrown errors.setApplicationMenu,popupTemplate, andshowContextMenuwrapbuildFromTemplate/popupinEffect.try(or a guarded try/catch in the callback path) and map failures to defects viaEffect.orDie, carrying operation, platform, window id, item count, and the original cause. User-facing message text is derived only from that metadata, not from the underlying error string.Tests provide
HostProcessPlatformaslinuxthrough a sharedTestLayerand add coverage that each menu path surfaces the tagged error with the expected context when Electron mocks throw.Reviewed by Cursor Bugbot for commit 1b7c676. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure Electron menu failures as typed
ElectronMenuOperationErrordefectsElectronMenuOperationError, a tagged error class with fieldsoperation,platform,windowId,itemCount, andcause, providing structured context for menu failures in ElectronMenu.ts.setApplicationMenu,popupTemplate, andshowContextMenuto catch failures, wrap them inElectronMenuOperationError, and re-raise as defects viaEffect.orDieorEffect.die.causefield.popupTemplatenow returns a no-op effect when the input template is empty.Effect.catchAllwill no longer intercept these errors.Macroscope summarized 1b7c676.