Skip to content

[codex] Refactor desktop settings Effect services#3188

Open
juliusmarminge wants to merge 2 commits into
mainfrom
codex/effect-service-desktop-settings
Open

[codex] Refactor desktop settings Effect services#3188
juliusmarminge wants to merge 2 commits into
mainfrom
codex/effect-service-desktop-settings

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Inlines the desktop settings and connection-catalog service contracts on their Context.Service tags.
  • Removes standalone settings shape aliases and updates consumers to namespace imports, qualified access, and Service["Service"] types.
  • Exports canonical effectful make values and layer constants for all four services without synthetic wrappers.
  • Models filesystem, document-decode, secret-decode, write, and migration failures as distinct schema errors with structured operation, path, stage, environment, and field attributes.
  • Preserves existing settings persistence, encryption, migration, and server-exposure behavior.

Scope

The final diff is limited to the desktop settings and connection-catalog services plus focused error-classification tests. There are no orchestration, MCP, or server-exposure changes.

Validation

  • Four relevant desktop suites — 4 files / 41 tests passed
  • vp check — passed; 20 pre-existing unrelated warnings
  • vp run typecheck — passed
  • git diff --check origin/main...HEAD — passed
  • Structured-error audit — no raw Schema.Defect() causes or message-discriminating switches in the four services
  • Stale shape and named service-import audits — no violations
  • Review-thread audit — no unresolved threads before the final push

Note

Medium Risk
Changes error typing and wiring across encrypted catalogs, saved-environment secrets, and on-disk settings writes—security-sensitive persistence paths—but scope is refactor-only with broad test coverage and no described behavior changes.

Overview
Refactors four desktop Effect persistence services—app settings, client settings, saved environments, and the connection catalog—so each exposes an exported make factory and layer = Layer.effect(..., make), with the service API defined inline on Context.Service instead of separate *Shape interfaces.

Tagged errors move from generic Data.TaggedError + opaque cause to Schema.TaggedErrorClass payloads with operation, affected path (or catalog/registry path), and a safe detail string. Read vs JSON/document decode vs encrypted-payload decode are split into distinct error types; migration failures record which legacy step failed (and optional environmentId for secret reads). Invalid base64/secret material is reported without echoing raw secret bytes in messages.

Persistence, encryption, legacy migration, and server-exposure semantics are intended unchanged; tests were updated and extended to assert the new error shapes and failure stages.

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

Note

Refactor desktop settings error classes to use structured fields for operation, path, and detail

  • Converts error classes in DesktopAppSettings, DesktopClientSettings, DesktopSavedEnvironments, and DesktopConnectionCatalogStore from Data.TaggedError to Schema.TaggedErrorClass with structured operation, path/catalogPath/registryPath, and detail fields.
  • Each write and read stage now emits a specific operation tag (e.g. create-directory, replace-settings-file, read-legacy-registry) so callers can distinguish failure modes without parsing error messages.
  • Decode errors (JSON document and base64 secret) are separated into their own error classes (DesktopConnectionCatalogStoreDocumentDecodeError, DesktopSavedEnvironmentsDocumentDecodeError, DesktopSavedEnvironmentSecretDecodeError) rather than being lumped into read errors.
  • Secret-related error messages are constructed to avoid exposing raw secret content.
  • Layer construction for each service is refactored from a direct Layer definition into a make factory consumed via Layer.effect.

Macroscope summarized c9ad561.

@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: 0cc0c5d8-9bfb-4642-b290-a5afcbb9206d

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-settings

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

@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
@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: f30c72047f910d3c63edf84887f4c6392d72a650
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
App version: 0.1.0
Git commit: b4706aa685da92ae179e34c97839c2a0e9840f09
Update Details Update Permalink
DetailsBranch: pr-3188
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
Git commit: 148d7607b1c2c383f8bc419c9f7f8167f206b496
Update Permalink
DetailsBranch: pr-3188
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
Git commit: 148d7607b1c2c383f8bc419c9f7f8167f206b496
Update QR

@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 refactor converting error classes to use Schema.TaggedErrorClass with structured fields for better error reporting. No runtime behavior changes - the same operations execute with the same logic, just with more informative error messages. Comprehensive tests added for the new error structure.

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-settings branch from 50b4ddb to 3236e4a Compare June 20, 2026 02:35
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 02:35

Dismissing prior approval to re-evaluate 3236e4a

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from 3236e4a to a17e8af Compare June 20, 2026 03:06
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 03:06

Dismissing prior approval to re-evaluate a17e8af

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from a17e8af to d83af36 Compare June 20, 2026 03:22
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 03:22

Dismissing prior approval to re-evaluate d83af36

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch 2 times, most recently from 554e0ac to d84fb7e Compare June 20, 2026 04:34
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 04:34

Dismissing prior approval to re-evaluate d84fb7e

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from d84fb7e to 6ec2bb6 Compare June 20, 2026 05:18
juliusmarminge and others added 2 commits June 19, 2026 22:42
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-settings branch from 6ec2bb6 to c9ad561 Compare June 20, 2026 05:42
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 05:43

Dismissing prior approval to re-evaluate c9ad561

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 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