[codex] refactor desktop Electron Effect services#3178
Conversation
|
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 |
|
🚀 Expo continuous deployment is ready!
|
80a0aa0 to
afb3772
Compare
ApprovabilityVerdict: 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. |
afb3772 to
87e7f6a
Compare
Dismissing prior approval to re-evaluate 87e7f6a
87e7f6a to
8c55db2
Compare
Dismissing prior approval to re-evaluate 8c55db2
8c55db2 to
1f27f63
Compare
Dismissing prior approval to re-evaluate 1f27f63
1f27f63 to
b92382f
Compare
Dismissing prior approval to re-evaluate b92382f
b92382f to
6f8045c
Compare
Dismissing prior approval to re-evaluate 6f8045c
Dismissing prior approval to re-evaluate b46a900
b432cb7 to
d8475f9
Compare
Dismissing prior approval to re-evaluate d8475f9
d8475f9 to
a7c2a58
Compare
3d1c47f to
24361e8
Compare
24361e8 to
c71febf
Compare
Dismissing prior approval to re-evaluate c71febf
62da7a5 to
c9d16b5
Compare
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>
c9d16b5 to
2bc9187
Compare
There was a problem hiding this comment.
One convention finding on the otherwise clean Effect service refactor. See inline comment.
Posted via Macroscope — Effect Service Conventions
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>
Dismissing prior approval to re-evaluate 83049f1
…ctured-errors-a [codex] refactor desktop Electron Effect services (pingdotgg#3178)
Summary
The desktop Electron adapters retained standalone
*Shapeinterfaces and inconsistent placement of their service construction. Their custom operational errors also usedData.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.Serviceand exports both its realmakevalue and canonicalexport const layer = Layer.... Electron service consumers use module namespaces such asElectronSafeStorage.layerinstead of named or aliased layer imports. Static service values useLayer.succeed, while Menu, Protocol, and Window retainLayer.effectfor their effectful constructors. Test implementations referenceService["Service"]instead of separately exported shape types.The protocol, safe-storage, updater, and window errors now use
Schema.TaggedErrorClasswith 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 passedvp run --filter @t3tools/desktop typecheck— passedvp check— passed with 0 errors; 20 existing warnings remain outside this changevp run typecheck— all 15 workspace tasks passedNote
Low Risk
Mechanical refactor with tests updated; the only behavioral API change is errors no longer exposing
operationand 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 sharedmakepluslayer, and drops separate*Shapeinterfaces. Tests and mocks now type againstService["Service"]instead of exported shape types.Operational errors move from
Data.TaggedErrortoSchema.TaggedErrorClass(protocol, safe storage, updater, window), withElectronSafeStorageError/ElectronUpdaterErrorunions for higher-level callers. Connection catalog and saved environments errors lose the redundantoperationfield; consumers still distinguish failures by error class and paths/messages.Call sites pick up small import cleanups (
makeComponentLogger, named IPC channel constants,ElectronSafeStorageinmain). 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.TaggedErrorClassand inlined service shapesData.TaggedErrorwithSchema.TaggedErrorClass(withSchema.Defect-typed causes) across Electron service error classes inElectronSafeStorage,ElectronUpdater,ElectronWindow,ElectronProtocol, and related modules.operationliteral field from error schemas inDesktopConnectionCatalogStore,DesktopSavedEnvironments, and related files; updates tests accordingly.ElectronSafeStorageandElectronUpdaterinto exported union types (ElectronSafeStorageError,ElectronUpdaterError) with type guards, replacing previously distinct per-operation error types.Context.Servicegeneric parameters across all Electron service modules, removing separate shape interfaces.makefactories directly from each Electron service module instead of using local constants.Macroscope summarized 83049f1.