Skip to content

Commit 5ef2f22

Browse files
committed
fix(fork): test capture diagnostics through frame fallback
1 parent df9c3e1 commit 5ef2f22

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

‎FORK.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,9 @@ The tracked accessory note is [PREVIEW_RECORDING_START.md](PREVIEW_RECORDING_STA
849849

850850
**Worktree branch:** `fix/preview-capture-diagnostics`
851851

852-
The standalone worktree is `E:/Projects/t3code.worktrees/preview-capture-diagnostics`, at HEAD `8d8196e4d2df519519e94ce1e01abba4dd77cd8d` directly above fixed `base/main` `48b71f0eb323d08c8fcadfe54adf34becb2984da`. The clean source branch tracks `origin/fix/preview-capture-diagnostics`; `base/main` remains its comparison base. Its source commit is published and retains all thirteen customization files unchanged. Historical locked-state proof below retains its original source attribution.
852+
The standalone worktree is `E:/Projects/t3code.worktrees/preview-capture-diagnostics`, at HEAD `104d61b2b1da9417b8879c92f0137b35b083ddd4` above customization baseline `94e03f4dc89c924807797ccf8825b48d1e2d03f3` and fixed `base/main` `c77a7b7eebd6ea8a3a63bbcaaa7c1707fe65c86e`. The clean source branch tracks `origin/fix/preview-capture-diagnostics`; `base/main` remains its comparison base. The capture-message helper is private, removing its unused-export lint defect without changing diagnostics. Historical locked-state proof below retains its original source attribution.
853853

854-
Status is VALID ADAPTED with PASSING actual Windows locked/off acquisition-error diagnostics, cleanup and same-original-guest retry. Incoming agent browser automation moved to the environment server and supersedes old desktop agent/broker propagation. Surviving diagnostics preserve safe typed native screenshot/recording failures through IPC and the direct primary cause through the recording wrapper/UI. Capture, fallback, permissions, power behavior and server-browser CDP are outside this customization; no new CDP proof was produced.
854+
Status is VALID ADAPTED. Current branch Windows proof covers native tagged failures, renderer decoding, actionable fixture toast presentation, real screenshot and recording, and cleanup. Historical actual locked/off acquisition-error diagnostics and same-original-guest retry retain their recorded source attribution. Incoming agent browser automation moved to the environment server and supersedes old desktop agent/broker propagation. Surviving diagnostics preserve safe typed native screenshot/recording failures through IPC and the direct primary cause through the recording wrapper/UI. Capture, fallback, permissions, power behavior and server-browser CDP are outside this customization; no new CDP proof was produced.
855855

856856
Chronology is fixed `26285ab` to rebased/adapted source and reviewed `85593b3e2f313db3e58ed1ac88fc55c273ca4639`, including the generic-cleanup correction. Genuine locked/display-off Windows `getDisplayMedia` then rejected with `NotReadableError / Could not start video source` after native source grant, but the actual production toast remained generic. That reproduced defect justified the small `14f3cbc` formatter fix. It recognizes the reached `NotReadableError` DOMException only for `capture-media-stream`, including the producer's explicitly stored primary cause if cleanup also fails. It adds unlock/display-on/retry guidance while preserving native name/message, stored causes, generic cleanup wording and recording behavior. The follow-up passed 35 focused recording tests, web typecheck and targeted lint, then actual exact-final actionable-toast, cleanup and retry proof.
857857

‎PREVIEW_CAPTURE_DIAGNOSTICS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
This is the tracked text accessory copy for `fix/preview-capture-diagnostics`.
44

5-
The standalone worktree is `E:/Projects/t3code.worktrees/preview-capture-diagnostics`, at published HEAD `d0df02a17cb872a893341e28b19faed04bd1f770`, directly above pinned `base/main` `43f8a8de17a7ac1baa7a3cf36d681856de2d8add`. It tracks `origin/fix/preview-capture-diagnostics`, with `base/main` as its comparison base. Main combines the diagnostic contract with native screenshots and requester-bound recording. Acquisition tests use that recording path and prove canvas fallback rejection and a fresh-frame retry.
5+
The standalone worktree is `E:/Projects/t3code.worktrees/preview-capture-diagnostics`, at published HEAD `104d61b2b1da9417b8879c92f0137b35b083ddd4`, preserving baseline `94e03f4dc89c924807797ccf8825b48d1e2d03f3` directly above pinned `base/main` `c77a7b7eebd6ea8a3a63bbcaaa7c1707fe65c86e`. It tracks `origin/fix/preview-capture-diagnostics`, with `base/main` as its comparison base. The private capture-message helper removes an unused-export lint defect without behavior change. Main combines the diagnostic contract with native screenshots and requester-bound recording. Acquisition tests use that recording path and prove canvas fallback rejection and a fresh-frame retry.
66

7-
Current-source Windows proof covers native tagged failures, renderer decoding, actionable fixture toast presentation, real screenshot and changing native recording, and cleanup. Genuine acquisition rejection, full toolbar/MCP routing and fresh locked/display-off behavior remain unverified on this source. Current receipts and review qualifications are in the worktree's ignored `BRANCH_DETAILS.md`; PR 17244's substantive workflows require maintainer approval.
7+
Current-source Windows proof covers native tagged failures, renderer decoding, actionable fixture toast presentation, real screenshot and changing native recording, and cleanup. Genuine acquisition rejection, full toolbar/MCP routing and fresh locked/display-off behavior remain unverified on this source. Scoped branch checks and the current-head hosted lint pass. Hosted Typecheck is blocked by a removed ChatView setter in a newer upstream synthetic merge, absent from this pinned source. Current receipts and review qualifications are in the worktree's ignored BRANCH_DETAILS.md. Historical proof below retains its own source attribution.
88

99
## Historical acquisition proof at 26285ab
1010

‎apps/web/src/browser/browserRecording.test.ts‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -781,16 +781,20 @@ describe("browser recording", () => {
781781
});
782782

783783
it.each([false, true])(
784-
"explains real video-source rejection and permits retry when cleanup fails: %s",
784+
"explains fallback video-source rejection and permits retry when cleanup fails: %s",
785785
async (cleanupFails) => {
786786
const cause = new DOMException("Could not start video source", "NotReadableError");
787787
const cleanupCause = new Error("native stop failed");
788-
getDisplayMedia.mockRejectedValueOnce(cause);
788+
const frames = prepareFrameFallback();
789+
frames.canvas.captureStream.mockImplementationOnce(() => {
790+
throw cause;
791+
});
789792
if (cleanupFails) stopScreencast.mockRejectedValueOnce(cleanupCause);
790793

791-
const error = await startBrowserRecording("recording-tab").catch(
792-
(failure: unknown) => failure,
793-
);
794+
const failed = startBrowserRecording("recording-tab").catch((failure: unknown) => failure);
795+
await frames.ready;
796+
await frames.receive();
797+
const error = await failed;
794798
expect(error).toMatchObject({
795799
_tag: "BrowserRecordingOperationError",
796800
operation: "capture-media-stream",
@@ -806,16 +810,20 @@ describe("browser recording", () => {
806810
expect(readActiveBrowserRecordingTabIds()).toEqual(new Set());
807811
expect(useBrowserSurfaceStore.getState().activityByTabId["recording-tab"]).toBeUndefined();
808812

809-
await startBrowserRecording("recording-tab");
813+
const recoveredFrames = prepareFrameFallback();
814+
const restarted = startBrowserRecording("recording-tab");
815+
await recoveredFrames.ready;
816+
await recoveredFrames.receive();
817+
await restarted;
810818
await stopBrowserRecording("recording-tab");
811-
expect(getDisplayMedia).toHaveBeenCalledTimes(2);
819+
expect(getUserMedia).toHaveBeenCalledTimes(2);
812820
},
813821
);
814822

815823
it("keeps unrecognized acquisition failures generic", async () => {
816824
const cause = new Error("capture failed");
817825
cause.name = "NotReadableError";
818-
getDisplayMedia.mockRejectedValueOnce(cause);
826+
getUserMedia.mockRejectedValueOnce(cause);
819827

820828
await expect(startBrowserRecording("recording-tab")).rejects.toMatchObject({
821829
operation: "capture-media-stream",
@@ -838,13 +846,13 @@ describe("browser recording", () => {
838846
cause,
839847
message: cause.message,
840848
});
841-
expect(getDisplayMedia).not.toHaveBeenCalled();
849+
expect(getUserMedia).not.toHaveBeenCalled();
842850
expect(readActiveBrowserRecordingTabIds()).toEqual(new Set());
843851
expect(useBrowserSurfaceStore.getState().activityByTabId["recording-tab"]).toBeUndefined();
844852

845853
await startBrowserRecording("recording-tab");
846854
await stopBrowserRecording("recording-tab");
847-
expect(getDisplayMedia).toHaveBeenCalledOnce();
855+
expect(getUserMedia).toHaveBeenCalledOnce();
848856
});
849857

850858
it("times out stalled stream acquisition and stops a late stream", async () => {

0 commit comments

Comments
 (0)