Skip to content

[codex] refactor desktop Electron Effect services#3178

Merged
juliusmarminge merged 8 commits into
mainfrom
codex/effect-service-desktop-electron
Jun 20, 2026
Merged

[codex] refactor desktop Electron Effect services#3178
juliusmarminge merged 8 commits into
mainfrom
codex/effect-service-desktop-electron

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

The desktop Electron adapters retained standalone *Shape interfaces and inconsistent placement of their service construction. Their custom operational errors also used Data.TaggedError, which kept them outside the schema-backed error conventions used by the target Effect modules.

This change standardizes the nine Electron adapter services without changing their runtime behavior. Each service now defines its contract inline on Context.Service and exports both its real make value and canonical export const layer = Layer.... Electron service consumers use module namespaces such as ElectronSafeStorage.layer instead of named or aliased layer imports. Static service values use Layer.succeed, while Menu, Protocol, and Window retain Layer.effect for their effectful constructors. Test implementations reference Service["Service"] instead of separately exported shape types.

The protocol, safe-storage, updater, and window errors now use Schema.TaggedErrorClass with structured fields and getter-based messages derived from their scheme and cause attributes.

User impact

There is no intentional user-visible behavior change. The migration makes desktop service construction and test-layer typing predictable, reduces duplicate public type names, and makes Electron adapter errors compatible with the schema-backed Effect patterns used elsewhere in the repository.

Root cause

These adapters were introduced at different points in the desktop implementation and retained older service-definition patterns. As a result, service contracts, constructors, layers, and errors were expressed inconsistently even though they serve the same infrastructure role.

Validation

  • vp test apps/desktop/src/electron apps/desktop/src/app/DesktopAppIdentity.test.ts apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts apps/desktop/src/settings/DesktopSavedEnvironments.test.ts apps/desktop/src/updates/DesktopUpdates.test.ts apps/desktop/src/window/DesktopApplicationMenu.test.ts apps/desktop/src/window/DesktopWindow.test.ts — 14 files and 47 tests passed
  • vp run --filter @t3tools/desktop typecheck — passed
  • vp check — passed with 0 errors; 20 existing warnings remain outside this change
  • vp run typecheck — all 15 workspace tasks passed

Note

Low Risk
Mechanical refactor with tests updated; the only behavioral API change is errors no longer exposing operation and broader union types for safe-storage failures.

Overview
Standardizes the desktop Electron adapter modules so each service declares its contract inline on Context.Service, exports a shared make plus layer, and drops separate *Shape interfaces. Tests and mocks now type against Service["Service"] instead of exported shape types.

Operational errors move from Data.TaggedError to Schema.TaggedErrorClass (protocol, safe storage, updater, window), with ElectronSafeStorageError / ElectronUpdaterError unions for higher-level callers. Connection catalog and saved environments errors lose the redundant operation field; consumers still distinguish failures by error class and paths/messages.

Call sites pick up small import cleanups (makeComponentLogger, named IPC channel constants, ElectronSafeStorage in main). Intended runtime behavior is unchanged aside from error instance shape.

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

Note

Refactor desktop Electron Effect services to use Schema.TaggedErrorClass and inlined service shapes

  • Replaces Data.TaggedError with Schema.TaggedErrorClass (with Schema.Defect-typed causes) across Electron service error classes in ElectronSafeStorage, ElectronUpdater, ElectronWindow, ElectronProtocol, and related modules.
  • Removes the operation literal field from error schemas in DesktopConnectionCatalogStore, DesktopSavedEnvironments, and related files; updates tests accordingly.
  • Consolidates error types for ElectronSafeStorage and ElectronUpdater into exported union types (ElectronSafeStorageError, ElectronUpdaterError) with type guards, replacing previously distinct per-operation error types.
  • Inlines service shapes directly into Context.Service generic parameters across all Electron service modules, removing separate shape interfaces.
  • Exports make factories directly from each Electron service module instead of using local constants.

Macroscope summarized 83049f1.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels 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: b1b8cc4f-0317-40bf-be66-faef1ab75803

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/effect-service-desktop-electron

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

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea ae3bd597809dfd7771d0898f735d172973d4c1c8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
App version: 0.1.0
Git commit: e8196d911574887a26f0db9577a0cf70fdd3ffa1
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
App version: 0.1.0
Git commit: d5d0b2332c4f1477d040363277fa6c2639bb84b8
Update Details Update Permalink
DetailsBranch: pr-3178
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
Git commit: e8196d911574887a26f0db9577a0cf70fdd3ffa1
Update Permalink
DetailsBranch: pr-3178
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
Git commit: e8196d911574887a26f0db9577a0cf70fdd3ffa1
Update QR

@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 80a0aa0 to afb3772 Compare June 20, 2026 01:26
@juliusmarminge
juliusmarminge marked this pull request as ready for review June 20, 2026 02:06
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Mechanical refactoring that inlines interface definitions, migrates error classes to Schema.TaggedErrorClass, removes unused error fields, and reorganizes imports. No runtime behavior changes.

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

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from afb3772 to 87e7f6a Compare June 20, 2026 02:47
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 02:47

Dismissing prior approval to re-evaluate 87e7f6a

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 87e7f6a to 8c55db2 Compare June 20, 2026 03:38
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 03:38

Dismissing prior approval to re-evaluate 8c55db2

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 8c55db2 to 1f27f63 Compare June 20, 2026 04:19
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 04:19

Dismissing prior approval to re-evaluate 1f27f63

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 1f27f63 to b92382f Compare June 20, 2026 04:34
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 04:34

Dismissing prior approval to re-evaluate b92382f

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from b92382f to 6f8045c Compare June 20, 2026 04:42
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 04:43

Dismissing prior approval to re-evaluate 6f8045c

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 05:14

Dismissing prior approval to re-evaluate b46a900

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch 2 times, most recently from b432cb7 to d8475f9 Compare June 20, 2026 05:21
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 05:21

Dismissing prior approval to re-evaluate d8475f9

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from d8475f9 to a7c2a58 Compare June 20, 2026 05:44
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 3d1c47f to 24361e8 Compare June 20, 2026 06:42
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from 24361e8 to c71febf Compare June 20, 2026 06:54
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 06:54

Dismissing prior approval to re-evaluate c71febf

@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch 4 times, most recently from 62da7a5 to c9d16b5 Compare June 20, 2026 07:11
juliusmarminge and others added 5 commits June 20, 2026 00:18
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the codex/effect-service-desktop-electron branch from c9d16b5 to 2bc9187 Compare June 20, 2026 07:19

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the otherwise clean Effect service refactor. See inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/desktop/src/electron/ElectronWindow.ts Outdated
juliusmarminge and others added 2 commits June 20, 2026 00:27
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 07:54

Dismissing prior approval to re-evaluate 83049f1

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge
juliusmarminge merged commit b19fc1b into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/effect-service-desktop-electron branch June 20, 2026 08:24
aaditagrawal added a commit to aaditagrawal/t3code that referenced this pull request Jun 24, 2026
…ctured-errors-a

[codex] refactor desktop Electron Effect services (pingdotgg#3178)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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