Skip to content

Commit 88b632b

Browse files
authored
Merge branch 'main' into fix/web-files-tree-font-size
2 parents 3c7c4e7 + 8630e1a commit 88b632b

8 files changed

Lines changed: 355 additions & 37 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 157 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ concurrency:
1414
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1515

1616
jobs:
17-
check:
18-
name: Check
17+
# Lint, typecheck, and the desktop build each get a runner so they run side by
18+
# side instead of one after another. The `Check` job at the end of this file
19+
# passes only when every other job does.
20+
lint:
21+
name: Lint
1922
runs-on: blacksmith-8vcpu-ubuntu-2404
2023
timeout-minutes: 10
2124
steps:
@@ -52,27 +55,86 @@ jobs:
5255
- name: Check
5356
run: vp check
5457

58+
typecheck:
59+
name: Typecheck
60+
runs-on: blacksmith-8vcpu-ubuntu-2404
61+
timeout-minutes: 10
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v6
65+
with:
66+
sparse-checkout: |
67+
/*
68+
!/.repos/
69+
sparse-checkout-cone-mode: false
70+
71+
- name: Setup Vite+
72+
uses: voidzero-dev/setup-vp@v1
73+
with:
74+
node-version-file: package.json
75+
cache: true
76+
run-install: true
77+
78+
- name: Ensure Electron runtime is installed
79+
run: vp run --filter @t3tools/desktop ensure:electron
80+
5581
- name: Typecheck
5682
run: vpr typecheck
5783

84+
build:
85+
name: Build
86+
runs-on: blacksmith-8vcpu-ubuntu-2404
87+
timeout-minutes: 10
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v6
91+
with:
92+
sparse-checkout: |
93+
/*
94+
!/.repos/
95+
sparse-checkout-cone-mode: false
96+
5897
- uses: ./.github/actions/setup-apt-mirrors
5998

60-
- name: Install browser secret helper build libraries
99+
# Runs in the background while Vite+ installs; the step before the build waits for it.
100+
- name: Start installing browser secret helper build libraries
61101
run: |
62102
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
63-
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
103+
(
104+
set +e
105+
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
106+
echo "$?" > "$RUNNER_TEMP/apt-status"
107+
) > "$RUNNER_TEMP/apt.log" 2>&1 < /dev/null &
108+
109+
- name: Setup Vite+
110+
uses: voidzero-dev/setup-vp@v1
111+
with:
112+
node-version-file: package.json
113+
cache: true
114+
run-install: true
115+
116+
- name: Ensure Electron runtime is installed
117+
run: vp run --filter @t3tools/desktop ensure:electron
118+
119+
- name: Finish installing browser secret helper build libraries
120+
timeout-minutes: 5
121+
run: |
122+
until test -s "$RUNNER_TEMP/apt-status"; do sleep 1; done
123+
cat "$RUNNER_TEMP/apt.log"
124+
exit "$(cat "$RUNNER_TEMP/apt-status")"
64125
65126
- name: Build desktop pipeline
66127
run: vp run build:desktop
67128

68129
- name: Verify preload bundle output
69130
run: node apps/desktop/scripts/verify-preload-bundle.mjs
70131

71-
# Everything except `t3` (apps/server). `--parallel` drops the package
72-
# dependency ordering that `vp run` applies by default: these `test` tasks
73-
# declare no `dependsOn` and resolve workspace deps from source, so ordering
74-
# only bought us idle runners between dependency layers. The concurrency
75-
# limit stays at the default 4 so peak load per runner is unchanged.
132+
# Everything except `t3` (apps/server) and the web app, which has its own job
133+
# below. `--parallel` drops the package dependency ordering that `vp run`
134+
# applies by default: these `test` tasks declare no `dependsOn` and resolve
135+
# workspace deps from source, so ordering only bought us idle runners between
136+
# dependency layers. The concurrency limit stays at the default 4 so peak load
137+
# per runner is unchanged.
76138
test:
77139
name: Test
78140
runs-on: blacksmith-8vcpu-ubuntu-2404
@@ -86,6 +148,19 @@ jobs:
86148
!/.repos/
87149
sparse-checkout-cone-mode: false
88150

151+
- uses: ./.github/actions/setup-apt-mirrors
152+
153+
# The desktop tests compile the browser secret helper. The install runs in
154+
# the background while Vite+ installs; the step before the tests waits for it.
155+
- name: Start installing browser secret helper build libraries
156+
run: |
157+
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
158+
(
159+
set +e
160+
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
161+
echo "$?" > "$RUNNER_TEMP/apt-status"
162+
) > "$RUNNER_TEMP/apt.log" 2>&1 < /dev/null &
163+
89164
- name: Setup Vite+
90165
uses: voidzero-dev/setup-vp@v1
91166
with:
@@ -96,34 +171,61 @@ jobs:
96171
- name: Ensure Electron runtime is installed
97172
run: vp run --filter @t3tools/desktop ensure:electron
98173

99-
- uses: ./.github/actions/setup-apt-mirrors
100-
101-
- name: Install browser secret helper build libraries
102-
run: |
103-
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
104-
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
105-
106174
- name: Test preview artifact validation
107175
run: python3 -B .github/scripts/stage-preview-bundle.test.py
108176

109177
- name: Test nightly release checks
110178
run: node --test .github/scripts/check-nightly-release.test.cjs
111179

180+
- name: Finish installing browser secret helper build libraries
181+
timeout-minutes: 5
182+
run: |
183+
until test -s "$RUNNER_TEMP/apt-status"; do sleep 1; done
184+
cat "$RUNNER_TEMP/apt.log"
185+
exit "$(cat "$RUNNER_TEMP/apt-status")"
186+
187+
- name: Test
188+
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web' test
189+
190+
# The web suite is the largest outside the server. In the shared Test job it
191+
# started last and ran alone for about 40s after everything else finished.
192+
test_web:
193+
name: Test Web
194+
runs-on: blacksmith-8vcpu-ubuntu-2404
195+
timeout-minutes: 10
196+
steps:
197+
- name: Checkout
198+
uses: actions/checkout@v6
199+
with:
200+
sparse-checkout: |
201+
/*
202+
!/.repos/
203+
sparse-checkout-cone-mode: false
204+
205+
- name: Setup Vite+
206+
uses: voidzero-dev/setup-vp@v1
207+
with:
208+
node-version-file: package.json
209+
cache: true
210+
run-install: true
211+
112212
- name: Test
113-
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
213+
run: vp run --filter @t3tools/web test
114214

115-
# apps/server sets `fileParallelism: false`, so its 239 files run strictly
215+
# apps/server sets `fileParallelism: false`, so its test files run strictly
116216
# one at a time. Sharding spreads them over separate runners instead of
117217
# separate workers, so no two server test files ever share a machine and the
118-
# isolation that flag buys is preserved exactly.
218+
# isolation that flag buys is preserved exactly. One file at a time keeps
219+
# about 1.5 cores busy, so 4 vCPU runners lose nothing against 8. The shards
220+
# split files by recorded duration (apps/server/src/testUtils/weightedShardSequencer.ts).
119221
test_server:
120222
name: Test Server ${{ matrix.shard }}
121-
runs-on: blacksmith-8vcpu-ubuntu-2404
223+
runs-on: blacksmith-4vcpu-ubuntu-2404
122224
timeout-minutes: 10
123225
strategy:
124226
fail-fast: false
125227
matrix:
126-
shard: [1, 2, 3]
228+
shard: [1, 2, 3, 4, 5, 6]
127229
steps:
128230
- name: Checkout
129231
uses: actions/checkout@v6
@@ -347,3 +449,37 @@ jobs:
347449
348450
- name: Exercise release-only workflow steps
349451
run: node scripts/release-smoke.ts
452+
453+
# Branch protection requires this job by its name, `Check`. It fails when any
454+
# other job fails, is cancelled, or is skipped without a reason, so splitting
455+
# or resharding jobs needs no ruleset change. Add every new job to `needs`.
456+
# `always()` rather than `!cancelled()`: a skipped job reports success to
457+
# branch protection, so a cancelled run must still produce a failing check.
458+
check:
459+
name: Check
460+
if: ${{ always() }}
461+
needs:
462+
[
463+
lint,
464+
typecheck,
465+
build,
466+
test,
467+
test_web,
468+
test_server,
469+
rust,
470+
mobile_native_changes,
471+
mobile_native_static_analysis,
472+
release_smoke,
473+
]
474+
runs-on: blacksmith-2vcpu-ubuntu-2404
475+
timeout-minutes: 5
476+
steps:
477+
- name: Require every job to pass
478+
env:
479+
RESULTS: ${{ toJSON(needs) }}
480+
run: |
481+
echo "$RESULTS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
482+
# Only the macOS lint skips on purpose, when no native mobile code changed.
483+
echo "$RESULTS" | jq -e 'all(to_entries[];
484+
.value.result == "success"
485+
or (.key == "mobile_native_static_analysis" and .value.result == "skipped"))' > /dev/null

‎.github/workflows/release-desktop.yml‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ jobs:
109109
# This repository is public, so Git needs no credentials. checkout's
110110
# credential cleanup runs submodule foreach even with submodules disabled,
111111
# which fails on the orphaned gitlinks in our vendored .repos tree.
112+
# checkout.workers=0 writes the files on every core. Alternating both ways
113+
# in one job on the Windows runners, it wrote the files about 10s faster
114+
# (about 40% on arm64).
112115
- name: Checkout
113116
shell: bash
114117
env:
@@ -120,28 +123,21 @@ jobs:
120123
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
121124
git fetch --no-tags --depth=1 origin "$CHECKOUT_REF"
122125
git sparse-checkout set --no-cone '/*' '!/.repos/'
123-
git checkout --detach FETCH_HEAD
124-
126+
git -c checkout.workers=0 checkout --detach FETCH_HEAD
127+
128+
# Windows installs straight from the registry. There, linking the packages
129+
# takes the time, not downloading them, so a ~700 MB package cache did not
130+
# pay for its own restore. Across recent nightlies, restore plus install
131+
# took 183-233s on arm64 and 116-172s on x64, while a plain install took
132+
# 142-210s and 84-160s. The arm64 entries also filled 4 GB of the
133+
# repository's 10 GB Actions cache.
125134
- name: Setup Vite+
126135
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
127136
with:
128137
node-version-file: package.json
129138
cache: ${{ inputs.platform != 'win' }}
130139
run-install: false
131140

132-
- name: Resolve Windows package cache path
133-
if: inputs.platform == 'win'
134-
id: package_cache_path
135-
shell: pwsh
136-
run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
137-
138-
- name: Cache Windows packages
139-
if: inputs.platform == 'win'
140-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
141-
with:
142-
path: ${{ steps.package_cache_path.outputs.path }}
143-
key: windows-release-packages-v1-${{ inputs.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
144-
145141
# pnpm checks the lockfile and policy before reusing this result. A missing
146142
# artifact leaves the cache empty, so installation runs the checks again.
147143
- name: Download dependency verification
@@ -217,8 +213,11 @@ jobs:
217213
name: cli-linux-${{ inputs.arch }}
218214
path: wsl-runtime
219215

216+
# Only the resource monitor build needs these libraries. With a cached
217+
# monitor, the desktop build's preflight skips its MSVC check, and node-pty
218+
# ships prebuilt Windows binaries, so the 30-60s install is skipped too.
220219
- name: Install Spectre-mitigated MSVC libs
221-
if: inputs.platform == 'win'
220+
if: inputs.platform == 'win' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
222221
shell: pwsh
223222
run: |
224223
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// @effect-diagnostics nodeBuiltinImport:off - a one-off maintenance script with no
2+
// Effect runtime; it only spawns vitest and reads and writes two files.
3+
// Run with: node apps/server/scripts/update-test-shard-weights.ts
4+
// Runs the whole server suite once and records how long each test file takes,
5+
// so CI can split the suite into shards of equal duration. See
6+
// src/testUtils/weightedShardSequencer.ts. Rerun it when a shard in CI runs
7+
// much longer than the others.
8+
import * as NodeChildProcess from "node:child_process";
9+
import * as NodeFS from "node:fs";
10+
import * as NodeOS from "node:os";
11+
import * as NodePath from "node:path";
12+
import * as NodeURL from "node:url";
13+
14+
// Files faster than this are all treated alike, which keeps the weights file short.
15+
const MIN_RECORDED_SECONDS = 0.5;
16+
17+
interface VitestJsonReport {
18+
readonly testResults: ReadonlyArray<{
19+
readonly name: string;
20+
readonly startTime: number;
21+
readonly endTime: number;
22+
}>;
23+
}
24+
25+
const serverDir = NodeURL.fileURLToPath(new URL("..", import.meta.url));
26+
const weightsPath = NodePath.join(serverDir, "src/testUtils/shardWeights.json");
27+
const reportDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-server-test-report-"));
28+
const reportPath = NodePath.join(reportDir, "report.json");
29+
30+
// `node --run` puts the package's own `vp` on PATH, on every platform. Failing
31+
// tests still report their duration, so the exit code is not checked.
32+
NodeChildProcess.spawnSync(
33+
process.execPath,
34+
["--run", "test", "--", "--reporter=json", `--outputFile=${reportPath}`],
35+
{ cwd: serverDir, stdio: "inherit" },
36+
);
37+
38+
const report: VitestJsonReport = JSON.parse(NodeFS.readFileSync(reportPath, "utf8"));
39+
NodeFS.rmSync(reportDir, { recursive: true, force: true });
40+
41+
const weights = Object.fromEntries(
42+
report.testResults
43+
.map(
44+
(file) =>
45+
[
46+
NodePath.relative(serverDir, file.name).replaceAll("\\", "/"),
47+
Math.round((file.endTime - file.startTime) / 100) / 10,
48+
] as const,
49+
)
50+
.filter(([, seconds]) => seconds >= MIN_RECORDED_SECONDS)
51+
.toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),
52+
);
53+
54+
NodeFS.writeFileSync(weightsPath, `${JSON.stringify(weights, null, 2)}\n`);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"integration/orchestrationEngine.integration.test.ts": 1.9,
3+
"integration/providerService.integration.test.ts": 0.5,
4+
"src/bin.test.ts": 0.8,
5+
"src/checkpointing/CheckpointStore.test.ts": 0.6,
6+
"src/device/sshDeviceScript.test.ts": 2.9,
7+
"src/git/GitManager.test.ts": 18.7,
8+
"src/orchestration/Layers/CheckpointReactor.test.ts": 7.1,
9+
"src/orchestration/Layers/OrchestrationEngine.test.ts": 1.4,
10+
"src/orchestration/Layers/ProjectionPipeline.test.ts": 0.5,
11+
"src/orchestration/Layers/ProviderCommandReactor.test.ts": 3.8,
12+
"src/orchestration/Layers/ProviderRuntimeIngestion.test.ts": 2.4,
13+
"src/persistence/Layers/OrchestrationEventStore.test.ts": 2.2,
14+
"src/process/externalLauncher.test.ts": 2.2,
15+
"src/project/AgentSessionScanner.test.ts": 4.3,
16+
"src/provider/CodexChatGptAuth.test.ts": 5.9,
17+
"src/provider/Drivers/AntigravityDriver.test.ts": 2,
18+
"src/provider/Layers/AntigravityAdapter.test.ts": 0.5,
19+
"src/provider/Layers/ClaudeAdapter.test.ts": 0.7,
20+
"src/provider/Layers/CodexCollabRuntime.integration.test.ts": 3.4,
21+
"src/provider/Layers/CursorAdapter.test.ts": 8,
22+
"src/provider/Layers/CursorProvider.test.ts": 1.4,
23+
"src/provider/Layers/GrokAdapter.test.ts": 9,
24+
"src/provider/Layers/GrokProvider.test.ts": 0.7,
25+
"src/provider/Layers/ProviderService.test.ts": 0.5,
26+
"src/provider/acp/AcpJsonRpcConnection.test.ts": 6.2,
27+
"src/provider/acp/XAiAcpExtension.test.ts": 0.6,
28+
"src/provider/opencodeRuntime.environment.test.ts": 1.1,
29+
"src/pullRequest/PullRequestService.test.ts": 3.1,
30+
"src/server.test.ts": 10.2,
31+
"src/serverSettings.test.ts": 0.5,
32+
"src/serviceLauncher.test.ts": 6.2,
33+
"src/terminal/Manager.test.ts": 1.6,
34+
"src/textGeneration/CursorTextGeneration.test.ts": 0.8,
35+
"src/textGeneration/GrokTextGeneration.test.ts": 1.2,
36+
"src/usage/usageTranscriptStreaming.test.ts": 0.8,
37+
"src/vcs/GitVcsDriver.test.ts": 3.7,
38+
"src/vcs/GitVcsDriverCore.test.ts": 6.5,
39+
"src/workspace/WorkspaceEntries.test.ts": 1.9
40+
}

0 commit comments

Comments
 (0)