[codex] Structure Electron app boundary failures#3301
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 Electron app boundary failures without changing runtime behavior - the same Electron API calls are made, now with typed error capture instead of untyped defects. The changes are self-contained, well-tested, and low risk. You can customize Macroscope's approvability policy. Learn more. |
Summary
Verification
vp test apps/desktop/src/electron/ElectronApp.test.tsvp check(passes with 20 pre-existing warnings)vp run typecheckOpen PR overlap audit
Audited every open PR with
gh pr list --limit 1000and paginated per-PR files, checking bothfilenameandprevious_filename. These files are also touched by unrelated feature/fix PRs #2901, #2916, #2925, and #2679; none belongs to the Effect/error audit series.Note
Low Risk
Localized to the Electron app adapter and tests; startup already handles
whenReadyfailures viacatchCause, and success paths are unchanged.Overview
The
ElectronAppservice now surfaces typed, Schema-backed errors at two Electron boundaries instead of letting sync/promise failures escape as untyped defects.metadatawrapsgetVersionandgetAppPathinEffect.tryand fails withElectronAppMetadataReadError, which records which property (app-versionorapp-path) failed and keeps the original cause.whenReadyusesEffect.tryPromiseand maps rejections toElectronAppWhenReadyErrorwith packaged state and the underlying cause. The service API’s error channels are updated accordingly.New unit tests assert error type, fields, messages, and cause preservation for a version read failure and a readiness rejection.
Reviewed by Cursor Bugbot for commit 41799e3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured error types for
ElectronAppmetadata and readiness failuresElectronAppMetadataReadErrorandElectronAppWhenReadyErrortagged error classes inElectronApp.ts, each preserving the original cause and relevant context (propertyorisPackaged).metadataeffect now individually wraps reads ofappVersionandappPathviaEffect.try, failing with a typed error instead of defecting on throw.whenReadyeffect wrapsElectron.app.whenReady()viaEffect.tryPromise, mapping rejections toElectronAppWhenReadyErrorwith the packaging state attached.ElectronApp.test.tsverify error type, cause propagation, and message content for both failure paths.Macroscope summarized 41799e3.