The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 14:30 UTC
ci(web): releases fail when the built web app cannot boot (#25929)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 27, 2026 at 05:19 UTC
30f4d6374a0f746812a1f049f43949794f983f77
4 files changed
+70
.github/workflows/ci.yml
+6
@@ -344,6 +344,12 @@ jobs:
344
- name: Test
345
run: vp run --filter @t3tools/web test
346
347
+ # Browser tests run source modules; this boots the production chunk graph.
348
+ - name: Boot the built web client
349
+ run: |
350
+ vp run --filter @t3tools/web build
351
+ node apps/web/scripts/verify-built-boot.ts
352
+
353
# apps/server sets `fileParallelism: false`, so its test files run strictly
354
# one at a time. Sharding spreads them over separate runners instead of
355
# separate workers, so no two server test files ever share a machine and the
.github/workflows/release.yml
+6
@@ -344,6 +344,12 @@ jobs:
344
- name: Test
345
run: vp run --filter @t3tools/web test
346
347
+ # Browser tests run source modules; this boots the production chunk graph.
348
+ - name: Boot the built web client
349
+ run: |
350
+ vp run --filter @t3tools/web build
351
+ node apps/web/scripts/verify-built-boot.ts
352
+
353
# Server test files run one at a time, so more small runners beat fewer big ones.
354
test_server:
355
name: Release server tests ${{ matrix.shard }}
apps/web/scripts/verify-built-boot.ts
new
+57
@@ -0,0 +1,57 @@
1
+// @effect-diagnostics nodeBuiltinImport:off - plain Node script CI runs against the built client.
2
+// Boots the built web client in headless Chromium and fails if it reaches showBootError.
3
+// Source-level browser tests never run the production chunk graph, where boot breaks hide.
4
+import * as NodeFS from "node:fs";
5
+import * as NodePath from "node:path";
6
+import * as NodeURL from "node:url";
7
+import { chromium } from "playwright";
8
+
9
+const distDir = NodeURL.fileURLToPath(new URL("../dist/", import.meta.url));
10
+const origin = "http://t3-boot.test";
11
+// With no server, the client retries its session for about 15s before it renders.
12
+const timeoutMs = 60_000;
13
+
14
+if (!NodeFS.existsSync(NodePath.join(distDir, "index.html"))) {
15
+ console.error(`No web build at ${distDir}. Run the web build first.`);
16
+ process.exit(1);
17
+}
18
+
19
+const browser = await chromium.launch();
20
+try {
21
+ const page = await browser.newPage();
22
+ const errors: string[] = [];
23
+ page.on("pageerror", (error) => errors.push(error.stack ?? error.message));
24
+ page.on("console", (message) => {
25
+ if (message.type() === "error") errors.push(message.text());
26
+ });
27
+
28
+ // Serve dist with an SPA fallback; the client has no server here, so other requests fail fast.
29
+ await page.route("**/*", (route) => {
30
+ const url = new URL(route.request().url());
31
+ if (url.origin !== origin) return route.abort();
32
+ const file = NodePath.join(distDir, decodeURIComponent(url.pathname));
33
+ const isAsset =
34
+ file.startsWith(distDir) && NodeFS.statSync(file, { throwIfNoEntry: false })?.isFile();
35
+ if (isAsset) return route.fulfill({ path: file });
36
+ if (url.pathname.startsWith("/api/") || url.pathname.startsWith("/.well-known/")) {
37
+ return route.fulfill({ status: 503 });
38
+ }
39
+ return route.fulfill({ path: NodePath.join(distDir, "index.html") });
40
+ });
41
+
42
+ await page.goto(`${origin}/`);
43
+ // React replaces the static #boot-shell splash when it mounts; showBootError fills it instead.
44
+ const settled = await page.waitForSelector("#root > :not(#boot-shell), #boot-error-reload", {
45
+ timeout: timeoutMs,
46
+ });
47
+
48
+ if (await settled.evaluate((node) => node.id === "boot-error-reload")) {
49
+ console.error("The built web client failed to boot:");
50
+ for (const error of errors) console.error(error);
51
+ process.exitCode = 1;
52
+ } else {
53
+ console.log("The built web client booted and mounted React.");
54
+ }
55
+} finally {
56
+ await browser.close();
57
+}
apps/web/tsconfig.json
+1
@@ -31,6 +31,7 @@
31
"vite.config.ts",
32
"vercel.ts",
33
"test",
34
+ "scripts/verify-built-boot.ts",
35
"scripts/warm-dep-cache.ts",
36
"../../scripts/lib/public-config.ts",
37
"../../scripts/lib/third-party-licenses.ts"