Skip to content

fix(desktop): set userData path before the Clerk bridge takes the ins…

MacroscopeApp / Macroscope - Effect Service Conventions failed Jul 30, 2026 in 1m 19s

Effect Service Conventions: 1 issue found

  • apps/desktop/src/app/DesktopAppIdentity.ts: the newly extracted resolveUserDataPath accepts DesktopEnvironment.DesktopEnvironment["Service"] as a parameter in production code, hiding that dependency from its type and forcing make to feed the service back with Effect.provideService; it should be acquired with yield* DesktopEnvironment.DesktopEnvironment (call site apps/desktop/src/app/DesktopClerk.ts:96 updated accordingly).

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.

Reviewed changed TypeScript in scope: apps/desktop/src/app/DesktopAppIdentity.ts, apps/desktop/src/app/DesktopClerk.ts, apps/desktop/src/electron/ElectronApp.ts, and the touched test files.

Checked and found acceptable:

  • Namespace subpath imports (effect/Effect, effect/FileSystem, effect/Layer) and namespace imports of local service modules are used consistently.
  • Removal of requestSingleInstanceLock from the ElectronApp interface and its mechanical propagation through test layers.
  • Error classes remain Schema.TaggedErrorClass with structural attributes, derived message, and a preserved cause.
  • Test-only service instances (ElectronApp/ElectronWindow stubs, FileSystem.layerNoop) and Layer.succeed usages in tests are legitimate test seams.
  • Effect.runPromiseWith(context) in DesktopClerk.configure is pre-existing and unchanged by this PR.

🔍 Agent activity — 1 tool call

💭 Looking at the changes in DesktopAppIdentity.ts and DesktopClerk.ts, I'm noticing that resolveUserDataPath now expects a service dependency as a parameter, which suggests it's being injected rather than constructed directly. This pattern typically indicates the function is part of a service layer, and I need to check how it's being provided in the make function and whether the Effect service provisioning is set up correctly. I'm checking the resolveUserDataPath function against conventions—it takes a service dependency as a parameter, but the pattern expects production code to acquire Effect service dependencies from the environment using yield* instead of accepting them explicitly. This kind of parameter passing is only appropriate in tests. Looking at how it's used in DesktopAppIdentity.make, the function receives the environment, then the result gets wrapped with provideService to inject the FileSystem back into the effect. This is redundant—if resolveUserDataPath yielded both services from the environment directly, the requirements would be transparent and the extra service provision wouldn't be needed. The core issue is that environment is being passed as a parameter rather than yielded from within the helper, which obscures the actual dependencies. I should flag the parameter pattern and note that fixing it would eliminate the need for the provideService call. Let me verify that DesktopEnvironment is indeed a Context.Service and check whether the helper is meant to be pure configuration logic. It's a service holding config values plus path utilities, so there's an argument it's essentially configuration, but since it's a Context.Service, the convention would prefer it to be yielded rather than injected as a parameter. I'm considering a refactor where the helper becomes an Effect that yields both DesktopEnvironment and FileSystem directly, then callers would invoke it with yield* instead of passing the environment explicitly. This would make the dependencies transparent and remove the need for the service provider wrapper. Providing the services explicitly in make would work, but there's a cleaner approach: I can capture the environment context inside the helper function using yield* DesktopEnvironment so the requirement shows up in the type signature, then in make provide that captured context to eliminate the dependency. I'll post a comment on the DesktopAppIdentity.ts call site where resolveUserDataPath is invoked, and since this violates the dependency-acquisition convention, I should fail the check. Now I need to figure out where to place the comment in the diff. The new lines are 48-68, so the parameter at line 49 is definitely in the changed section. I'll target lines 48-50 for a multi-line comment that explains the issue: resolveUserDataPath now requires the service instance as a parameter, which means the type signature no longer reflects the dependency, forcing make to manually feed it back through provideService. The suggestion is to acquire it from the environment instead and provide the context at the boundary where the requirement can be eliminated.

1. modify_pr — One convention issue: the extracted resolveUserDataPath helper takes the DesktopEnvironment service instance as a parameter in production code instead of acquiring it from the Effect environment. Inline comment below.


Agent Credits: 46 credits