Open History to see the last commit
1import {
2 AuthAdministrativeScopes,
3 AuthStandardClientScopes,
4 EnvironmentId,
5 type AuthEnvironmentScope,
6 ORCHESTRATION_PROTOCOL_VERSION,
7} from "@t3tools/contracts";
8import { describe, expect, it } from "@effect/vitest";
9import * as Effect from "effect/Effect";
10import * as Layer from "effect/Layer";
11import * as Option from "effect/Option";
12import * as Stream from "effect/Stream";
13import * as SubscriptionRef from "effect/SubscriptionRef";
14
15import * as RpcHttp from "../rpc/http.ts";
16import * as ClientCapabilities from "../platform/capabilities.ts";
17import * as Persistence from "../platform/persistence.ts";
18import { fetchRemoteSessionState } from "../authorization/remote.ts";
19import {
20 BearerConnectionCredential,
21 BearerConnectionProfile,
22 BearerConnectionRegistration,
23 PrimaryConnectionRegistration,
24} from "./catalog.ts";
25import * as Connectivity from "./connectivity.ts";
26import * as ConnectionCredentialStore from "./credentialStore.ts";
27import * as ConnectionDriver from "./driver.ts";
28import {
29 BearerConnectionTarget,
30 ConnectionBlockedError,
31 PrimaryConnectionTarget,
32} from "./model.ts";
33import * as Onboarding from "./onboarding.ts";
34import {
35 prepareBearerConnectionUpdate,
36 preparePairingRegistration,
37 prepareSshRegistration,
38} from "./onboarding.ts";
39import * as EnvironmentRegistry from "./registry.ts";
40import * as ConnectionProfileStore from "./profileStore.ts";
41import * as ConnectionWakeups from "./wakeups.ts";
42
43const layerClientPresentation = Layer.succeed(
44 ClientCapabilities.ClientPresentation,
45 ClientCapabilities.ClientPresentation.of({
46 metadata: {
47 label: "T3 Code Test",
48 deviceType: "desktop",
49 os: "Test OS",
50 },
51 }),
52);
53
54function layerPairingHttp(
55 calls: Array<{ readonly url: string; readonly init: RequestInit }>,
56 options?: {
57 readonly failDescriptor?: boolean;
58 readonly failExchange?: boolean;
59 readonly protocolVersion?: number;
60 readonly selfUpdate?: boolean;
61 readonly grantScopes?: ReadonlyArray<AuthEnvironmentScope>;
62 },
63) {
64 const grantScopes = options?.grantScopes ?? AuthStandardClientScopes;
65 let sessionScopes: ReadonlyArray<string> = [];
66 const fetchFn = ((input, init = {}) => {
67 const url = String(input);
68 calls.push({ url, init });
69
70 if (url.endsWith("/.well-known/t3/environment")) {
71 if (options?.failDescriptor === true) {
72 return Promise.resolve(
73 Response.json({ message: "descriptor unavailable" }, { status: 503 }),
74 );
75 }
76 return Promise.resolve(
77 Response.json({
78 environmentId: "environment-paired",
79 label: "Paired environment",
80 platform: {
81 os: "linux",
82 arch: "x64",
83 },
84 serverVersion: "0.0.0-test",
85 orchestrationProtocolVersion: options?.protocolVersion ?? ORCHESTRATION_PROTOCOL_VERSION,
86 capabilities: {
87 repositoryIdentity: true,
88 ...(options?.selfUpdate === true ? { serverSelfUpdate: "boot-service" } : {}),
89 },
90 }),
91 );
92 }
93
94 if (url.endsWith("/oauth/token")) {
95 if (options?.failExchange === true) {
96 return Promise.resolve(
97 Response.json(
98 {
99 _tag: "EnvironmentAuthInvalidError",
100 code: "auth_invalid",
101 reason: "invalid_credential",
102 traceId: "trace-pairing-test",
103 },
104 { status: 401 },
105 ),
106 );
107 }
108 const body =
109 init.body instanceof Uint8Array ? new TextDecoder().decode(init.body) : String(init.body);
110 const requestedScope = new URLSearchParams(body).get("scope");
111 sessionScopes = requestedScope === null ? grantScopes : requestedScope.split(" ");
112 if (!sessionScopes.every((scope) => grantScopes.some((granted) => granted === scope))) {
113 return Promise.resolve(
114 Response.json(
115 {
116 _tag: "EnvironmentRequestInvalidError",
117 code: "invalid_request",
118 reason: "scope_not_granted",
119 traceId: "pairing-scope-test",
120 },
121 { status: 400 },
122 ),
123 );
124 }
125 return Promise.resolve(
126 Response.json({
127 access_token: "bearer-token",
128 issued_token_type: "urn:ietf:params:oauth:token-type:access_token",
129 token_type: "Bearer",
130 expires_in: 3600,
131 scope: sessionScopes.join(" "),
132 }),
133 );
134 }
135
136 if (url.endsWith("/api/auth/session")) {
137 return Promise.resolve(
138 Response.json({
139 authenticated: true,
140 auth: {
141 policy: "remote-reachable",
142 bootstrapMethods: ["one-time-token"],
143 sessionMethods: ["bearer-access-token"],
144 sessionCookieName: "t3_session",
145 },
146 scopes: sessionScopes,
147 sessionMethod: "bearer-access-token",
148 }),
149 );
150 }
151
152 return Promise.reject(new Error(`Unexpected request: ${url}`));
153 }) satisfies typeof fetch;
154
155 return RpcHttp.layerRemoteHttpClient(fetchFn);
156}
157
158function layerPairingOnboarding(options?: Parameters<typeof layerPairingHttp>[1]) {
159 const dependencies = Layer.mergeAll(
160 layerClientPresentation,
161 layerPairingHttp([], options),
162 Layer.mock(Persistence.ConnectionTargetStore)({
163 list: Effect.succeed([]),
164 listDisabled: Effect.succeed([]),
165 }),
166 Layer.mock(Persistence.ConnectionRegistrationStore)({
167 register: () => Effect.void,
168 setEnabled: () => Effect.void,
169 }),
170 Layer.mock(Persistence.EnvironmentCacheStore)({}),
171 Layer.mock(ConnectionProfileStore.ConnectionProfileStore)({}),
172 Layer.mock(ConnectionCredentialStore.ConnectionCredentialStore)({}),
173 Layer.mock(ClientCapabilities.SshEnvironmentGateway)({}),
174 Layer.succeed(
175 Connectivity.Connectivity,
176 Connectivity.Connectivity.of({ status: Effect.succeed("online"), changes: Stream.never }),
177 ),
178 Layer.mock(ConnectionDriver.ConnectionDriver)({ connect: () => Effect.never }),
179 Layer.succeed(
180 ConnectionWakeups.ConnectionWakeups,
181 ConnectionWakeups.ConnectionWakeups.of({ changes: Stream.never }),
182 ),
183 );
184 return Onboarding.layer.pipe(
185 Layer.provideMerge(EnvironmentRegistry.layer.pipe(Layer.provideMerge(dependencies))),
186 );
187}
188
189const PAIRED_ENVIRONMENT_ID = EnvironmentId.make("environment-paired");
190const PAIRING_INPUT = { host: "remote.example.test", pairingCode: "pairing-token" };
191const PAIRED_PROFILE = new BearerConnectionProfile({
192 connectionId: "bearer:environment-paired:https://remote.example.test",
193 environmentId: PAIRED_ENVIRONMENT_ID,
194 label: "Paired environment",
195 httpBaseUrl: "https://remote.example.test/",
196 wsBaseUrl: "wss://remote.example.test/",
197});
198const UNSUPPORTED_ERROR = new ConnectionBlockedError({
199 reason: "unsupported",
200 detail: "The saved server used an incompatible orchestration protocol.",
201});
202
203const registerSwitchedOffEnvironment = Effect.gen(function* () {
204 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
205 const registration = new BearerConnectionRegistration({
206 target: new BearerConnectionTarget({
207 environmentId: PAIRED_ENVIRONMENT_ID,
208 connectionId: PAIRED_PROFILE.connectionId,
209 label: "Old label",
210 }),
211 profile: new BearerConnectionProfile({ ...PAIRED_PROFILE, label: "Old label" }),
212 credential: new BearerConnectionCredential({ token: "old-token" }),
213 });
214 yield* registry.register(registration);
215 yield* registry.setEnabled(PAIRED_ENVIRONMENT_ID, false);
216 yield* registry.setCompatibility(PAIRED_ENVIRONMENT_ID, UNSUPPORTED_ERROR);
217 const entries = yield* SubscriptionRef.get(registry.entries);
218 expect(entries.get(PAIRED_ENVIRONMENT_ID)).toEqual({
219 target: registration.target,
220 profile: Option.some(registration.profile),
221 enabled: false,
222 unsupportedReason: UNSUPPORTED_ERROR.message,
223 });
224 return entries;
225});
226
227describe("connection onboarding", () => {
228 it.effect("prepares a persisted bearer registration from pairing details", () =>
229 Effect.gen(function* () {
230 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
231 const registration = yield* preparePairingRegistration({
232 host: "remote.example.test",
233 pairingCode: "pairing-token",
234 }).pipe(Effect.provide(Layer.mergeAll(layerClientPresentation, layerPairingHttp(calls))));
235
236 expect(registration).toMatchObject({
237 _tag: "BearerConnectionRegistration",
238 target: {
239 environmentId: "environment-paired",
240 label: "Paired environment",
241 connectionId: "bearer:environment-paired:https://remote.example.test",
242 },
243 profile: {
244 environmentId: "environment-paired",
245 label: "Paired environment",
246 connectionId: "bearer:environment-paired:https://remote.example.test",
247 httpBaseUrl: "https://remote.example.test/",
248 wsBaseUrl: "wss://remote.example.test/",
249 },
250 credential: {
251 token: "bearer-token",
252 },
253 });
254 expect(calls.map((call) => call.url)).toEqual([
255 "https://remote.example.test/.well-known/t3/environment",
256 "https://remote.example.test/oauth/token",
257 ]);
258
259 const tokenRequest = calls.find((call) => call.url.endsWith("/oauth/token"));
260 const tokenBody =
261 tokenRequest?.init.body instanceof Uint8Array
262 ? new TextDecoder().decode(tokenRequest.init.body)
263 : String(tokenRequest?.init.body);
264 const tokenParams = new URLSearchParams(tokenBody);
265 expect(tokenParams.get("subject_token")).toBe("pairing-token");
266 expect(tokenParams.has("scope")).toBe(false);
267 expect(tokenParams.get("client_label")).toBe("T3 Code Test");
268 expect(tokenParams.get("client_device_type")).toBe("desktop");
269 expect(tokenParams.get("client_os")).toBe("Test OS");
270 }),
271 );
272
273 it.effect("turns a switched-off environment back on when it is paired again", () =>
274 Effect.gen(function* () {
275 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
276 const onboarding = yield* Onboarding.ConnectionOnboarding;
277 yield* registerSwitchedOffEnvironment;
278
279 const environmentId = yield* onboarding.registerPairing(PAIRING_INPUT);
280
281 expect(environmentId).toBe(PAIRED_ENVIRONMENT_ID);
282 const entries = yield* SubscriptionRef.get(registry.entries);
283 const entry = entries.get(environmentId);
284 expect(entries.size).toBe(1);
285 expect(entry?.enabled).toBe(true);
286 expect(entry?.unsupportedReason).toBeUndefined();
287 expect(entry?.profile).toEqual(Option.some(PAIRED_PROFILE));
288 expect(entry?.target).toEqual(
289 new BearerConnectionTarget({
290 environmentId,
291 connectionId: PAIRED_PROFILE.connectionId,
292 label: PAIRED_PROFILE.label,
293 }),
294 );
295 }).pipe(Effect.provide(layerPairingOnboarding())),
296 );
297
298 it.effect(
299 "re-pairs an outdated self-updatable environment so its connection can be rechecked",
300 () =>
301 Effect.gen(function* () {
302 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
303 const onboarding = yield* Onboarding.ConnectionOnboarding;
304 yield* registerSwitchedOffEnvironment;
305 yield* registry.setCompatibility(
306 PAIRED_ENVIRONMENT_ID,
307 new ConnectionBlockedError({
308 reason: "unsupported",
309 detail: "The saved server needs an update.",
310 serverUpdateRequired: true,
311 }),
312 );
313 expect(
314 (yield* SubscriptionRef.get(registry.entries)).get(PAIRED_ENVIRONMENT_ID),
315 ).toMatchObject({
316 enabled: false,
317 serverUpdateRequired: true,
318 });
319
320 const environmentId = yield* onboarding.registerPairing(PAIRING_INPUT);
321
322 expect(environmentId).toBe(PAIRED_ENVIRONMENT_ID);
323 const entry = (yield* SubscriptionRef.get(registry.entries)).get(environmentId);
324 expect(entry?.enabled).toBe(true);
325 expect(entry?.unsupportedReason).toBeUndefined();
326 expect(entry?.serverUpdateRequired).toBeUndefined();
327 expect(entry?.profile).toEqual(Option.some(PAIRED_PROFILE));
328 }).pipe(
329 Effect.provide(
330 layerPairingOnboarding({
331 protocolVersion: ORCHESTRATION_PROTOCOL_VERSION - 1,
332 selfUpdate: true,
333 }),
334 ),
335 ),
336 );
337
338 it.effect("registers an enabled environment on first-time pairing", () =>
339 Effect.gen(function* () {
340 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
341 const onboarding = yield* Onboarding.ConnectionOnboarding;
342 expect((yield* SubscriptionRef.get(registry.entries)).size).toBe(0);
343
344 const environmentId = yield* onboarding.registerPairing(PAIRING_INPUT);
345
346 expect(environmentId).toBe(PAIRED_ENVIRONMENT_ID);
347 const entries = yield* SubscriptionRef.get(registry.entries);
348 const entry = entries.get(environmentId);
349 expect(entries.size).toBe(1);
350 expect(entry?.enabled).toBe(true);
351 expect(entry?.unsupportedReason).toBeUndefined();
352 expect(entry?.profile).toEqual(Option.some(PAIRED_PROFILE));
353 }).pipe(Effect.provide(layerPairingOnboarding())),
354 );
355
356 it.effect("leaves a platform-managed environment untouched when its id is paired", () =>
357 Effect.gen(function* () {
358 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
359 const onboarding = yield* Onboarding.ConnectionOnboarding;
360 yield* registry.registerPlatform(
361 new PrimaryConnectionRegistration({
362 target: new PrimaryConnectionTarget({
363 environmentId: PAIRED_ENVIRONMENT_ID,
364 label: "Host environment",
365 httpBaseUrl: "http://127.0.0.1:3773",
366 wsBaseUrl: "ws://127.0.0.1:3773",
367 }),
368 }),
369 );
370 yield* registry.setCompatibility(PAIRED_ENVIRONMENT_ID, UNSUPPORTED_ERROR);
371 const before = yield* SubscriptionRef.get(registry.entries);
372 expect(before.get(PAIRED_ENVIRONMENT_ID)?.enabled).toBe(false);
373
374 const environmentId = yield* onboarding.registerPairing(PAIRING_INPUT);
375
376 expect(environmentId).toBe(PAIRED_ENVIRONMENT_ID);
377 const after = yield* SubscriptionRef.get(registry.entries);
378 expect(after).toEqual(before);
379 expect(after.get(PAIRED_ENVIRONMENT_ID)?.unsupportedReason).toBe(UNSUPPORTED_ERROR.message);
380 }).pipe(Effect.provide(layerPairingOnboarding())),
381 );
382
383 it.effect("leaves a switched-off environment unchanged when the pairing exchange fails", () =>
384 Effect.gen(function* () {
385 const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
386 const onboarding = yield* Onboarding.ConnectionOnboarding;
387 const before = yield* registerSwitchedOffEnvironment;
388
389 const error = yield* onboarding.registerPairing(PAIRING_INPUT).pipe(Effect.flip);
390
391 expect(error).toMatchObject({
392 _tag: "ConnectionBlockedError",
393 reason: "authentication",
394 traceId: "trace-pairing-test",
395 });
396 const after = yield* SubscriptionRef.get(registry.entries);
397 expect(after).toEqual(before);
398 expect(after.get(PAIRED_ENVIRONMENT_ID)?.enabled).toBe(false);
399 expect(after.get(PAIRED_ENVIRONMENT_ID)?.unsupportedReason).toBe(UNSUPPORTED_ERROR.message);
400 }).pipe(Effect.provide(layerPairingOnboarding({ failExchange: true }))),
401 );
402
403 it.effect("rejects an incompatible server without consuming the pairing credential", () =>
404 Effect.gen(function* () {
405 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
406 const error = yield* preparePairingRegistration({
407 host: "remote.example.test",
408 pairingCode: "pairing-token",
409 }).pipe(
410 Effect.provide(
411 Layer.mergeAll(
412 layerClientPresentation,
413 layerPairingHttp(calls, { protocolVersion: ORCHESTRATION_PROTOCOL_VERSION + 1 }),
414 ),
415 ),
416 Effect.flip,
417 );
418 expect(error).toMatchObject({ reason: "unsupported" });
419 expect(calls.map((call) => call.url)).toEqual([
420 "https://remote.example.test/.well-known/t3/environment",
421 ]);
422 }),
423 );
424 it.effect.each([
425 { label: "read-only", scopes: ["orchestration:read"] },
426 { label: "administrative", scopes: AuthAdministrativeScopes },
427 ] as const)("preserves the $label grant when pairing a remote environment", ({ scopes }) =>
428 Effect.gen(function* () {
429 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
430 const httpLayer = layerPairingHttp(calls, { grantScopes: scopes });
431 const registration = yield* preparePairingRegistration({
432 host: "remote.example.test",
433 pairingCode: "pairing-token",
434 }).pipe(Effect.provide(Layer.mergeAll(layerClientPresentation, httpLayer)));
435
436 const session = yield* fetchRemoteSessionState({
437 httpBaseUrl: registration.profile.httpBaseUrl,
438 bearerToken: registration.credential.token,
439 }).pipe(Effect.provide(httpLayer));
440
441 expect(session.authenticated).toBe(true);
442 expect(session.scopes).toEqual(scopes);
443 }),
444 );
445
446 it.effect("refuses to add a route that reaches a different machine, keeping the code", () =>
447 Effect.gen(function* () {
448 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
449 const error = yield* preparePairingRegistration({
450 host: "remote.example.test",
451 pairingCode: "pairing-token",
452 expectedEnvironmentId: EnvironmentId.make("some-other-machine"),
453 }).pipe(
454 Effect.provide(Layer.mergeAll(layerClientPresentation, layerPairingHttp(calls))),
455 Effect.flip,
456 );
457 expect(error).toMatchObject({ reason: "configuration" });
458 expect(error.message).toContain("different machine");
459 expect(calls.map((call) => call.url)).toEqual([
460 "https://remote.example.test/.well-known/t3/environment",
461 ]);
462 }),
463 );
464
465 it.effect("pairs an outdated server so it can be updated from this client", () =>
466 Effect.gen(function* () {
467 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
468 const registration = yield* preparePairingRegistration({
469 host: "remote.example.test",
470 pairingCode: "pairing-token",
471 }).pipe(
472 Effect.provide(
473 Layer.mergeAll(
474 layerClientPresentation,
475 layerPairingHttp(calls, {
476 protocolVersion: ORCHESTRATION_PROTOCOL_VERSION - 1,
477 selfUpdate: true,
478 }),
479 ),
480 ),
481 );
482 expect(registration.target.environmentId).toBe("environment-paired");
483 expect(calls.map((call) => call.url)).toContain("https://remote.example.test/oauth/token");
484 }),
485 );
486
487 it.effect("refuses an outdated server that cannot update itself", () =>
488 Effect.gen(function* () {
489 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
490 const error = yield* preparePairingRegistration({
491 host: "remote.example.test",
492 pairingCode: "pairing-token",
493 }).pipe(
494 Effect.provide(
495 Layer.mergeAll(
496 layerClientPresentation,
497 layerPairingHttp(calls, { protocolVersion: ORCHESTRATION_PROTOCOL_VERSION - 1 }),
498 ),
499 ),
500 Effect.flip,
501 );
502 expect(error).toMatchObject({ reason: "unsupported" });
503 expect(error).not.toHaveProperty("serverUpdateRequired");
504 expect(calls.map((call) => call.url)).toEqual([
505 "https://remote.example.test/.well-known/t3/environment",
506 ]);
507 }),
508 );
509
510 it.effect("does not consume a pairing credential when descriptor discovery fails", () =>
511 Effect.gen(function* () {
512 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
513
514 yield* preparePairingRegistration({
515 host: "remote.example.test",
516 pairingCode: "pairing-token",
517 }).pipe(
518 Effect.provide(
519 Layer.mergeAll(
520 layerClientPresentation,
521 layerPairingHttp(calls, { failDescriptor: true }),
522 ),
523 ),
524 Effect.flip,
525 );
526
527 expect(calls.map((call) => call.url)).toEqual([
528 "https://remote.example.test/.well-known/t3/environment",
529 ]);
530 }),
531 );
532
533 it.effect("rejects invalid pairing details before making a request", () =>
534 Effect.gen(function* () {
535 const calls: Array<{ readonly url: string; readonly init: RequestInit }> = [];
536 const error = yield* preparePairingRegistration({
537 host: "",
538 pairingCode: "",
539 }).pipe(
540 Effect.provide(Layer.mergeAll(layerClientPresentation, layerPairingHttp(calls))),
541 Effect.flip,
542 );
543
544 expect(error).toMatchObject({
545 _tag: "ConnectionBlockedError",
546 reason: "configuration",
547 message: "Enter a backend URL.",
548 });
549 expect(calls).toEqual([]);
550 }),
551 );
552
553 it.effect("updates bearer metadata while preserving the credential and identity", () =>
554 Effect.gen(function* () {
555 const environmentId = EnvironmentId.make("environment-paired");
556 const registration = yield* prepareBearerConnectionUpdate({
557 input: {
558 environmentId,
559 label: " Renamed environment ",
560 httpBaseUrl: "http://100.65.180.100:3773/path",
561 },
562 entry: Option.some({
563 target: new BearerConnectionTarget({
564 environmentId,
565 label: "Old label",
566 connectionId: "bearer:environment-paired",
567 }),
568 profile: Option.some(
569 new BearerConnectionProfile({
570 connectionId: "bearer:environment-paired",
571 environmentId,
572 label: "Old label",
573 httpBaseUrl: "http://old.example.test/",
574 wsBaseUrl: "ws://old.example.test/",
575 }),
576 ),
577 enabled: true,
578 }),
579 credential: Option.some(new BearerConnectionCredential({ token: "bearer-token" })),
580 });
581
582 expect(registration).toMatchObject({
583 target: {
584 environmentId,
585 label: "Renamed environment",
586 connectionId: "bearer:environment-paired",
587 },
588 profile: {
589 environmentId,
590 label: "Renamed environment",
591 httpBaseUrl: "http://100.65.180.100:3773/",
592 wsBaseUrl: "ws://100.65.180.100:3773/",
593 },
594 credential: { token: "bearer-token" },
595 });
596 }),
597 );
598
599 it.effect("prepares an SSH registration from the provisioned platform environment", () =>
600 Effect.gen(function* () {
601 const target = {
602 alias: "devbox",
603 hostname: "devbox.example.test",
604 username: "developer",
605 port: 22,
606 };
607 const registration = yield* prepareSshRegistration({
608 target,
609 }).pipe(
610 Effect.provideService(
611 ClientCapabilities.SshEnvironmentGateway,
612 ClientCapabilities.SshEnvironmentGateway.of({
613 provision: () =>
614 Effect.succeed({
615 environmentId: EnvironmentId.make("environment-ssh"),
616 label: "Remote development box",
617 bootstrap: {
618 target,
619 httpBaseUrl: "http://127.0.0.1:3201",
620 wsBaseUrl: "ws://127.0.0.1:3201",
621 pairingToken: "pairing-token",
622 },
623 bearerToken: "bearer-token",
624 }),
625 prepare: () => Effect.die("unused"),
626 disconnect: () => Effect.die("unused"),
627 }),
628 ),
629 );
630
631 expect(registration).toMatchObject({
632 _tag: "SshConnectionRegistration",
633 target: {
634 environmentId: "environment-ssh",
635 label: "Remote development box",
636 connectionId: 'ssh:environment-ssh:["devbox","devbox.example.test","developer",22]',
637 },
638 profile: {
639 environmentId: "environment-ssh",
640 label: "Remote development box",
641 connectionId: 'ssh:environment-ssh:["devbox","devbox.example.test","developer",22]',
642 target,
643 },
644 });
645 }),
646 );
647});