Skip to content

Commit 8025073

Browse files
Merge branch 'main' into fix/issue-23041
2 parents b832332 + f31ce3e commit 8025073

490 files changed

Lines changed: 22050 additions & 3738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,18 @@ jobs:
14821482
14831483
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
14841484
git commit --no-verify -m "chore(release): prepare $RELEASE_TAG"
1485-
git push origin HEAD:main
1485+
1486+
# main moves while this job runs, so a rejected push rebases and retries.
1487+
for attempt in 1 2 3 4 5; do
1488+
if git push origin HEAD:main; then
1489+
exit 0
1490+
fi
1491+
echo "Push rejected (attempt $attempt). Rebasing onto latest main."
1492+
git pull --rebase origin main
1493+
done
1494+
1495+
echo "Could not push the version bump after 5 attempts." >&2
1496+
exit 1
14861497
14871498
announce_discord:
14881499
name: Announce release on Discord

‎apps/desktop/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",
@@ -37,6 +37,7 @@
3737
"acorn": "8.16.0",
3838
"cross-env": "^10.1.0",
3939
"electron-builder": "26.16.1",
40+
"jsdom": "^30.0.1",
4041
"tailwindcss": "^4.0.0",
4142
"vite-plus": "catalog:"
4243
},

‎apps/desktop/src/app/ClerkTokenStore.test.ts‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import * as NodeFS from "node:fs";
33
import * as NodeOS from "node:os";
44
import * as NodePath from "node:path";
55
import { assert, describe, it } from "@effect/vitest";
6-
import { vi } from "vite-plus/test";
7-
8-
vi.mock("node:fs", { spy: true });
96

107
import { openClerkTokenStorage, type ClerkTokenStorage } from "./ClerkTokenStore.ts";
118

@@ -91,24 +88,6 @@ describePosix("ClerkTokenStore", () => {
9188
});
9289
});
9390

