Skip to content

Make process diagnostics parsing more idiomatic Effect#3914

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

Make process diagnostics parsing more idiomatic Effect#3914
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/idiomatic-effect-patterns-cf2a

Conversation

@cursor

@cursor cursor Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Reworked process diagnostics parsing to use Option instead of nullable sentinels for parse failures.
  • Replaced the Windows diagnostics JSON.parse / ad-hoc record traversal with compiled Effect Schema decoders over Schema.UnknownFromJsonString.
  • Updated the diagnostics tests to use assert from @effect/vitest and added coverage for mocked Windows process output through ChildProcessSpawner.

Why

This keeps the diagnostics code on Effect-native parsing/test seams, preserving the existing child-process abstraction while making malformed Windows process rows schema-validated and safely filtered.

Checklist

  • This PR is small and focused
  • I explained what changed and why

Verification:

  • pnpm exec vp test run src/diagnostics/ProcessDiagnostics.test.ts from apps/server — passed (7 tests)
  • pnpm exec vp check — passed (0 errors; unrelated existing React warnings)
  • pnpm exec vp run typecheck — passed
Open in Web View Automation 

Note

Refactor process diagnostics parsing to use Effect's Option and Schema APIs

  • Replaces null-returning parse helpers (parsePositiveInt, parseNonNegativeInt, parseNumber) with Option-returning equivalents, and adds new helpers (parseInteger, trimNonEmpty, finiteNonNegativeNumberOrZero) in ProcessDiagnostics.ts.
  • Introduces a WindowsProcessRecord Schema struct with typed decoders (decodeWindowsProcessJson, decodeWindowsProcessRecord) replacing raw JSON.parse for Windows process rows.
  • normalizeWindowsProcessRow now returns Option<ProcessRow> and validates input via Schema, yielding Option.none for invalid records instead of silently producing bad data.
  • Adds a new Windows JSON parsing test case covering field normalization, null fallbacks, invalid record filtering, and powershell invocation args; migrates all existing test assertions from expect to Effect's assert API.

Macroscope summarized 927c104.

cursoragent and others added 2 commits July 12, 2026 16:07
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 size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jul 12, 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