diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index e1f6c600663fd..9677978e33adb 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -1657,6 +1657,24 @@ 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 cacheDir = path.join(fixture.packagedAppDir, "resources", "server-compile-cache"); + yield* fs.makeDirectory(cacheDir, { recursive: true }); + for (let index = result.fileCount; index < 99; index++) { + yield* fs.writeFileString(path.join(cacheDir, String(index)), "prepared bytecode"); + } + const validate = validateWindowsPackagedPayload({ + stageDistDir: fixture.stageDistDir, + appExecutableName: fixture.appExecutableName, + targetArch: "x64", + appVersion: WINDOWS_PAYLOAD_FIXTURE_VERSION, + }); + assert.equal((yield* validate).fileCount, 99); + yield* fs.writeFileString(path.join(cacheDir, "unexpected"), "extra file"); + const error = yield* validate.pipe(Effect.flip); + assert.instanceOf(error, WindowsPackagedPayloadValidationError); + assert.equal(error.reason, "file-limit-exceeded"); + assert.equal(error.fileCount, 100); }), ).pipe(Effect.provideService(HostProcess.Platform, "linux")), ); diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index e3a0eb75a8336..eec6194e8284d 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -1084,7 +1084,8 @@ export function resolveWindowsServerAsarIgnoreGlobs(arch: typeof BuildArch.Type) ]; } -export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 96; +// The Windows release has 76 runtime files plus 22 prepared server cache entries and their manifest. +export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 99; export const WINDOWS_SERVER_RESOURCE_SOURCE_DIR = "apps/desktop/prod-resources/windows-server"; export const WINDOWS_SERVER_EXTRA_RESOURCES = [ {