Skip to content

Use idiomatic Effect patterns in diagnostics#2762

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/effect-codebase-idioms-a88e
Draft

Use idiomatic Effect patterns in diagnostics#2762
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/effect-codebase-idioms-a88e

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 19, 2026

What Changed

  • Refactored trace diagnostics NDJSON parsing to use Schema.fromJsonString decoders and Option helpers instead of JSON.parse and null sentinels.
  • Refactored process diagnostics to use Duration for query timeout policy, Schema decoding for Windows process JSON, granular tagged errors, and Layer.mock/assert in tests.

Why

These changes make the diagnostics code easier to test and maintain with Effect-native primitives while keeping the existing runtime behavior and service boundaries focused.

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
Open in Web View Automation 

Note

Refactor diagnostics to use idiomatic Effect patterns with structured errors and schema decoding

  • Replaces a single generic ProcessDiagnosticsError with a tagged union of specific error types (ProcessQueryError, ProcessQueryTimeoutError, ProcessCommandExitError, ProcessSignalRejectedError, ProcessSignalFailedError), each with structured fields.
  • Introduces WindowsProcessRowSchema and schema-driven JSON decoding in ProcessDiagnostics.ts, replacing raw JSON.parse; invalid entries are skipped and decode failures return [].
  • Reworks TraceDiagnostics.ts to use effect/Schema for trace line decoding and Option-based helpers instead of null-returning utilities.
  • Converts PROCESS_QUERY_TIMEOUT_MS from a numeric millisecond constant to a Duration value.
  • Behavioral Change: timeout failures now emit ProcessQueryTimeoutError with timeoutMillis; non-zero process exit now emits ProcessCommandExitError with command, exitCode, and stderr.

Macroscope summarized bed9031.

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 May 19, 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