Skip to content

ENG-4287 variant: terminal open via tRPC mutation (vs server action)#395

Merged
huv1k merged 1 commit into
move-sandbox-state-management-server-side-eng-4287from
move-sandbox-state-management-server-side-eng-4287-trpc
Jun 11, 2026
Merged

ENG-4287 variant: terminal open via tRPC mutation (vs server action)#395
huv1k merged 1 commit into
move-sandbox-state-management-server-side-eng-4287from
move-sandbox-state-management-server-side-eng-4287-trpc

Conversation

@huv1k

@huv1k huv1k commented Jun 11, 2026

Copy link
Copy Markdown
Member

Comparison branch. Base is the server-action branch (PR #381), so this diff shows only the action↔tRPC delta for the terminal-open path; the filesystem inspector and everything else are identical.

Server action (PR #381): openTerminalSandboxAction (next-safe-action) called directly from the plain openTerminalSandbox helper; result is { data, serverError }.

tRPC (this branch): a sandbox.openTerminal mutation on protectedTeamProcedure (next to killTerminalPty); the vanilla tRPC client is injected into openTerminalSandbox from the component, the return type is inferred from the router (TRPCRouterOutputs), and timeouts are surfaced as TRPCError('TIMEOUT') mapped back to a TimeoutError so attach-retry still fires.

Trade-offs: tRPC unifies the sandbox router (queries already live there) and gives end-to-end inferred types + automatic team resolution via protectedTeamProcedure; the cost is threading the client through the component (the helper isn't a hook) and slightly heavier test wiring. The server action is the local precedent for sandbox mutations (killSandboxAction) and is callable directly from the plain helper. Both keep the account token server-side. Tests: 289 passing on both branches.

…287 variant)

Alternative to the next-safe-action server action: terminal create/connect
now runs through a `sandbox.openTerminal` tRPC mutation (protectedTeamProcedure,
alongside killTerminalPty). The vanilla tRPC client is injected into
openTerminalSandbox from the component, the return type is inferred from the
router, and timeouts are signaled via a TRPCError('TIMEOUT') the client maps
back to a TimeoutError so attach-retry still works.

This branch exists to compare the two transports; only the terminal-open path
differs from the server-action branch (the filesystem inspector is unchanged).
@linear-code

linear-code Bot commented Jun 11, 2026

Copy link
Copy Markdown

ENG-4287

@cla-bot cla-bot Bot added the cla-signed label Jun 11, 2026
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 11, 2026 1:09pm

Request Review

@huv1k huv1k merged commit 6561817 into move-sandbox-state-management-server-side-eng-4287 Jun 11, 2026
4 checks passed
@huv1k huv1k deleted the move-sandbox-state-management-server-side-eng-4287-trpc branch June 11, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant