Skip to content

Commit 2736ec0

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix/i7076-overlapping-vcs-status-refreshes-multipl
2 parents 654ba92 + e63d80a commit 2736ec0

353 files changed

Lines changed: 17882 additions & 3189 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/ci.yml‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,22 @@ jobs:
355355
356356
# The web suite is the largest outside the server. In the shared Test job it
357357
# started last and ran alone for about 40s after everything else finished.
358-
# release.yml mirrors this test, test_web, and test_server split.
358+
# Browser tests are bound by the Vite server transforming modules for each
359+
# file, not by Chromium, so a second runner (and Vite server) halves the job
360+
# that gated every run. release.yml mirrors this test, test_web, and test_server split.
359361
test_web:
360362
permissions:
361363
contents: read
362364
id-token: write
363-
name: Test Web
365+
name: Test Web ${{ matrix.shard }}
364366
needs: changes
365367
if: ${{ !cancelled() && needs.changes.outputs.test_web != 'false' }}
366368
runs-on: blacksmith-8vcpu-ubuntu-2404
367369
timeout-minutes: 10
370+
strategy:
371+
fail-fast: false
372+
matrix:
373+
shard: [1, 2]
368374
steps:
369375
- name: Checkout
370376
uses: actions/checkout@v6
@@ -406,7 +412,7 @@ jobs:
406412
fi
407413
408414
- name: Test
409-
run: vp run --filter @t3tools/web test
415+
run: vp run --filter @t3tools/web test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
410416

411417
# apps/server sets `fileParallelism: false`, so its test files run strictly
412418
# one at a time. Sharding spreads them over separate runners instead of
@@ -481,6 +487,17 @@ jobs:
481487
node apps/server/node_modules/playwright-core/cli.js install-deps chromium
482488
fi
483489
490+
# Each server test file runs in its own Vitest process, and a fresh install starts
491+
# Vitest's content-keyed module cache empty, so every file re-transformed its imports.
492+
# Only pushes to main save it, so pull requests never evict each other's entries.
493+
- name: Restore Vitest module cache
494+
if: steps.changes.outputs.test_server != 'false'
495+
uses: actions/cache/restore@v6
496+
with:
497+
path: node_modules/.vitest-cache
498+
key: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
499+
restore-keys: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
500+
484501
- name: Test
485502
if: steps.changes.outputs.test_server != 'false'
486503
env:
@@ -489,15 +506,14 @@ jobs:
489506
run: >-
490507
vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }}
491508
--uncached apps/server/integration/transferBudgetV2.integration.test.ts
492-
--verify-hits 1 --report "${{ runner.temp }}/test-cache-${{ matrix.shard }}.json" apps/server
509+
--verify-hits 1 apps/server
493510
494-
- name: Upload test cache measurements
495-
if: always() && steps.changes.outputs.test_server != 'false'
496-
uses: actions/upload-artifact@v7
511+
- name: Save Vitest module cache
512+
if: github.event_name == 'push' && steps.changes.outputs.test_server != 'false'
513+
uses: actions/cache/save@v6
497514
with:
498-
name: test-cache-${{ matrix.shard }}
499-
path: ${{ runner.temp }}/test-cache-${{ matrix.shard }}.json
500-
if-no-files-found: error
515+
path: node_modules/.vitest-cache
516+
key: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
501517

502518
# integration/transferBudgetV2.integration.test.ts writes the report; exactly one shard
503519
# produces these files. Gating the upload on their presence keeps a

‎.github/workflows/release.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,15 @@ jobs:
300300
# Web browser tests time out when they share a runner with the other package
301301
# suites: Chromium gets too little CPU and diff workers miss their 10s start budget.
302302
test_web:
303-
name: Release web tests
303+
name: Release web tests ${{ matrix.shard }}
304304
needs: [preflight]
305305
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
306306
runs-on: blacksmith-8vcpu-ubuntu-2404
307307
timeout-minutes: 10
308+
strategy:
309+
fail-fast: false
310+
matrix:
311+
shard: [1, 2]
308312
steps:
309313
- name: Checkout
310314
uses: actions/checkout@v6
@@ -344,10 +348,11 @@ jobs:
344348
fi
345349
346350
- name: Test
347-
run: vp run --filter @t3tools/web test
351+
run: vp run --filter @t3tools/web test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
348352

349353
# Browser tests run source modules; this boots the production chunk graph.
350354
- name: Boot the built web client
355+
if: matrix.shard == 1
351356
run: |
352357
vp run --filter @t3tools/web build
353358
node apps/web/scripts/verify-built-boot.ts

‎apps/desktop/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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)