94-
it("removes the legacy token file when the private copy already exists", async () => {
95-
await withStateDir((stateDir) => {
96-
const directory = NodePath.join(stateDir, "clerk");
97-
const legacyPath = NodePath.join(stateDir, "clerk-tokens.json");
98-
const tokenPath = NodePath.join(directory, "clerk-tokens.json");
99-
NodeFS.mkdirSync(directory, { mode: 0o755 });
100-
writeLoose(legacyPath, "stale-credential");
101-
writeLoose(tokenPath, "kept-credential");
102-
103-
openClerkTokenStorage(stateDir, () => idleStorage());
104-
105-
assert.equal(NodeFS.existsSync(legacyPath), false);
106-
assert.equal(modeOf(directory), 0o700);
107-
assert.equal(modeOf(tokenPath), 0o600);
108-
assert.equal(NodeFS.readFileSync(tokenPath, "utf8"), "kept-credential");
109-
});
110-
});
111-
11291
it("resolves a relative state directory before opening storage", async () => {
11392
await withStateDir(async (stateDir) => {
11493
const relativeStateDir = NodePath.relative(process.cwd(), stateDir);
@@ -150,23 +129,6 @@ describePosix("ClerkTokenStore", () => {
150129
});
151130
});
152131

153-
it("migrates tokens when the legacy directory is on another filesystem", async () => {
154-
await withStateDir((stateDir) => {
155-
const legacyPath = NodePath.join(stateDir, "clerk-tokens.json");
156-
writeLoose(legacyPath, "existing-session");
157-
using _rename = vi.spyOn(NodeFS, "renameSync").mockImplementation(() => {
158-
throw Object.assign(new Error("cross-device link"), { code: "EXDEV" });
159-
});
160-
161-
openClerkTokenStorage(stateDir, idleStorage);
162-
163-
const tokenPath = NodePath.join(stateDir, "clerk", "clerk-tokens.json");
164-
assert.equal(NodeFS.readFileSync(tokenPath, "utf8"), "existing-session");
165-
assert.equal(modeOf(tokenPath), 0o600);
166-
assert.equal(NodeFS.existsSync(legacyPath), false);
167-
});
168-
});
169-
170132
it("does not follow a symlinked clerk directory or token file", async () => {
171133
await withStateDir(async (stateDir) => {
172134
const outsideDirectory = NodePath.join(stateDir, "outside-dir");

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

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -607,20 +607,21 @@ describe("DesktopBrowserHost", () => {
607607
params: { sessionId: "t3-preview-page-1" },
608608
});
609609
expect(yield* Queue.take(replies)).toBe(3);
610-
expect(painting).toEqual([true, false]);
610+
expect(painting).toEqual([true]);
611611

612612
// The agent's screenshot waits its turn; painting lets the abandoned one finish first.
613613
yield* command(host, 4, "Page.captureScreenshot");
614614
yield* settle;
615-
expect(painting).toEqual([true, false, true]);
615+
expect(painting).toEqual([true]);
616616
debuggee.release();
617617
expect(yield* Queue.take(replies)).toBe(2);
618618
yield* settle;
619619
expect(debuggee.sent).toEqual([undefined, 4]);
620+
expect(painting).toEqual([true]);
620621
debuggee.release();
621622
expect(yield* Queue.take(replies)).toBe(4);
622623
yield* settle;
623-
expect(painting).toEqual([true, false, true, false]);
624+
expect(painting).toEqual([true, false]);
624625
}).pipe(Effect.scoped),
625626
);
626627

@@ -645,14 +646,19 @@ describe("DesktopBrowserHost", () => {
645646
expect(yield* Queue.take(replies)).toBe(2);
646647
yield* raw({ id: 3, method: "Page.captureScreenshot", sessionId: "t3-preview-page-1" });
647648
yield* settle;
648-
expect(painting).toEqual([true, false, true]);
649+
expect(painting).toEqual([true]);
649650
yield* raw({
650651
id: 4,
651652
method: "Target.detachFromTarget",
652653
params: { sessionId: "t3-preview-page-1" },
653654
});
654655
expect(yield* Queue.take(replies)).toBe(4);
655-
expect(painting).toEqual([true, false, true, false]);
656+
657+
// The agent's answers late; the viewer's is dropped unsent, so nothing is left to paint.
658+
debuggee.release();
659+
yield* settle;
660+
expect(debuggee.sent).toEqual([1]);
661+
expect(painting).toEqual([true, false]);
656662
yield* TestClock.adjust("1 minute");
657663
expect(debuggee.focusEmulation).toEqual([true, false]);
658664
}).pipe(Effect.scoped),
@@ -682,7 +688,7 @@ describe("DesktopBrowserHost", () => {
682688
}).pipe(Effect.scoped),
683689
);
684690

685-
it.effect("stops painting for a screenshot still queued when the agent's turn ends", () =>
691+
it.effect("holds no focus for a screenshot still queued when the agent's turn ends", () =>
686692
Effect.gen(function* () {
687693
const host = yield* DesktopBrowserHost.make;
688694
const debuggee = makeDebuggee();
@@ -697,15 +703,18 @@ describe("DesktopBrowserHost", () => {
697703
yield* settle;
698704
yield* turn(false);
699705
yield* settle;
700-
expect(painting).toEqual([true, false]);
706+
expect(painting).toEqual([true]);
701707

702-
// The first answers late; the second still goes in turn, but holds nothing.
708+
// The first answers late; the second still goes in turn, painting but holding no focus.
703709
debuggee.releaseFirst();
704710
yield* settle;
705711
expect(debuggee.sent).toEqual([1, 2]);
706-
expect(painting).toEqual([true, false]);
707712
yield* TestClock.adjust("1 minute");
708713
expect(debuggee.focusEmulation).toEqual([true, false]);
714+
expect(painting).toEqual([true]);
715+
debuggee.release();
716+
yield* settle;
717+
expect(painting).toEqual([true, false]);
709718
}).pipe(Effect.scoped),
710719
);
711720

@@ -952,7 +961,7 @@ describe("DesktopBrowserHost", () => {
952961
}).pipe(Effect.scoped),
953962
);
954963

955-
it.effect("stops painting for a screenshot Chromium never answers", () =>
964+
it.effect("stops painting for a screenshot Chromium never answers once its document goes", () =>
956965
Effect.gen(function* () {
957966
const host = yield* DesktopBrowserHost.make;
958967
const debuggee = makeDebuggee();
@@ -961,32 +970,34 @@ describe("DesktopBrowserHost", () => {
961970
const turn = (active: boolean) =>
962971
host.handleCommandLine(encodeJson({ type: "turn", threadId: key.threadId, active }));
963972

964-
// The server gave up on it, and the agent's turn ends.
973+
// The server gave up on it, and the agent's turn ends; Chromium still holds the capture.
965974
yield* turn(true);
966975
yield* command(host, 1, "Page.captureScreenshot");
967976
yield* settle;
968977
yield* turn(false);
969978
yield* settle;
970-
expect(painting).toEqual([true, false]);
979+
expect(painting).toEqual([true]);
971980

972981
// The page loads a new document, which also frees the screenshot turn.
973982
debuggee.navigate();
983+
expect(painting).toEqual([true, false]);
974984
yield* command(host, 2, "Page.captureScreenshot");
975985
yield* settle;
976986
debuggee.navigate();
977987
yield* settle;
978988
expect(painting).toEqual([true, false, true, false]);
979989

980-
// The server releases the relay.
990+
// The server releases the relay; Chromium still holds the capture.
981991
yield* command(host, 3, "Page.captureScreenshot");
982992
yield* settle;
983993
yield* host.handleCommandLine(encodeJson({ type: "release", ...key }));
984994
yield* settle;
985-
expect(painting).toEqual([true, false, true, false, true, false]);
995+
expect(painting).toEqual([true, false, true, false, true]);
986996

987997
// The guest detaches; a replacement starts with no screenshot pending.
988998
const replacement = makeDebuggee();
989999
host.attach(key, replacement.tab);
1000+
expect(painting).toEqual([true, false, true, false, true, false]);
9901001
yield* command(host, 4, "Page.captureScreenshot");
9911002
yield* settle;
9921003
host.detach(key);

0 commit comments

Comments
 (0)