Skip to content

Commit cc6cb6f

Browse files
committed
fix(preview): explain display surface recovery steps
Preserve host readiness guidance after native error serialization. > 🤖 Generated by gpt-6.1-sol in Codex via T3 Code.
1 parent 81f6305 commit cc6cb6f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/desktop/src/preview/captureErrors.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as Cause from "effect/Cause";
44
import * as Schema from "effect/Schema";
55
import { normalizeCaptureFailure } from "./captureErrors.ts";
66
const encodeCaptureFailure = Schema.encodeSync(PreviewCaptureFailure);
7+
const decodeCaptureFailure = Schema.decodeSync(PreviewCaptureFailure);
78
const encodeJson = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
89

910
it("preserves a native pixel capture timeout across the encoded IPC result", () => {
@@ -51,11 +52,18 @@ it.each(["captureScreenshot.capturePage"])(
5152
},
5253
"screenshot",
5354
);
54-
expect(encodeCaptureFailure(failure)).toEqual({
55+
const encoded = encodeCaptureFailure(failure);
56+
expect(encoded).toEqual({
5557
_tag: "PreviewCaptureFailure",
5658
reason: "capture-unavailable",
5759
stage: "capture-page",
5860
});
61+
const decoded = decodeCaptureFailure(encoded);
62+
expect(decoded).toMatchObject({ reason: "capture-unavailable", stage: "capture-page" });
63+
expect(decoded.message).toContain("target tab");
64+
expect(decoded.message).toContain("unlocked");
65+
expect(decoded.message).toContain("display is on");
66+
expect(decoded.message).toContain("window is restored");
5967
},
6068
);
6169

‎packages/contracts/src/previewCapture.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function previewCaptureFailureMessage(diagnostic: PreviewCaptureDiagnostic): str
1717
case "renderer-unavailable":
1818
return "The preview renderer is unavailable. Reopen the preview tab before retrying.";
1919
case "capture-unavailable":
20-
return "The preview capture surface is unavailable. Present the target tab before retrying.";
20+
return "The preview capture surface is unavailable. Present the target tab and check that the preview host is unlocked, its display is on and its window is restored before retrying.";
2121
case "capture-timeout":
2222
return `Preview capture timed out during ${diagnostic.stage}. Check the preview host's lock, display and window state before retrying.`;
2323
case "recording-conflict":

0 commit comments

Comments
 (0)