Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): reject unresolved explicit preview tabs #19737

Mergedaravhawk(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/19737/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 122 additions and 0 deletions.

x
0 of 2 viewed, 2 left
108 additions and 0 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -298,6 +298,114 @@
desktopConnections.length = 0;
});
​
+it.live.each(["desktop" as const, undefined])(
+ "explicit desktop targets ($0 runtime) fail without creating a server tab",
+ (runtime) =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const { broker, tabId } = yield* ready;
+ const manager = yield* Manager.PreviewManager;
+ const desktop = yield* manager.open({
+ threadId: scope.thread.threadId,
+ url: "https://example.com/original",
+ ...(runtime === undefined ? {} : { runtime }),
+ });
+ const before = yield* manager.list({ threadId: scope.thread.threadId });
+ const error = yield* broker
+ .invoke<PreviewAutomationStatus>({
+ scope,
+ tabId: PreviewTabId.make(desktop.tabId),
+ operation: "open",
+ input: { url: "https://example.com/replacement", open: true },
+ })
+ .pipe(Effect.flip);
+ expect(error).toMatchObject({ _tag: "PreviewAutomationExecutionError" });
+ expect(error.message).toContain("desktop runtime");
+ expect(error.message).toContain("cannot control");
+ expect(yield* manager.list({ threadId: scope.thread.threadId })).toEqual(before);
+ expect(contexts).toHaveLength(1);