Repository navigation
Effect Service Conventions: 1 issue found
apps/desktop/src/app/DesktopAppIdentity.ts: the newly extractedresolveUserDataPathacceptsDesktopEnvironment.DesktopEnvironment["Service"]as a parameter in production code, hiding that dependency from its type and forcingmaketo feed the service back withEffect.provideService; it should be acquired withyield* DesktopEnvironment.DesktopEnvironment(call siteapps/desktop/src/app/DesktopClerk.ts:96updated 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
requestSingleInstanceLockfrom theElectronAppinterface and its mechanical propagation through test layers. - Error classes remain
Schema.TaggedErrorClasswith structural attributes, derivedmessage, and a preservedcause. - Test-only service instances (
ElectronApp/ElectronWindowstubs,FileSystem.layerNoop) andLayer.succeedusages in tests are legitimate test seams. Effect.runPromiseWith(context)inDesktopClerk.configureis 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
resolveUserDataPathnow 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 themakefunction and whether the Effect service provisioning is set up correctly. I'm checking theresolveUserDataPathfunction against conventions—it takes a service dependency as a parameter, but the pattern expects production code to acquire Effect service dependencies from the environment usingyield*instead of accepting them explicitly. This kind of parameter passing is only appropriate in tests. Looking at how it's used inDesktopAppIdentity.make, the function receives the environment, then the result gets wrapped withprovideServiceto inject the FileSystem back into the effect. This is redundant—ifresolveUserDataPathyielded both services from the environment directly, the requirements would be transparent and the extra service provision wouldn't be needed. The core issue is thatenvironmentis 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 theprovideServicecall. Let me verify thatDesktopEnvironmentis 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 aContext.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 bothDesktopEnvironmentandFileSystemdirectly, then callers would invoke it withyield*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 inmakewould work, but there's a cleaner approach: I can capture the environment context inside the helper function usingyield* DesktopEnvironmentso the requirement shows up in the type signature, then inmakeprovide that captured context to eliminate the dependency. I'll post a comment on the DesktopAppIdentity.ts call site whereresolveUserDataPathis 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:resolveUserDataPathnow requires the service instance as a parameter, which means the type signature no longer reflects the dependency, forcingmaketo manually feed it back throughprovideService. 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