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 21, 21:00 UTC
fix(desktop): Linux desktop builds run the packaged-server self-check (#34863)
Julius Marminge committed
Nov 11, 2026 at 23:45 UTC
555bb2f97340b41e454928138754e627fa5456d1
2 files changed
+69
-4
scripts/build-desktop-artifact.test.ts
+33
-4
@@ -47,8 +47,10 @@ import {
47
ancestorNodeModulesPaths,
48
copyDirectoryPreservingSymlinks,
49
LinuxBrowserSecretHostError,
50
+ LinuxPackagedAppMissingError,
51
MacPackagedAppMissingError,
52
stageBrowserSecret,
53
+ validateLinuxPackagedPayload,
54
validateMacPackagedPayload,
55
validateWindowsPackagedPayload,
56
verifyPackagedBundleIsSelfContained,
@@ -215,8 +217,9 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
217
} as const;
218
});
219
218
-const makeMacPayloadFixture = Effect.fn("test.makeMacPayloadFixture")(function* (input: {
220
+const makePackagedAppFixture = Effect.fn("test.makePackagedAppFixture")(function* (input: {
221
readonly serverEntrySource?: string;
222
+ readonly resourcesPath?: string;
223
}) {
224
const fs = yield* FileSystem.FileSystem;
225
const path = yield* Path.Path;
@@ -227,7 +230,10 @@ const makeMacPayloadFixture = Effect.fn("test.makeMacPayloadFixture")(function*
230
yield* fs.writeFileString(serverEntryPath, input.serverEntrySource ?? "console.log('server');\n");
231
232
const stageDistDir = path.join(tempDir, "dist");
230
- const resourcesDir = path.join(stageDistDir, "mac-arm64/T3 Code.app/Contents/Resources");
233
+ const resourcesDir = path.join(
234
+ stageDistDir,
235
+ input.resourcesPath ?? "mac-arm64/T3 Code.app/Contents/Resources",
236
+ );
237
yield* fs.makeDirectory(resourcesDir, { recursive: true });
238
yield* Effect.promise(() =>
239
createPackageWithOptions(sourceDir, path.join(resourcesDir, "app.asar"), {}),
@@ -1380,7 +1386,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
1386
it.effect("rejects a macOS app whose packaged server bundle cannot resolve", () =>
1387
Effect.scoped(
1388
Effect.gen(function* () {
1383
- const fixture = yield* makeMacPayloadFixture({
1389
+ const fixture = yield* makePackagedAppFixture({
1390
serverEntrySource: 'import "t3code-deliberately-missing-package";\n',
1391
});
1392
const error = yield* validateMacPackagedPayload({
@@ -1396,7 +1402,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
1402
it.effect("accepts a macOS app whose packaged server bundle resolves", () =>
1403
Effect.scoped(
1404
Effect.gen(function* () {
1399
- const fixture = yield* makeMacPayloadFixture({});
1405
+ const fixture = yield* makePackagedAppFixture({});
1406
yield* validateMacPackagedPayload({ stageDistDir: fixture.stageDistDir });
1407
}),
1408
),
@@ -1429,6 +1435,29 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
1435
),
1436
);
1437
1438
+ it.effect("rejects a Linux app whose packaged server bundle cannot resolve", () =>
1439
+ Effect.scoped(
1440
+ Effect.gen(function* () {
1441
+ const fs = yield* FileSystem.FileSystem;
1442
+ const fixture = yield* makePackagedAppFixture({
1443
+ resourcesPath: "linux-arm64-unpacked/resources",
1444
+ serverEntrySource: 'import "t3code-deliberately-missing-package";\n',
1445
+ });
1446
+ const error = yield* validateLinuxPackagedPayload({
1447
+ stageDistDir: fixture.stageDistDir,
1448
+ }).pipe(Effect.flip);
1449
+ assert.instanceOf(error, BundleNotSelfContainedError);
1450
+ assert.include(error.output, "t3code-deliberately-missing-package");
1451
+
1452
+ const emptyStage = yield* fs.makeTempDirectoryScoped({ prefix: "t3-linux-payload-test-" });
1453
+ const missing = yield* validateLinuxPackagedPayload({ stageDistDir: emptyStage }).pipe(
1454
+ Effect.flip,
1455
+ );
1456
+ assert.instanceOf(missing, LinuxPackagedAppMissingError);
1457
+ }),
1458
+ ),
1459
+ );
1460
+
1461
it.effect("leaves the bundle self-check of a cross-built payload to the verify job", () =>
1462
Effect.scoped(
1463
Effect.gen(function* () {
scripts/build-desktop-artifact.ts
+36
@@ -3575,6 +3575,34 @@ export const validateMacPackagedPayload = Effect.fn("desktopArtifact.validateMac
3575
},
3576
);
3577
3578
+export class LinuxPackagedAppMissingError extends Schema.TaggedError<LinuxPackagedAppMissingError>()(
3579
+ "LinuxPackagedAppMissingError",
3580
+ { stageDistDir: Schema.String },
3581
+) {
3582
+ override get message(): string {
3583
+ return `Expected electron-builder to leave resources/app.asar under ${this.stageDistDir}/linux*-unpacked.`;
3584
+ }
3585
+}
3586
+
3587
+export const validateLinuxPackagedPayload = Effect.fn(
3588
+ "desktopArtifact.validateLinuxPackagedPayload",
3589
+)(function* (input: { readonly stageDistDir: string; readonly verbose?: boolean }) {
3590
+ const fs = yield* FileSystem.FileSystem;
3591
+ const path = yield* Path.Path;
3592
+ const asarPaths = (yield* fs.readDirectory(input.stageDistDir))
3593
+ .filter((entry) => entry.startsWith("linux") && entry.endsWith("-unpacked"))
3594
+ .map((entry) => path.join(input.stageDistDir, entry, "resources/app.asar"));
3595
+ if (asarPaths.length === 0) {
3596
+ return yield* new LinuxPackagedAppMissingError({ stageDistDir: input.stageDistDir });
3597
+ }
3598
+ for (const asarPath of asarPaths) {
3599
+ yield* verifyPackagedBundleIsSelfContained({ asarPath, verbose: input.verbose ?? false });
3600
+ }
3601
+ yield* Effect.log(
3602
+ `[desktop-artifact] Validated Linux payload (${String(asarPaths.length)} app bundle(s)).`,
3603
+ );
3604
+});
3605
+
3606
const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(function* (
3607
options: ResolvedBuildOptions,
3608
) {
@@ -4070,6 +4098,14 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f
4098
verbose: options.verbose,
4099
});
4100
}
4101
+ // The probe runs on the host Node, so a cross-arch build skips it.
4102
+ if (
4103
+ options.platform === "linux" &&
4104
+ hostPlatform === "linux" &&
4105
+ options.arch === (yield* HostProcess.Architecture)
4106
+ ) {
4107
+ yield* validateLinuxPackagedPayload({ stageDistDir, verbose: options.verbose });
4108
+ }
4109
// x64 builds on arm64 runners; the arm64 check covers the shared JS bundle.
4110
if (options.platform === "mac" && options.arch === "arm64" && hostPlatform === "darwin") {
4111
yield* validateMacPackagedPayload({ stageDistDir, verbose: options.verbose });