Skip to content

Make SSH Effect usage more idiomatic#2930

Closed
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-55ca
Closed

Make SSH Effect usage more idiomatic#2930
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/idiomatic-effect-patterns-55ca

Conversation

@cursor

@cursor cursor Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Converted @t3tools/ssh error classes from Data.TaggedError to schema-backed Schema.TaggedErrorClass definitions and added SSH error union schemas.
  • Added Duration-first timeout fields for SSH command and tunnel readiness flows while keeping the old millisecond fields as deprecated compatibility inputs.
  • Replaced schema-error instanceof checks with hoisted Schema.is guards and added focused coverage for serializable SSH errors.

Why

This keeps the SSH package aligned with idiomatic Effect practices: native Duration values flow into timeout/schedule/process APIs, and tagged errors now have structured schemas for serialization and schema-aware narrowing.

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
  • I included a video for animation/interaction changes
Open in Web View Automation 

Note

Replace instanceof checks and numeric millisecond timeouts with Effect Duration and schema-based predicates in SSH packages

  • Rewrites SSH error classes in packages/ssh/src/errors.ts from Data.TaggedError to Schema.TaggedErrorClass, making them encodable/decodable and checkable via Schema.is instead of instanceof.
  • Replaces raw millisecond constants with Duration constants throughout packages/ssh/src/tunnel.ts and packages/ssh/src/command.ts; effective timeout durations are unchanged.
  • Adds a timeout?: Duration.Input field to RunSshCommandOptions and waitForHttpReady, deprecating the old *Ms numeric fields while retaining backwards compatibility.
  • Risk: callers that relied on instanceof checks against SSH error classes may need to switch to Schema.is-based predicates.

Macroscope summarized c66a839. (Automatic summaries will resume when PR exits draft mode or review begins).

@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 3, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

@cursor please rebase this on latest origin/main!

@cursor

cursor Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Now let me update the PR:The branch has been successfully rebased onto latest origin/main and force-pushed. Here's a summary of what was done:

  • Rebased the branch onto latest origin/main (which was at b76f161d)
  • Resolved merge conflicts in packages/ssh/src/errors.ts and packages/ssh/src/command.ts:
    • Kept SshHostDiscoveryError from main and SshInvalidTargetError from the PR branch
    • Kept SSH_COMMAND and MAX_SSH_ERROR_OUTPUT_LENGTH constants from main, alongside the Duration-based timeout from the PR
    • Added stdout as an optional field to SshCommandError schema (matching main's error construction pattern)
  • Fixed type errors introduced by the rebase:
    • Changed Schema.Defect to Schema.Defect() (function invocation required in this Effect version)
    • Replaced instanceof SshHttpBridgeError with a Schema.is guard in apps/desktop/src/ipc/methods/sshEnvironment.ts
  • Verified: full workspace typecheck passes (15/15 packages), SSH tests pass (26/26), lint passes with no warnings/errors
Open in Web Open in Cursor 

cursoragent and others added 3 commits June 5, 2026 19:10
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
…h Schema.is guard

After rebase on main, the SSH error schema definitions needed updating:
- Schema.Defect must be called as Schema.Defect() (function invocation)
- Added stdout field to SshCommandError schema to match main's error construction
- Replaced instanceof SshHttpBridgeError with Schema.is guard in desktop IPC

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/idiomatic-effect-patterns-55ca branch from c66a839 to f42b293 Compare June 5, 2026 19:19
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 50af7188c45504c4cf76a4d9ba23a0d6e9b94177 2c1319138333022ef53422fedb7381e34b960fe8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
App version: 0.1.0
Git commit: 89f01b0ca1e11452be87f8c9683046a562b7347b
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
App version: 0.1.0
Git commit: 89f01b0ca1e11452be87f8c9683046a562b7347b
Update Details Update Permalink
DetailsBranch: pr-2930
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
Git commit: 89f01b0ca1e11452be87f8c9683046a562b7347b
Update Permalink
DetailsBranch: pr-2930
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
Git commit: 89f01b0ca1e11452be87f8c9683046a562b7347b
Update QR

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.

2 participants