From 9a35a8a6e71d2d6c1438ad96cd4125290a3b845a Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Sat, 24 Oct 2026 14:39:08 +0200 Subject: [PATCH] test: check the toolkit install ignores the caller's pnpm config The release workflows run `pnpm --dir .release-toolkit install` from inside the caller's checkout. On ebcf84b a caller pnpm-workspace.yaml made that install run the caller's pnpm (12.14.0 for MetaEdit and notetweet) under its policy, or install the caller's packages instead of the toolkit's (exit 0, for quickadd). The toolkit's own pnpm-workspace.yaml fixed that in #22, but nothing would catch its removal. Self test now installs the toolkit inside a caller pinned to pnpm 12 with a hoisted node linker in both pnpm-workspace.yaml and .npmrc and an impossible minimumReleaseAge, then asserts the toolkit's pnpm ran, the toolkit's deps are installed and nothing was hoisted. It passes on main and fails on ebcf84b and on main without pnpm-workspace.yaml. --- .github/workflows/self-test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index d11281f..166ef14 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -47,6 +47,28 @@ jobs: - name: Test run: npm test + # The release workflows install the toolkit from inside the caller's + # checkout. A caller's pnpm pin, pnpm-workspace.yaml or .npmrc must not + # change that install, or it can silently install the caller's + # packages instead. + - name: Toolkit install ignores the caller's pnpm config + shell: bash + run: | + CALLER="$RUNNER_TEMP/caller" + mkdir -p "$CALLER" + git archive --prefix=.release-toolkit/ HEAD | tar -x -C "$CALLER" + cd "$CALLER" + echo '{"name":"caller","private":true,"packageManager":"pnpm@12.14.0"}' > package.json + printf 'nodeLinker: hoisted\nminimumReleaseAge: 999999999\n' > pnpm-workspace.yaml + echo 'node-linker=hoisted' > .npmrc + + pnpm --dir .release-toolkit install --frozen-lockfile --ignore-scripts | tee "$RUNNER_TEMP/toolkit-install.log" + + TOOLKIT_PNPM="$(node -p "require('./.release-toolkit/package.json').packageManager.split('@')[1]")" + grep -q "using pnpm v$TOOLKIT_PNPM" "$RUNNER_TEMP/toolkit-install.log" + test -f .release-toolkit/node_modules/@semantic-release/commit-analyzer/package.json + test ! -e .release-toolkit/node_modules/handlebars + lint-workflows: name: Lint workflows runs-on: ubuntu-latest