Repository navigation
Effect Service Conventions: 1 issue found
apps/desktop/src/preview/BrowserImport/BrowserImport.ts (lines 172-186) — The new cookie-database existence probe in importCookies uses require("node:fs") and statSync instead of acquiring FileSystem.FileSystem from the Effect environment (already captured as platformServices and used by every other filesystem probe in this module and in Sources.ts). This hides an imperative runtime dependency inside a production service constructor, and @t3tools/desktop is "type": "module", so require is not defined outside a bundled CJS main. An inline suggestion with a FileSystem-based replacement was posted.
No other violations found: isLockHeld now correctly acquires FileSystem.FileSystem from the environment (its catchIf on error.reason._tag is a legitimate structural platform-error predicate), cookieDatabaseCandidatePaths has no leftover compatibility shim, requirement channels (Effect.fn.Return<..., never, FileSystem.FileSystem>) were updated where dependencies were added, and the added tests cover real behavior changes rather than mechanical refactoring.
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.
Files examined in scope:
apps/desktop/src/preview/BrowserImport/BrowserImport.tsapps/desktop/src/preview/BrowserImport/Sources.tsapps/desktop/src/preview/BrowserImport/Sources.test.ts
Checks performed: namespace subpath imports for Effect modules; service definition/make/layer layout; dependency acquisition via yield* Foo.Foo versus module-global or imperative access; absence of ManagedRuntime.make, runPromise, runPromiseExit, and fake service-instance injection; error modeling (Schema.TaggedErrorClass, structured attributes, preserved cause, catchTags usage); removal of compatibility shims after the cookieDatabasePath → cookieDatabaseCandidatePaths rename (no production or test consumers of the old name remain).
Prior-run note: the previously flagged require("node:fs") in Sources.ts#isLockHeld and the missing Effect.provide(platformServices) on the inline Effect.gen in BrowserImport.ts were addressed, but the imperative require/statSync pattern was reintroduced at the BrowserImport.ts probe site, which is why the check still reports a finding.
🔍 Agent activity — 1 tool call
💭 Looking at the code changes between commits, I can see that
require("node:fs")has been added to BrowserImport.ts,isLockHeldis now properly using the FileSystem service, and there's been a refactoring around thecookieDatabasePathshim. There's a new issue emerging in BrowserImport.ts with how the Node.js fs module is being imported. The problem is thatrequire("node:fs")withstatSynccreates a hidden runtime dependency that bypasses the FileSystem service entirely—this violates the abstraction layer. Plus, usingrequirein an ESM package is problematic. I need to check what the actual file contents look like now to understand the full scope of this issue. I'm spotting a problematicrequire("node:fs")call in the service constructor—it's a hidden runtime dependency that should go through the FileSystem service instead. Since the package is ESM,requireshouldn't even be available here. This is the same kind of issue that was flagged before in Sources.ts and apparently crept back into BrowserImport.ts. There's also a missingEffect.provide(platformServices)call that needs to be added based on the earlier comment at line 183. Let me verify that Sources.ts now properly uses FileSystem and check whether thecatchIfusage there is justified—it looks like it's inspecting platform error reason tags, which should be acceptable for structural predicates. I also need to confirm thecookieDatabasePathshim has been fully removed and search for any lingeringrequirecalls in Sources.ts. I found a clear violation in BrowserImport.ts where the service constructor usesrequire("node:fs")withstatSync, which is a hidden runtime dependency that bypasses the FileSystem service already available throughplatformServices. This also won't work in ESM. The fix is to use a file existence check through the FileSystem service within an Effect.provide call, iterating through the candidate paths to find the database. I'm working through the implementation details—the FileSystem.exists method returns an Effect that needs error handling, so I need to use orElseSucceed to default to false when a file doesn't exist. The approach is to extract the FileSystem from the context, check each candidate path, and then find the first one that exists. Finishing the code suggestion... I should verify that the tests cover the new behavior changes properly, and check whethererror.reasonis a valid property on PlatformError in this Effect version. The BrowserImport service interface looks correct with the fix applied. I'll post the review noting the failure state.
1. modify_pr — One convention violation found: the new cookie-database probe in BrowserImport.importCookies bypasses the Effect environment with require("node:fs") + statSync.
Agent Credits: 45 credits