From d8e2fb6f25613728f0e2256ef57a2e15b9bc2f5d Mon Sep 17 00:00:00 2001 From: collissimo <148455189+collissimo@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:00:44 +0100 Subject: [PATCH] fix(desktop): Windows payload count leaves out the server compile cache Fork release run 45216237139 failed: the Windows payload had 111 files over the fork limit of 110. 43 of them are resources/server-compile-cache, one file per server chunk, up from 14 when the limit was last raised; the other 68 are unchanged. Upstream cross-builds Windows and never ships the cache, so its budget of 80 never counted it. Leave the cache out of the count and set the limit to 95: upstream's 80 plus the 15 fork natives. Verified: build-desktop-artifact.test.ts 55/55 with vp on PATH; the new cache assertion fails on collin/main (8 > 5) and passes with the fix; lint, format and typecheck clean Co-Authored-By: Claude Opus 5.5 --- scripts/build-desktop-artifact.test.ts | 14 ++++++++++++++ scripts/build-desktop-artifact.ts | 9 ++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index c9180ec3d3ae6..7be62014410af 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -986,6 +986,20 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { assert.deepStrictEqual(result.unpackedFiles, ["node_modules/native/addon.node"]); assert.isBelow(result.fileCount, WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT); assert.deepStrictEqual(secondAsar, firstAsar); + + const compileCacheDir = path.join(fixture.packagedAppDir, "resources/server-compile-cache"); + yield* fs.makeDirectory(compileCacheDir, { recursive: true }); + for (const name of ["manifest.json", "0016a2bb", "0736d3e0"]) { + yield* fs.writeFileString(path.join(compileCacheDir, name), "cache"); + } + const withCache = yield* validateWindowsPackagedPayload({ + stageDistDir: fixture.stageDistDir, + appExecutableName: fixture.appExecutableName, + targetArch: "x64", + appVersion: WINDOWS_PAYLOAD_FIXTURE_VERSION, + fileLimit: result.fileCount, + }); + assert.equal(withCache.fileCount, result.fileCount); }), ).pipe(Effect.provideService(HostProcess.Platform, "linux")), ); diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 0063a672e84a5..36baafdedb92e 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -1062,8 +1062,10 @@ export function resolveWindowsServerAsarIgnoreGlobs(arch: typeof BuildArch.Type) ]; } -// Fork: 110, not upstream's 80. Fork natives add 15 files and a native Windows build adds the server compile cache. -export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 110; +// Fork: 95, not upstream's 80, for 15 fork natives. Upstream cross-builds Windows without the +// server compile cache, which grows with every server chunk, so the count leaves it out. +export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 95; +const WINDOWS_PAYLOAD_UNCOUNTED_DIR = "resources/server-compile-cache"; export const WINDOWS_SERVER_RESOURCE_SOURCE_DIR = "apps/desktop/prod-resources/windows-server"; export const WINDOWS_SERVER_EXTRA_RESOURCES = [ { @@ -3204,6 +3206,7 @@ function collectUnpackedAsarFiles( const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(function* (root: string) { const fs = yield* FileSystem.FileSystem; const path = yield* Path.Path; + const uncounted = path.join(root, ...WINDOWS_PAYLOAD_UNCOUNTED_DIR.split("/")); const pendingDirectories = [root]; let count = 0; @@ -3215,7 +3218,7 @@ const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(functio const entryPath = path.join(directory, entry); const stat = yield* fs.stat(entryPath); if (stat.type === "Directory") { - pendingDirectories.push(entryPath); + if (entryPath !== uncounted) pendingDirectories.push(entryPath); } else if (stat.type === "File") { count += 1; }