Skip to content

Make server diagnostics and file reads more idiomatic Effect#3633

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/idiomatic-effect-patterns-3984
Draft

Make server diagnostics and file reads more idiomatic Effect#3633
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/idiomatic-effect-patterns-3984

Conversation

@cursor

@cursor cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Migrated WorkspaceFileSystem.readFile from direct node:fs/promises usage to the injected Effect FileSystem service for canonicalization, scoped file opening, stat, and partial reads.
  • Replaced Windows process diagnostics JSON.parse / ad-hoc record traversal with Schema-backed JSON and record decoding.
  • Added focused Windows CIM parser coverage and updated filesystem error assertions for Effect PlatformError causes.

Why

This keeps server internals aligned with idiomatic Effect patterns: native Effect platform services flow through dependency injection, JSON fixtures/parsing use Schema, optional Windows row normalization uses Option, and filesystem failures now preserve structured platform error data.

UI Changes

Not applicable; this is a server-only refactor.

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/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp test run src/workspace/WorkspaceFileSystem.test.ts src/diagnostics/ProcessDiagnostics.test.ts (from apps/server): 2 files / 18 tests passed
  • PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp run typecheck (repo root): passed
  • PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp check (repo root): passed with 0 errors and 20 pre-existing warnings outside the touched files
Open in Web View Automation 

Note

Migrate server diagnostics and file reads to Effect-native APIs

  • Replaces direct node:fs/promises usage in WorkspaceFileSystem with Effect FileSystem APIs; errors now surface as PlatformError-shaped causes in WorkspaceFileSystemOperationError.
  • Introduces a WindowsCimProcessRecord schema in ProcessDiagnostics to validate CIM JSON before normalization; the parser now handles both single-object and array payloads and returns an empty array on malformed input.
  • normalizeWindowsProcessRow returns Option<ProcessRow> instead of null, using schema-driven decoding and explicit numeric constraints.
  • Behavioral Change: readFile errors now carry PlatformError structure instead of NodeJS.ErrnoException; tests in WorkspaceFileSystem.test.ts have been updated accordingly.
📊 Macroscope summarized faf9d87. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

cursoragent and others added 4 commits July 1, 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>
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:L 100-499 changed lines (additions + deletions). labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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