authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-10-12 00:37:22-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-12 00:37:22-07:00
logeac6ba5ae9dfcd8106b43ac1b5612b2983bda642
tree276a846d65441d1b5de6b2de0ed34023d5761d96
parent8f25cf9edb94ebe542ab51e46a2e6039cb3207d2
signature Signed by PGP key B5690EEEBB952194

ci: fail PRs on invalid allowBuilds entries in pnpm-workspace.yaml (#18564)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

2 files changed, 23 insertions(+), 1 deletions(-)

scripts/build-desktop-artifact.test.ts+20
...@@ -22,6 +22,7 @@ import {...@@ -22,6 +22,7 @@ import {
22 DesktopDmgBackgroundSourceMissingError,22 DesktopDmgBackgroundSourceMissingError,
23 createStageWorkspaceConfig,23 createStageWorkspaceConfig,
24 createStagePatchedDependencies,24 createStagePatchedDependencies,
25 readWorkspaceConfig,
25 createBuildConfig,26 createBuildConfig,
26 DESKTOP_ELECTRON_LANGUAGES,27 DESKTOP_ELECTRON_LANGUAGES,
27 DESKTOP_FILE_EXCLUSIONS,28 DESKTOP_FILE_EXCLUSIONS,
...@@ -497,6 +498,25 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {...@@ -497,6 +498,25 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
497 });498 });
498 });499 });
499500
501 // pnpm writes "set this to true or false" placeholders into allowBuilds when a
502 // tarball changes. pnpm ignores them, but the release build decode rejects them.
503 it.effect("decodes the repo allowBuilds and every file: tarball it names exists", () =>
504 Effect.gen(function* () {
505 const fs = yield* FileSystem.FileSystem;
506 const path = yield* Path.Path;
507 const { allowBuilds = {} } = yield* readWorkspaceConfig();
508 const repoRoot = path.join(import.meta.dirname, "..");
509 for (const key of Object.keys(allowBuilds)) {
510 const tarball = key.split("@file:")[1];
511 if (tarball === undefined) continue;
512 assert.isTrue(
513 yield* fs.exists(path.join(repoRoot, tarball)),
514 `allowBuilds names a missing tarball: ${key}`,
515 );
516 }
517 }),
518 );
519
500 it("stages pnpm 11 allowBuilds and patchedDependencies in the workspace yaml", () => {520 it("stages pnpm 11 allowBuilds and patchedDependencies in the workspace yaml", () => {
501 assert.deepStrictEqual(521 assert.deepStrictEqual(
502 createStageWorkspaceConfig({522 createStageWorkspaceConfig({
scripts/build-desktop-artifact.ts+3-1
...@@ -111,7 +111,9 @@ const encodeJsonString = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknow...@@ -111,7 +111,9 @@ const encodeJsonString = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknow
111const decodeWorkspaceConfig = Schema.decodeEffect(fromYaml(WorkspaceConfig));111const decodeWorkspaceConfig = Schema.decodeEffect(fromYaml(WorkspaceConfig));
112const encodeStageWorkspaceConfig = Schema.encodeEffect(fromYaml(StageWorkspaceConfig));112const encodeStageWorkspaceConfig = Schema.encodeEffect(fromYaml(StageWorkspaceConfig));
113113
114const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {114// Decodes the repo's pnpm-workspace.yaml. A PR CI test calls this too, so a bad
115// entry fails the PR instead of the nightly desktop build.
116export const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
115 const fs = yield* FileSystem.FileSystem;117 const fs = yield* FileSystem.FileSystem;
116 const path = yield* Path.Path;118 const path = yield* Path.Path;
117 const repoRoot = yield* RepoRoot;119 const repoRoot = yield* RepoRoot;