Skip to content

Apply idiomatic Effect patterns to SSH diagnostics#3569

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

Apply idiomatic Effect patterns to SSH diagnostics#3569
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-5b0b

Conversation

@cursor

@cursor cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Converted @t3tools/ssh error classes from Data.TaggedError to Schema.TaggedErrorClass so they are schema-backed and serializable.
  • Replaced Windows process diagnostics JSON.parse with a hoisted Schema.fromJsonString(Schema.Unknown) decoder.
  • Updated SSH readiness/desktop SSH consumers to use hoisted Schema.is(...) guards instead of instanceof for schema errors.
  • Added targeted coverage for Windows process row decoding through the Effect child process layer.

Why

These are small, focused idiomatic Effect improvements: schema-backed tagged errors support structured runtime checks/serialization, and Schema JSON decoding avoids ad-hoc parsing while preserving existing malformed-row filtering behavior.

UI Changes

Not applicable; no UI changes.

Checklist

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

Validation:

  • pnpm exec vp test run src/diagnostics/ProcessDiagnostics.test.ts from apps/server passed (7 tests).
  • pnpm exec vp test run src/tunnel.test.ts from packages/ssh passed (12 tests).
  • pnpm exec vp test run src/ipc/methods/sshEnvironment.test.ts from apps/desktop passed (3 tests).
  • pnpm exec vp check passed.
  • pnpm exec vp run typecheck passed.
Open in Web View Automation 

Note

Replace instanceof checks with Schema.is guards across SSH error classes

  • Reimplements all SSH error classes in packages/ssh/src/errors.ts using Schema.TaggedErrorClass with explicit field schemas, enabling schema-based type guards via Schema.is.
  • Replaces instanceof checks with Schema.is-based guards in SSH diagnostics (sshEnvironment.ts, DesktopSshEnvironment.ts, tunnel.ts) so schema-tagged error values are recognized correctly.
  • Refactors parseWindowsProcessRows in ProcessDiagnostics.ts to use Schema.decodeUnknownOption instead of a try/catch around JSON.parse.
  • Behavioral Change: error detection now matches any schema-conforming value, not just class instances, which matters when errors cross serialization boundaries.

Macroscope summarized 7ce32a8.

cursoragent and others added 3 commits June 26, 2026 16:04
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 Jun 26, 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