Skip to content

Use idiomatic Effect filesystem and duration APIs#3543

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-1f3b
Draft

Use idiomatic Effect filesystem and duration APIs#3543
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-1f3b

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Replaced node:fs/promises.realpath wrappers in WorkspaceFileSystem.readFile with the injected Effect FileSystem.realPath service.
  • Added a structured assertion for the resulting PlatformError details in the workspace read failure test.
  • Replaced telemetry's raw Effect.sleep(1000) with ANALYTICS_FLUSH_INTERVAL = Duration.seconds(1).
  • Added a TestClock-backed telemetry test that advances the Effect clock and verifies the buffered event is flushed.

Why

This keeps production Effect code on Effect-native services and duration values, making filesystem behavior easier to layer/mock and scheduled telemetry behavior deterministic under TestClock.

UI Changes

Not applicable.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Verification:

  • PATH="$HOME/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp test apps/server/src/workspace/WorkspaceFileSystem.test.ts apps/server/src/telemetry/AnalyticsService.test.ts
  • PATH="$HOME/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp check
  • PATH="$HOME/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp run typecheck
Open in Web View Automation 

Note

Use idiomatic Effect filesystem and duration APIs in WorkspaceFileSystem and AnalyticsService

  • Replaces NodeFSP.realpath wrapped in Effect.tryPromise with FileSystem.realPath in WorkspaceFileSystem.ts; errors now map to WorkspaceFileSystemOperationError with a PlatformError cause instead of a raw NodeJS.ErrnoException.
  • Exports ANALYTICS_FLUSH_INTERVAL as Duration.seconds(1) in AnalyticsService.ts and replaces the hardcoded 1000ms sleep with Effect.sleep(ANALYTICS_FLUSH_INTERVAL).
  • Adds a new test in AnalyticsService.test.ts that verifies periodic flush behavior using TestClock.
  • Behavioral Change: WorkspaceFileSystem.readFile errors on path resolution now carry a PlatformError with reason._tag === 'NotFound' and reason.method === 'realPath' instead of a Node errno object.

Macroscope summarized 7e514b6.

cursoragent and others added 3 commits June 24, 2026 16:06
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 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