Repository navigation
Effect Service Conventions: 2 issues found
Two error-modeling convention violations in apps/web/src/themePalette.ts:
readCustomThemeLibrarySnapshot(lines 246-251): manufacturesnew Error("The stored theme library is not an array.")solely to populate the eventualThemeLibraryStorageError.cause. The malformed-library case has no underlying failure; model the reason structurally on the snapshot and keepcausefor real thrown failures.getWritableCustomThemeLibrary(lines 1583-1586): a storage read failure is thrown asThemeLibraryStorageError, whose message readsFailed to write the theme library to …. The read and write stages are collapsed into one error with no discriminator and the read path is mislabelled. Add a multi-valueoperation: Schema.Literal("read", "write")attribute and derivemessagefrom it.
Both findings were posted as inline review comments.
Details
Note
Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.
Scope reviewed: changed TypeScript/TSX under the check's include patterns — apps/web/src/themePalette.ts, apps/web/src/vscodeThemeImport.ts, apps/web/src/components/settings/ThemeColorPicker.tsx, and the touched test files (themePalette.test.ts, themeBoot.test.ts, vscodeThemeImport.test.ts). apps/web/index.html, index.css, package.json, and pnpm-lock.yaml were used as context only.
Checks performed and passing:
- Effect imports remain namespaced subpath imports (
import * as Schema from "effect/Schema"); no consolidatedfrom "effect"imports introduced. - No new
Context.Service,make/layer, or barrel changes; no service-instance parameters,Layer.succeed,ManagedRuntime.make,runPromise, orrunPromiseExitadded in the diff, so no dependency-acquisition or runtime-boundary violations. export const isThemeLibraryStorageError = Schema.is(ThemeLibraryStorageError)is already a direct schema predicate; no redundant wrapper added.- No
catchIf/catchTagmisuse, error-factory helpers, compatibility shims, or file relocations introduced. - New tests cover the new storage-snapshot behavior (a real behavior change), which is consistent with the change-discipline guidance.
Remaining findings are limited to the newly added ThemeLibraryStorageError construction sites described in the summary.
🔍 Agent activity — 1 tool call
💭 The ThemeLibraryStorageError class already existed before this PR, so it wasn't newly introduced. The new code in getWritableCustomThemeLibrary is throwing this error with the same storageKey, but there's no operation discriminator to distinguish different failure scenarios. The real issue is that read failures and write failures both use the same error with a message claiming "write" — so when storage is unavailable during a read operation, the error message incorrectly says "Failed to write the theme library to..." This violates the convention of capturing stable, serializable domain context like operation type. The test even asserts this misleading message for a read failure. The fix would be adding an operation discriminator ("read" | "write") or creating a separate error class. Also looking at the
cause: Schema.Defect()— there's a pattern wherereadCustomThemeLibrarySnapshotmanufactures a new Error just to populate the cause field when validation fails (like "The stored theme library is not an array."), which violates the convention against manufacturing Errors merely to fill the cause property. Later,getWritableCustomThemeLibrarypasses this manufactured error as the cause, perpetuating the pattern. This is a genuine violation of the conventions, though it's borderline whether the check applies here since this is a module with Schema errors rather than an Effect service itself.… I'm checking whether this PR falls under the "Effect Service Conventions" scope—the rule applies when creating, moving, refactoring, or consuming an Effect service, but this is just a color palette refactor that happens to touch a module with a Schema.TaggedErrorClass. The error handling section might still be relevant if it relates to service failures, so I'm weighing whether to flag two potential issues, starting with the error message about the stored theme library not being an array.… Looking at where the theme installation error gets handled and whether it's being caught properly. The real issue here is that we're conflating a read failure with a write failure—they're getting the same error message when they should be distinct. This violates the principle of capturing stable domain context and mapping failures appropriately rather than lumping an entire multi-step process under one generic error. I should flag this as a finding and suggest adding anoperationdiscriminator to distinguish between "read" and "write" failures, then derive the message from that. There's also the synthetic…
1. modify_pr — Reviewed the Effect-facing parts of this palette refactor. The color/OKLCH work looks clean and effect/Schema is still imported as a namespace; two findings concern the new ThemeLibraryStorageError failure paths added around the custom-theme library snapshot.
Agent Credits: 76 credits