Skip to content

[codex] structure Electron theme source errors - #3294

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

[codex] structure Electron theme source errors#3294
juliusmarminge merged 1 commit into
mainfrom
codex/desktop-electron-theme-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • expose Electron theme-source assignment failures as a schema-backed error
  • retain the requested theme source and exact Electron cause
  • add focused coverage without expanding into currently overlapping theme read/subscription consumers

Verification

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

Note

Low Risk
Small, localized Electron theme wrapper change; setTheme IPC may now surface failures that previously could throw uncaught, but scope is non-critical UI theming.

Overview
ElectronTheme.setSource no longer assumes native themeSource assignment always succeeds. It now runs the Electron setter inside Effect.try and fails with a schema-backed ElectronThemeSetSourceError that carries the requested DesktopTheme (source) and the underlying defect (cause), plus a stable user-facing message that names the source but not the raw cause.

The service type and a Schema.is guard are exported so callers (e.g. IPC setTheme) can narrow failures. Tests extend the Electron mock to throw on set and assert error shape, source, cause, and message content.

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

Note

Structure Electron theme source errors into a typed ElectronThemeSetSourceError

  • Adds ElectronThemeSetSourceError, a Schema.TaggedErrorClass carrying the requested source and original cause, replacing raw thrown errors from nativeTheme.themeSource assignment.
  • Updates ElectronTheme.setSource return type from Effect<void> to Effect<void, ElectronThemeSetSourceError>, making failures explicit to callers.
  • Adds isElectronThemeSetSourceError type guard for consumers to narrow the error type.
  • Behavioral Change: errors previously propagated as unhandled throws now surface as typed failing effects.

Macroscope summarized c1ea123.

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: 1a3f8647-03db-4977-89b4-cd5c4a140f3b

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-electron-theme-errors

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

@github-actions github-actions Bot added the size:S 10-29 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 handling for the Electron theme source setting operation. The core behavior is unchanged - it only improves how errors are captured and typed. The changes are self-contained with good test coverage.

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

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

Labels

size:S 10-29 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