[codex] Structure Electron window failures#3276
Conversation
Capture a schema-safe BrowserWindow request snapshot while preserving the exact native constructor failure. 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 types for Electron window operations without changing runtime behavior. It's a self-contained error handling improvement with comprehensive test coverage for all new error paths. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 2effa73
…ime-diagnostics [codex] Structure Electron window failures (pingdotgg#3276)
Summary
Validation
vp test apps/desktop/src/electron/ElectronWindow.test.tsvp check(0 errors; existing unrelated warnings only)vp run typecheckNote
Medium Risk
Touches core desktop window lifecycle (create, enumerate, reveal, broadcast, destroy); failures now die via orDie, so upstream fiber handling matters for stability.
Overview
Electron window failures now surface as schema-backed errors instead of bare defects or generic messages.
ElectronWindowCreateErrorcarries a sanitized snapshot of the requestedBrowserWindowoptions (title, size, frame, and selectedwebPreferencesonly—noiconorspellcheck), keeps the original nativecause, and builds a stable message from title/dimensions without echoing cause text.isElectronWindowCreateErroris added for typed handling.A new
ElectronWindowOperationErrorwraps list/focus/inspect/reveal/send/destroy paths withoperation,platform, optionalwindowIdandchannel, andcause; native throws are caught and propagated viaEffect.orDie. Window enumeration and destroyed checks go through sharedlistWindows/isWindowDestroyedhelpers socurrentMainOrFirst,focusedMainOrFirst,sendAll,destroyAll, andsyncAllAppearanceshare the same failure shape.Tests mock
BrowserWindowconstruction and IPC operations to assert option redaction, cause preservation, and operation metadata across create, enumerate, reveal, send, and destroy failures.Reviewed by Cursor Bugbot for commit 2effa73. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure Electron window operation failures as typed errors with diagnostic context
ElectronWindowOperationError, a tagged error carryingoperation,platform,windowId, andchannelfields, surfaced as defects fromreveal,sendAll,destroyAll, and window enumeration.ElectronWindowCreateErrorwith a sanitized snapshot ofBrowserWindowconstructor options and a descriptive message including optional title and dimensions.listWindowsandisWindowDestroyedinElectronWindow.tsto wrap Electron API calls inEffect.try, mapping exceptions to structured errors before dying.sendAllandsyncAllAppearancenow skip destroyed windows using the safeisWindowDestroyedhelper.ElectronWindow.test.tsto cover error propagation for all affected operations.Macroscope summarized 2effa73.